servo controlloer using 18f452

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

servo controlloer using 18f452

Postby pacai1987 » Mon Feb 01, 2010 7:34 pm

i using cytron servo controller sc16a. in the source example u giv for pic16f..
however i using 18f452 and mikroc software for programming.. this my programming, just simple programming to see servo motor move and change position for every 4 second.

CODE: SELECT_ALL_CODE
#define LED1 PORTB.f3
#define LED2 PORTB.f2
#define LED3 PORTB.f1


void main() {

TRISD = 0xFF;   //input
TRISB = 0x00;   //output
TRISC = 0b10000000; // rx tx port RC7 RC6
PORTB = 0;
UART1_Init(9600);
Delay_ms(2000);

while(1)
{
UART1_Write(0b01000001); // 1st bytes
UART1_Write(0b00001011); //2nd bytes
UART1_Write(0b00011011); // 3rd bytes
UART1_Write(0b00000000); // 4th bytes
LED1 = 1;
Delay_ms(4000);

UART1_Write(0b01000001);
UART1_Write(0b00000101);
UART1_Write(0b00101101);
UART1_Write(0b00000000);
LED2 = 1;
Delay_ms(4000);

UART1_Write(0b01000001);
UART1_Write(0b00010001);
UART1_Write(0b00001000);
UART1_Write(0b00000000);
LED3 = 1;
Delay_ms(4000);
}

}


the led is on and keep changing every 4 second but the motor not moving at all.. i cant use uart lib or something wrong with my code?
pacai1987
Fledgling
 
Posts: 1
Joined: Mon Feb 01, 2010 7:22 pm

Re: servo controlloer using 18f452

Postby joliza » Tue Feb 09, 2010 12:09 pm

hi Pacai1987,

We have upload sample source code of servo controller using PIC18F in website. You can use that as your references.But we can't check you programming because we use C Language in our sample program.
joliza
Novice
 
Posts: 22
Joined: Mon Jun 22, 2009 10:56 am

Re: servo controlloer using 18f452

Postby tkleong1437 » Thu Jun 17, 2010 1:48 am

what is the output result on ur UART interface ? Does it present valid SC16A command ? may try verify does SC16A require Cr/CrLf after each command code
tkleong1437
Freshie
 
Posts: 7
Joined: Fri May 28, 2010 10:49 pm


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 15 guests