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 CCS Technical Support

SERVO MOTOR

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



Joined: 29 Mar 2010
Posts: 3

View user's profile Send private message

SERVO MOTOR
PostPosted: Mon Mar 29, 2010 7:40 am     Reply with quote

Hello I'm using a servo motor futaba S3003. I'm using this code:
Code:

#include "18f4550.h"
#fuses HS,NOWDT
#use delay(clock = 4000000)
#define servo PIN_B1

void main(){

   while(true)
   {
   OUTPUT_HIGH(servo);
   delay_us(1500);
   OUTPUT_LOW(servo);
   delay_us(18500);
      
   }
}

Whatever values I put on the delay, the servo rotates to same side, I cannot rotate to the other side, or center. Can you tell me why, or what I'm doing wong?
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Mar 29, 2010 8:10 am     Reply with quote

You need to learn how to use the forum search:

Searching on the word servo found this:

http://www.ccsinfo.com/forum/viewtopic.php?t=38862
_________________
Google and Forum Search are some of your best tools!!!!
mbge5amw



Joined: 13 Dec 2004
Posts: 15
Location: Yorkshire, UK

View user's profile Send private message MSN Messenger

PostPosted: Mon Mar 29, 2010 8:11 am     Reply with quote

I don't know if you have any external pullup resistors on your device to make the pins go high.
You may need the line
Code:
port_b_pullups(TRUE);

before your while loop.

I would also suggest you get a meter to double check that the output pin is/is not toggling as you expect, so you can identify if it is a SW or HW issue

Andy
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Mon Mar 29, 2010 8:31 am     Reply with quote

You don't really need pull-ups. Do you get a pulse on B1? Can you check this with an oscilloscope? If not, in your clock/fuse definition:
Code:
#fuses HS,NOWDT
#use delay(clock = 4000000)
Use XT instead of HS.

Rohit
misato14



Joined: 29 Mar 2010
Posts: 3

View user's profile Send private message

PostPosted: Mon Mar 29, 2010 8:48 am     Reply with quote

We already used an oscilloscope, and it is 50 Hz wave and the duty cycle is correct. I already use fuse XT and HS... the result is the same....
dezso



Joined: 04 Mar 2010
Posts: 102

View user's profile Send private message

PostPosted: Mon Mar 29, 2010 9:14 am     Reply with quote

http://mcu-programming.blogspot.com/2006/09/servo-motor-control.html
misato14



Joined: 29 Mar 2010
Posts: 3

View user's profile Send private message

PostPosted: Mon Mar 29, 2010 9:48 am     Reply with quote

I already seen that link, but problem remains, is that the servo rotate to one side whatever value I put in the duty cycle. I cannot find the problem and I already buy a new servo motor. I'm using pic 18f4550.
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