Page 1 of 1

SERVO motor control example needed

Posted: Sun Oct 19, 2008 10:22 pm
by khaled yasin
need a servo motor example to see how to control a servo and to rotate CW and CCW

Re: SERVO motor control example needed

Posted: Mon Oct 20, 2008 1:31 am
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

Re: SERVO motor control example needed

Posted: Mon Oct 20, 2008 12:49 pm
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?

Re: SERVO motor control example needed

Posted: Tue Oct 21, 2008 9:15 am
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.