Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic16f877a THREE SERVOMOTORS SIMULTANEOUSLY!!!

Status
Not open for further replies.

krishnaraj916

Newbie level 6
Joined
Oct 13, 2011
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,384
I am trying to build a vehicle with an arm attached to it...as a part of project..
The project demands the use of 3 "servo" motors so as to keep the torque always...
The problem is the microcontroller pic16f877a needs to deliver signals of ON time(1-2ms) and time period 20ms... simultaneously to the three motor inputs
the point is the three must motors receive 3 different waveforms simultaneously!!!

If we use delay the whole of the µC freezes at that point!!!!:(
 

The project demands the use of 3 "servo" motors so as to keep the torque always...

Are to trying to get the servos to combine their torque? A servo tries to position itself to a specific position. It will fight to reach that specific position. It may even burn up trying to reach that position.

Are your servos arranged so they fight against each other?

Or are they acting independently? Each at a separate pivot location? That way one servo does not care what waveform another receives.
 
The project demands the use of 3 "servo" motors so as to keep the torque always...
...the point is the three must motors receive 3 different waveforms simultaneously!!!

If we use delay the whole of the µC freezes at that point!!!!:(

Utilizing a timer/timer interrupt would alleviate the need for software delays and the associated pointless burning of cycles.

There are various methods which can be used to accomplish the task.

The attached document details one such method to control two servos simultaneously, you should be able to adapt it your requirements.

BigDog
 

Attachments

  • Controlling_Servos_with_Interrupts.pdf
    239.8 KB · Views: 85
@BradtheRad: Thnx for the reply... I am using these 3 motors at separate pivots...just like a mechanical model of our hand..for picking objects!!
bt the problem lies in one uC giving 3 different waveforms at same time to the 3 servos

@bigdogguru:: thnx
 

@bigdogguru:: I am using external switches to control rotation of motors...Is that possible with timers???
 

Does your microcontroller have 3 output pins? Each pin sending a pulse (1 to 2 mSec) to one of the servos?

Or are you sending several pulses in a row from one pin? This is done with radio-controlled planes, etc. A 4017 IC is typically used to split up and distribute the pulses to the servos. Then silence for a fraction of a second. Then another train of pulses.
 

@bigdogguru:: I am using external switches to control rotation of motors...Is that possible with timers???

Certainly. The timer/interrupt is simply used to generate the required PWM. How you control the PWM's duty cycle is up to you, switches, pots, etc.

There are designs using the timer/interrupt which successfully control two dozen servos.

Many of the preprogrammed PIC based servo controllers which are available from third parties utilize a variation of this method.

BigDog
 
@BradtheRad: 3 pins of the uC sends pulses to the 3servo's separately...anyway using timers i figured it how!!
@bigdogguru: ur link ws helpful!! I will try to post the code soon

---------- Post added at 23:07 ---------- Previous post was at 21:38 ----------

I tried using timers to control the 3 servos... and it worked perfectly....
Bt am having a problem ... with the use of timers it calls interrupt every 512us i.e, every .5 ms ...
that is i get only one intermediate pulse between 1 and 2ms i.e, 1.5 ms...that's only 3 positions of the servo!!::(
\Is there a way to call interrupts lesser than this time a 100us or something???
I use a 4Mhz crystal
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top