PWM Servo

General discussion on mikroC.
Post Reply
Author
Message
sagat11
Posts: 3
Joined: 10 Feb 2016 08:02

PWM Servo

#1 Post by sagat11 » 02 Mar 2016 02:31

Hello guys im new to PIC and i have some questions about PWM. I have read some articles regarding this but still im confuse about it :)
What im trying to do right now is use the 2 PWM module of PIC16f877a to control my servos (left and right) wheel.
My question is:
1. Can i use the 2 PWM of the PIC simultaneously, with the same frequency? If not, any recommendation please..
2. The datasheet of my servo says:
-Frequency: 250-333hz
-Pulse Width Frequency: 1520
When i use 250 as parameter in PWM1_init(), it says "Argument is out of range". So what will be my frequency for PWM1_init()?
What does the Pulse Width Frequency: 1520 means? I hope you can help me guys thanks. God bless you all.

Btw im using mikroC pro compiler

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: PWM Servo

#2 Post by biljana.nedeljkovic » 04 Mar 2016 15:54

Hello,

You can go to our compiler, and check the example for the PWM written for PIC16F887, which is similar to the microcontroller you have.
Follow the path in the compiler:
"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for PIC\Examples\Internal MCU modules\P16F887\PWM"

You will see how to work with 2 PWM.
ALso please double check the PWM library in our compiler's Help file.

Best regards,
Biljana

Post Reply

Return to “mikroC General”