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?