Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
I don't understand your problem. RC servos are pretty straightforward. What is it about changing the pulse width to change position that is causing you a problem?
A servos motor is any motor that has feedback. But many times when you say servo you are referring to an "elbow" motor, not a wheel motor that can spin an infinite number of times in either direction. 180 degrees is the maximum range for most servos. Many only have a 90 degree range. And a few have 270 degrees. Very few have multiple rotations (I've never heard of an RC servo that does).
I am currently working on a project for school. I am using a MC68HCS12 design board by Axiom. My compiler is ICC ImageCraft. The Servos I am using are three Hitec HS-311 & one HS-635HB. I have modified one HS-311 for continuous rotation. From reading most of these posts it looks like I am not able to drive one of these servos from my microcontroller. Do I need a H-bridge? Can I use a L298 to drive the servos? I did get the HS-311 servo to run directly from my board, but is only goes in one direction. I can't get my test program to execute other instructions. It only executes the first one and that is it. I will supply my code down below so you can see what I did. Keep in mind I was trying a variety of different configurations so I commented a lot of code out. So here is my real problem. Getting my code to control the servo in multiple directions or to a certain spot. Another problem I am having is trying to know the angle the servo is at. I connected the potentiometers wire to my ATD and it has a voltage drop of 1.36V to 0.26V and I am using a 10-bit conversion. After calculating, it looks like my resolution is 1.07mV. I am able to read the ATD but my angles are off. I will supply the math I did. I am sure it is off. Also I noticed that these servos only worked at 330HZ for center, 430HZ for clockwise, and 230HZ for counterclockwise. I would really appreciate some help on this. ----------------------------------------------------------------------------------------
/*PWM Test*/
#include <hcs12dp256.h>
#include <lcd.h>
#include <STDIO.H>
void main(void)
{//main begins
//LCDInit(); // initialize LCD
//ADC_int(); //initialize the A to D (ATD) converter
init_pwm (); //initialeze the PWM
setbaud(BAUD9600); // set bits per second rate (baud)to 9600 bits per second
//#pragma interrupt_handler read_sensor
void read_motor(void)
{//read_motor begins
puts("The angle is: "); //displays The angle is: on the screen
motor();
delay_1sec();
}//read_motor ends
//#pragma interrupt_handler ADC_int
void ADC_int(void) //initializes the Analog To Digital Converter
{//ADC_int begin
ATD0CTL2=0xE0;
delay_40us();
ATD0CTL3=0x0A;
ATD0CTL4=0x01; //0x01 = 10bit Conversion
}//ADC_int end
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.