interface bootloader with pc to control motor using UART

Status
Not open for further replies.

mohammedehsan

Newbie level 2
Joined
Apr 14, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,297
hi everybody;
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 regards.
 

this is my code
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
}
}}}

- - - Updated - - -

i use this bootloader with pic to control direction of wheelchair from pc as instraction from speech recognition
 

well simulation always run.. and hardware doesn't.
as from your code it seems that you are using pic microcontroller. find out some uart examples from microchip site. more preferably from the device specific page. and try to implement them..

i need your schematic to under stand your device. can you post it here ?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…