PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 18, 2007 5:04 pm |
|
|
I guess I didn't read your initial post very carefully. You're actually
just trying to drive a servo.
This is the TS-53 servo:
http://www2.towerhobbies.com/cgi-bin/wti0001p?&I=LXUK84
Here is a project page which shows how use that servo.
It has oscillscope waveforms.
http://www.dprg.org/projects/2003-05a/
CCS has a servo driver program. Here's the filename and location:
Quote: | c:\Program Files\Picc\Drivers\Servos.c |
Here's a demo program for it. The servo output pins are defined
near the start of the Servos.c file. The default pins are D6 and D7.
I tested the program below with PCM vs. 4.041 and it works.
You can see the servo pulses on pins D6 and D7 of the PIC.
Code: |
#include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#include <servos.c>
//======================================
void main()
{
init_servos();
while(1)
{
set_servo(LEFT, FORWARD, 2);
set_servo(RIGHT, FORWARD, 3);
delay_ms(500);
set_servo(LEFT, FORWARD, 1);
set_servo(RIGHT, FORWARD, 2);
delay_ms(500);
}
} |
|
|