interface bootloader with pc to control motor using UART

Discuss with MikroElektronika software developers about current library development.
Post Reply
Author
Message
mohammedehsan
Posts: 3
Joined: 14 Apr 2013 08:56

interface bootloader with pc to control motor using UART

#1 Post by mohammedehsan » 14 Apr 2013 09:19

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 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
            }
}}}

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: interface bootloader with pc to control motor using UAR

#2 Post by filip » 30 Apr 2013 08:38

Hi,

Do you receive good characters in your code, sent from the Terminal ?

Regards,
Filip.

mohammedehsan
Posts: 3
Joined: 14 Apr 2013 08:56

Re: interface bootloader with pc to control motor using UAR

#3 Post by mohammedehsan » 30 Apr 2013 11:56

Hi to you...
yes, i get char. But no response in on the outpot port

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: interface bootloader with pc to control motor using UAR

#4 Post by filip » 07 May 2013 09:59

Hi,

Have you tried changing PORTB registers to LATB ?

Regards,
Filip.

mohammedehsan
Posts: 3
Joined: 14 Apr 2013 08:56

Re: interface bootloader with pc to control motor using UAR

#5 Post by mohammedehsan » 29 May 2013 18:19

Hi,Filip
yes ,I tried it befor but nothing change
thnx with regards

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: interface bootloader with pc to control motor using UAR

#6 Post by filip » 30 May 2013 07:35

Hi,

Do you have something connected to the PORTB which can interfere with the code ?
Which board are you using ?

Regards,
Filip.

Post Reply

Return to “Library Development Discussion”