i interface my pc with serial port with bootloder has pic18f2550 to control DC motor direction (H_brige),simulation in protuos work well and rs232 with max232 work too,but problem when i loaded program to board does not work?
there is no voltage on my outpot
thanks with regard
Code: Select all
void main()
{
char uart_rd;
CMCON = 0x07; // To turn off comparators
ADCON1 = 0x0F;// To turn off ADC
TRISB = 0; // PORT B as output port
PORTB = 0; // Set RB0 to high
PORTB = 0b00000010; // o/p
UART1_Init(9600);
delay_ms(100);
while(1){
if (UART1_Data_ready()) {
uart_rd=UART1_Read();
if (uart_rd=='a'){
PORTB = 0b10011001 ;
//To turn motors forword
}
if (uart_rd=='s'){
PORTB = 0b00000000 ;
//To stop
}
if (uart_rd=='b'){
PORTB = 0b01100110 ;
//To back
}
if (uart_rd=='r'){
PORTB = 0b00001001 ;
//To right
}
if (uart_rd=='l'){
PORTB = 0b10010000 ;
//To left
}
}}}