PIC16F877A is an easy micro controller for the beginners
Here in project:
1) How PIC switches servo motor forward and back ward
When we push one switch it goes to positive 90 degree , on second switch it moves backward to negative 90 degree
a. MickroC PRO // for programming of MICRO CONTROLLER
b. Proteous 8 professional //For simulation of CKT and Design
BEST OF LUCK.
Eng. Mahmoud Abuzayed
Step 1: R/C Servo Control Theory
Servos designed for use in radio-controlled airplanes, cars, and boats can be easily interfaced to a PIC MCU. They are often used for robots and applications where simple mechanical movement is required. This might be surprising because a positional servo is considered to be an analog device. The output of an RC servo is usually a wheel that can be rotated from 0 to 90 degrees. (some servos can turn from 0 to 180 and others have very high torque outputs for special applications). Typically, they only require +5 V, ground, and an input signal.
An RC servo is an analog device; the input is a PWM signal at digital voltage level. This pulse is between 1.0 and 2.0 ms long and repeats every 20 ms .The length of the PWM pulse determines the position of the servo’s wheel. A 1.0-ms pulse will cause the wheel to go to 0 degrees and a 2.0-ms pulse will cause the wheel to go to 90 degrees.
Pulse Width Modulation (PWM)
Pulse Width Modulation (PWM) is one of the powerful techniques used in control systems today. They are not only employed in wide range of control application which includes: speed control, power control, measure and communication.
Basic Principal of PWM
PWM is achieved with the help of a square wave whose duty cycle is changed to get a varying voltage output as a result of average value of waveform. A mathematical explanation of this is given below:
Step 2: PIC PWM Module
In Pulse Width Modulation mode, the CCP1(RC2) pin produces up to a 10-bit resolution PWM output. Since the CCP1 pin is multiplexed with the PORTC data latch, the TRISC<2> bit must be cleared to make the CCP1pin an output.
Figure below shows a simplified block diagram of the CCP module in PWM mode.
A PWM output has a time-base (period) and a time that the output stays high (duty cycle). The frequency of the PWM is the inverse of the period (1/period).