Servo Motor Control with PIC16F84
Electronic Schematics > Microcontrollers > Servo Motor Control with PIC16F84

This simple micro-control circuit controls a servo motor according to a 3-state switch. A servo motor acts as an actuator in 3 position. It has 3 wires, one for VCC, one for Ground and another one for position control. The last signal is a single pulse with variable width. The pulse width can vary between 1 and 2 mSec. An 1 mSec pulse width turns the motor axis in -45 degrees position. An 1.5 mSec pulse width turns the motor axis in 0 degree position. A 2 mSec pulse width turns the motor axis in +45 degrees position. The following source code has been written in PICBasic:

Symbol porta = 5
b3 = 150
start:
Peek porta,b0
If bit0 = 0 Then sweepl
If bit1 = 0 Then sweepr
Pulsout 0,b3
Pause 18
Goto start
sweepl:
b3 = b3 + 1
Pulsout 0,b3
Pause 18
If b3 > 200 Then hold1
Goto start
sweepr:
b3 = b3 - 1
Pulsout 0,b3
Pause 18
If b3 < 100 Then hold2
Goto start
hold1:
b3 = 200
Goto start
hold2:
b3 = 100
Goto start

Title: Servo Motor Control with PIC16F84
electronic circuit
Source: unknown
Published on: 2005-08-27
Reads: 9703
Print version: Print version

Other electronic circuits and schematics from Microcontrollers


Electronic circuits > Microcontrollers > Servo Motor Control with PIC16F84