Friday, May 05, 2006
Servo control cont.
Quickly implemented an RS232 interface to the servo testing circuit. It is a textbook solution using MAX232N for interfacing and hardware USART built into PIC. I connected the thing to the PC with a null-modem cable and used this software to send pulse width delay constant to the PIC. The setup worked on the first attempt, it was really easy to implement RS232 input. No interrupts used so far, firmware is something like:
main loop
delay for 20 ms
raise one output pin to logic 1
delay for some time some according to parameter
lower output pin to logic 0
check if serial input is available (RCIF flag in PIR1)
if serial is available then read byte and put it into pulse width delay parameter
goto main loop
This setup enabled me to try the servo's reaction to pulse widths well outside specification. The servo was able to turn much more then the specified 120 degrees (almost 180) but the needed control pulse width change was not linear when driven outside the specifications.
main loop
delay for 20 ms
raise one output pin to logic 1
delay for some time some according to parameter
lower output pin to logic 0
check if serial input is available (RCIF flag in PIR1)
if serial is available then read byte and put it into pulse width delay parameter
goto main loop
This setup enabled me to try the servo's reaction to pulse widths well outside specification. The servo was able to turn much more then the specified 120 degrees (almost 180) but the needed control pulse width change was not linear when driven outside the specifications.