Servo and Clock or PWM

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Contact:

Servo and Clock or PWM

Post by Mark »

Hi,

I have successfully set up the servo component.

On another project I have successfully used the PWM component.

Trying the two together seems to stop either working properly.

I therefor though of using a clock to provide the PWM. This has the servo jumping all over the place, whichever clock I use.

Please suggest a strategy to enable me to use a servo and PWM (in some form).
It would also be useful to know what resources the servo component uses.

The chip used is a 16F887 using the internal clock.
Servo is on RD2.
The PWM was to be on RD1 but the attached code just looks at the clock effect.
I am using v6.0.7.0.

Thanks.
Attachments
ServoandClock1.fcfx
Servo and Clock
(14.78 KiB) Downloaded 72 times
Go with the Flow.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8923
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Servo and Clock or PWM

Post by medelec35 »

Hi Mark, have you see this thread?
There are a few posts, but don't forget to checkout the flowchart on the last page.

Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 14865
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Servo and Clock or PWM

Post by Benj »

Hello,

The Servo component utilises the Timer 1 peripheral and the Capture Compare CCP peripheral, as does the PWM component.

So you can either generate the servo signals using the timer 0 interrupt as Martin showed or you can generate the PWM using software techniques and the timer 0 interrupt.

An example of software PWM can be found here, http://www.matrixtsl.com/article.php?a=52

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Contact:

Re: Servo and Clock or PWM

Post by Mark »

Thank you both, I expected that some clash of resources was on hand.

Mark
Go with the Flow.

Post Reply