Thanks for all the replies i shall try and go through them now
Quote Originally Posted by Acetronics View Post


your accelerometer is an analog one, Ok ... but ADCIN can give a result between 0 and 256 ...

so, the servo signal range is not guaranteed to be in the " valid" range.

BTW ... Which Pic and Accelerometer do you use ???

Alain
Firstly i understand that the ACDIN can give the range from 0-256 how ever the accelerometer is not capable of giving a value of 0-5v, I can't remember the exact voltages as theyre at work but the values i receive on the ACDIN when moving from one limit to the other are 45-128. This is the reason i add a value to the number to try and keep the server centeral(yes i know its not the correct value yet :P ).

The Pic I am using is a 16f876A
and the accelerometer is a prototyping board which i brought from sure electronics http://cgi.ebay.co.uk/3-Axis-low-g-A...1%7C240%3A1318

Quote Originally Posted by Joe S. View Post
Hi Chris,
I have only a little experience with servos, and do not have my computer at hand, but the best I remember, if I sent a number to my servo it executed fully before accepting a new value, so I am thinking if you send a count to the servo something like 1500, 1510, 1520 . . . to cause movement you can snuggle an interrupt between the numbers.
EDIT: after reading your code, looks like pretty much what you are doing. I'm empty.

I see no interrupt in your code, Why would you be able to stop it? I never have been able to hijack the count variable in a for next loop, you might try using an interrupt routine and clearing the variable in there, I do not know if it will work though.


Could be latency, could be Breadboard issues where stray capacitance stops the oscillator, could be power supply causing PIC brownout reset, I see no config statement so I assume you are using default config, . . . could be GOTO MAIN at the end of servomove when you used gosub to get there, causing a stack overflow, and eventual reset. . . . On closer inspection looks like you have a return and goto main in there . . . I don't know how that would affect operation if at all since theoretically the code should never go past the return, but who knows? Computers (and PICs) are stupid, but not sloppy, they only do what you tell them to do, whether intentionally or not.
Keep us posted, I would like to see your Final Cut, looks like it would make a cool VR control for a camera in an RC heli.
Yer i think that is the problem the FOR loop is not very interuptable. Thats somthing im going to change once i get time to play with it again.
Shouldnt be a problem with latency as i only ever use veroboard though i havnt placed any capacitors across the crystal so i shall do that asap to see if that helps.
Power supply wise i have tried the circuit on several different powersupplies both at work and at home, the only issue i had there was i had the current limiter at around 100 mA and the servo seems to draw a considerable amount to trip that on its first start up! But hat has now been rectified with a 470 uF across the power rails next to the servo and upping the current limiter.

I shall lso try removing the goto main which was left in from a older attempt but i cant see that command even being looked at but its worth a try!

Orriginally i had planned to make a Pan-Tilt head for a camera but im now looking at making this into a robotic arm kind of setup with possibly strain gauges to detect a hand closing..... i dont know that somthing for later