SERVO motor control example needed

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

Moderators: Benj, Mods

Post Reply
khaled yasin
Posts: 43
Joined: Sat Sep 13, 2008 10:36 pm
Contact:

SERVO motor control example needed

Post by khaled yasin »

need a servo motor example to see how to control a servo and to rotate CW and CCW

jmccorison
Posts: 26
Joined: Mon Aug 18, 2008 11:47 pm
Location: Orcas Island, WA
Contact:

Re: SERVO motor control example needed

Post by jmccorison »

I notice that you regularly post questions which can be easily answered by a simple session of clicking through Matrix Multimedia's website. Some pages you might want to spend quality time with are:

Flowcode Examples Page
http://www.matrixmultimedia.com/Flowcode_Examples.php

Knowledge Exchange Articles
http://www.matrixmultimedia.com/mmforum ... m.php?f=26

The Learning Center
http://www.matrixmultimedia.com/Learnin ... /index.php

and there are others.

This group seems quite knowledgeable and willing to help when questions are asked. But one should do some basic research on their own before asking questions. After all, it is you who is developing the project, not the community at large.

-Jim

khaled yasin
Posts: 43
Joined: Sat Sep 13, 2008 10:36 pm
Contact:

Re: SERVO motor control example needed

Post by khaled yasin »

thank you for your help very much>>>>
am new with flow code and C-PIC programming and i dont understand alot of what is done in these examples....for example in the servo motor 1 example do we have set all port C as an output...why? i know that we only need one pin to control the servo or does this example controsl like 8 servos? can i change port C to another port ?this example uses CCP1/CC2 why?

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: SERVO motor control example needed

Post by Benj »

Hello

The servo motor example works something like this.

Loop
{

The 8 bits of an output port are cleared to switch off all 8 devices.

A timer is set running using CCP1 to set the maximum period per channel.

A second timer is set running using CCP2 to set the mark space ration for the single channel within the period.

A index variable is incremented to move to the next channel

}

Hope this helps.

As long as you change all of the PortC entries (I think there is two but there could be more) you can change to allow any I/O port though you will need to use a port with all 8 bits if you wish to use all 8 servo channels.

Post Reply