[En-Nut-Discussion] Control function to drive a RC servo
ptlinux at optushome.com.au
Sun Jun 8 04:45:42 CEST 2003
I am trying to write a simple application for controlling a RC Servo
using the Digital Output on Ethernut.
The characteristic of the Servo is controlled by the period of the
square wave. With 5V pulses of 1.5 (peak) ms is neutral (Centre
position) with 2.0 ms and 1.0 ms controls the left and right extreme of
the horizontal movement. The period of the pulse should be around 20ms.
I have modified the Portdio.c to create the square wave required. I am
not sure if it is going to work?!
mask = 0x10;
outp(inp(PORTD) | mask, PORTD);
NutSleep(2); // this should move the camera to
outp(inp(PORTD) & ~mask, PORTD);
NutSleep(20); // produce a delay of 20ms. pull
Will this code work?!
I have created a thread to run this. is that the right way to do it?!
Do I need to use timers? I am not too familiar with timers?
Hope someone can put me into the right direction.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the En-Nut-Discussion