View previous topic :: View next topic |
Author |
Message |
Sling989
Joined: 17 Oct 2010 Posts: 3
|
16f877A multiple servos and RS232 |
Posted: Sun Oct 17, 2010 9:44 am |
|
|
Hi I'm very new to programming PICs and I need to program a 16F877A so that it moves 3 standard servos with high precision - 180 degrees for one of them. I'll be using RS232 to feed instructions. Does anyone have a working code for that? |
|
|
Sling989
Joined: 17 Oct 2010 Posts: 3
|
|
Posted: Sun Oct 17, 2010 5:21 pm |
|
|
I'm able to move one servo using delay_ms commands now ... any advice on coding the PIC to move more than one servo would be very much appreciated from this C newbie !
Maybe using an interrupt or timer1 ???
It'll have to do more than just move servos in its final application so all the different methods of coding that I've come across in my research have got me kind of puzzled as to the best way to do it ! |
|
|
sturnfie
Joined: 26 Apr 2010 Posts: 17 Location: Palatine, IL
|
|
Posted: Mon Oct 18, 2010 11:01 am |
|
|
Sling989 wrote: | I'm able to move one servo using delay_ms commands now ... any advice on coding the PIC to move more than one servo would be very much appreciated from this C newbie !
Maybe using an interrupt or timer1 ???
It'll have to do more than just move servos in its final application so all the different methods of coding that I've come across in my research have got me kind of puzzled as to the best way to do it ! |
For the RS232 functionality, I'd recommend using a UART module on the PIC and a MAX232 transceiver chip.
Servos are usually driven by a PWM signal. The pulse width maps to a specific rotation of the servo from center. Use several PWM modules if you want to easily drive several servos. You can also bit-bang regular I/O pins to implement a PWM signal, but then you'll have to handle the timing portions yourself. _________________ Lucas Sturnfield
Blog - http://www.sturntech.com/blog |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Mon Oct 18, 2010 11:52 am |
|
|
I have to assume you mean HOBBY style RC servos..
.. not the stuff I deal with.
In future please specify the make/model as 'servo' is a generic word, kinda like 'computer'.... |
|
|
Sling989
Joined: 17 Oct 2010 Posts: 3
|
|
Posted: Tue Oct 19, 2010 6:24 pm |
|
|
temtronic wrote: | I have to assume you mean HOBBY style RC servos..
.. not the stuff I deal with.
In future please specify the make/model as 'servo' is a generic word, kinda like 'computer'.... |
Sorry about that. They are Futaba S148 servos.
http://www.technobotsonline.com/futaba-servo-s148.html |
|
|
|