I am not be able work together Servo and PWM

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

Moderator: Benj

Post Reply
ITISVARESE
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

Post by ITISVARESE »

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
Attachments
Servo+PWM.JPG
(116.26 KiB) Downloaded 497 times

User avatar
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

Post by Jan Lichtenbelt »

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

dazz
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

Post by dazz »

Hi
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

ITISVARESE
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

Post by ITISVARESE »

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
Attachments
For Daz.fcfx
Flowchart
(10.41 KiB) Downloaded 241 times

User avatar
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

Post by Benj »

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.

ITISVARESE
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

Post by ITISVARESE »

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

Post Reply