Hello,
Using Flowcode V6 i have try work together Servo and PWM: in simulation all is ok but in real circuit
PIC16F877 4 MHz together don't work. If i use only Servo or only PWM work ok together not (real circuit don't
change, only change flowchart deleting specific macro).
Thanks in advance
I am not be able work together Servo and PWM
Moderator: Benj
-
- Posts: 56
- Joined: Sat Jul 07, 2007 3:00 pm
- Has thanked: 9 times
- Been thanked: 3 times
- Contact:
I am not be able work together Servo and PWM
- Attachments
-
- Servo+PWM.JPG
- (116.26 KiB) Downloaded 497 times
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: I am not be able work together Servo and PWM
Dear Itisvarese,
I do not know the problem in your Flowcode. I can only make general remarks concerning servo's.
The Servo's needs een pulse of 1-2 msec with a repetition rate of 50 Hz (20 msec). That means the outer left (counter clock) rotation the PWM must be 1/20= 5% and the outer right (clock rotation) needs a PWM of 2/20=10%. These values can change from servo to servo. That means you have to find out yourself what are the exact values for the PMW. Pay attention: If the PWM is out of range for the servo, the servo will takes a lot of current. This is an unwanted situation as should be as short duration as possible.
If you remove the mechanical boundariesstops at left and right site, a servo becomes a simple rotation motor, which needs PMW >10% (clock wise rotation) or <5% (counterclockwise rotation). There is a discription available (in Dutch) to remove this stops
http://duteela.et.tudelft.nl/~elca/Xili ... vohack.pdf
Good luck
Jan Lichtenbelt
I do not know the problem in your Flowcode. I can only make general remarks concerning servo's.
The Servo's needs een pulse of 1-2 msec with a repetition rate of 50 Hz (20 msec). That means the outer left (counter clock) rotation the PWM must be 1/20= 5% and the outer right (clock rotation) needs a PWM of 2/20=10%. These values can change from servo to servo. That means you have to find out yourself what are the exact values for the PMW. Pay attention: If the PWM is out of range for the servo, the servo will takes a lot of current. This is an unwanted situation as should be as short duration as possible.
If you remove the mechanical boundariesstops at left and right site, a servo becomes a simple rotation motor, which needs PMW >10% (clock wise rotation) or <5% (counterclockwise rotation). There is a discription available (in Dutch) to remove this stops
http://duteela.et.tudelft.nl/~elca/Xili ... vohack.pdf
Good luck
Jan Lichtenbelt
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: I am not be able work together Servo and PWM
Hi
Can you please attach your flowchart to a post as without it makes it difficult for others to help
Ragrads
Dazz
Can you please attach your flowchart to a post as without it makes it difficult for others to help
Ragrads
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
-
- Posts: 56
- Joined: Sat Jul 07, 2007 3:00 pm
- Has thanked: 9 times
- Been thanked: 3 times
- Contact:
Re: I am not be able work together Servo and PWM
Thank dazz and Jan,
circuit in Flowcode simulation work but in real circuit not; is not electrical problem because sure that work and also
with or servo or pwm work but with together don't work (simply i delete pwm macro or servo macro from flowcchart to test).
I uploaded flowchart
circuit in Flowcode simulation work but in real circuit not; is not electrical problem because sure that work and also
with or servo or pwm work but with together don't work (simply i delete pwm macro or servo macro from flowcchart to test).
I uploaded flowchart
- Attachments
-
- For Daz.fcfx
- Flowchart
- (10.41 KiB) Downloaded 241 times
- 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: I am not be able work together Servo and PWM
Hello,
The servo component works by utilising two capture compare peripherals to do the timings in hardware and allow your program to continue without being dedicated to the servo motor timings. The PWM component also uses a capture compare peripheral. If your micrcontroller device only has two CCP peripherals then this is why you are unable to use the servo and PWM together. The easiest way around the issue is probably to create a software based PWM by using a timer interrupt.
Examples of this can be found here.
http://www.matrixtsl.com/article.php?a=52
I will have a look and see if there is a way of warning users which peripherals are used by which components.
The servo component works by utilising two capture compare peripherals to do the timings in hardware and allow your program to continue without being dedicated to the servo motor timings. The PWM component also uses a capture compare peripheral. If your micrcontroller device only has two CCP peripherals then this is why you are unable to use the servo and PWM together. The easiest way around the issue is probably to create a software based PWM by using a timer interrupt.
Examples of this can be found here.
http://www.matrixtsl.com/article.php?a=52
I will have a look and see if there is a way of warning users which peripherals are used by which components.
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: 56
- Joined: Sat Jul 07, 2007 3:00 pm
- Has thanked: 9 times
- Been thanked: 3 times
- Contact:
Re: I am not be able work together Servo and PWM
Hello Benj,
ok, now i know this; i will try with interrupt.
There is a table, or similar, that show resourse that Flowcode use for the component?
Thanks
ok, now i know this; i will try with interrupt.
There is a table, or similar, that show resourse that Flowcode use for the component?
Thanks