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.
Servo and Clock or PWM
Moderator: Benj
-
- Posts: 209
- Joined: Thu Oct 19, 2006 11:46 am
- Location: Bakewell, UK
- Has thanked: 20 times
- Been thanked: 16 times
- Contact:
Servo and Clock or PWM
- Attachments
-
- ServoandClock1.fcfx
- Servo and Clock
- (14.78 KiB) Downloaded 231 times
Go with the Flow.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Servo and Clock or PWM
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
There are a few posts, but don't forget to checkout the flowchart on the last page.
Martin
Martin
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Servo and Clock or PWM
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 209
- Joined: Thu Oct 19, 2006 11:46 am
- Location: Bakewell, UK
- Has thanked: 20 times
- Been thanked: 16 times
- Contact:
Re: Servo and Clock or PWM
Thank you both, I expected that some clash of resources was on hand.
Mark
Mark
Go with the Flow.