Software > Software

sending out 1.5ms

(1/2) > >>

I'd like to send out a 1500 ms pulse to center my servos before modding then, but don't know how to do that.
My guess would be to program the atmega8-16pc, or use a cap resistor combo for it to pulse out at 1500ms
I know the general methos. but don't know how to actually do it.
What would the code be for the avr?

please anyone. the cable should be here anytime

I know this is for the $50 robot project.  I am unfamiliar with the atmega8-16pc, though.

What do you program it in?  If I know this I probably can help you.

so you can program AVRs in C or assembly.
most people choose C for simplicities sake.

as for timing routines, the easiest way is to set up a timer interupt.
this will interupt normal code execution at the specified interval.
the actual time between interupts will depend on a few things, your AVRs clock frequency being the most obvious but it is fairly easy to work this out from the datasheet.
once you know how many milliseconds between timer interupts, just count them until you reach 1500.

hmm. i think i just made that sound easy.
the first time i did it i spent a *lot* of time trying to get my timing pulses right.
if you can borrow an oscilloscope it will make things easier.

alternatively you can hunt around for some pre written code that gives you nice, precise delays without you having to code them yourself.


What you said didn't sound easy, but at least made some sence   :-\
Would this work?

--- Code: ---i = 1500;
while(i > 0)
--- End code ---


[0] Message Index

[#] Next page

Go to full version