CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PWM - Pulse Width Modulation issues

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 18, 2007 5:04 pm     Reply with quote

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);
  }

}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group