This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with serial communication using AT89C51

Hi, I have been working in a project with AT89C51. Specifically it is a car that follows a black line and it has to be communicated with a raspberry pi 2 that has a camera to see some signals like turn left, turn right or stop. It is neccesary to use interruptions and serial communication ( it is the only way to communicate both things), the problem is the microcontroller doesn´t recognize serial inputs. I have simulated the code in proteus and it is working pretty well but in real life the serial communication is not working. I have tried serial communication with an arduino but has the same problem.I don´t know if Im missing something. My code is the next one:

ORG 000H        // origin
LJMP MAIN
ORG 23H
LJMP SERIAL
MAIN:           MOV P1,#204    // sets port 1 as input port
                        MOV P2,#0000000B        // sets port 0 as output port
                        MOV P0,#0000000B
                        MOV A,#0000
                        MOV SCON,#50H
                        MOV TMOD,#20H // TIMER1 mode autoreload
                        MOV TH1,#0FDH //9600 baudrate
                        MOV IE,#10010000B
                        SETB TR1
                (HERE IT IS THE MAIN CODE OF LINE FOLLOWER AND DEPENDIG OF THE VALUE OF REGISTER A,THE CAR STOPS OR TURNS LEFT/RIGHT)

HERE IT IS THE SERIAL INTERRUPT PART
//SERIAL PORT SUBRUTINA
ORG 120H
SERIAL:
          SETB P0.1
          MOV A,SBUF
          CLR RI
          RETI

END                       // end statement


Thanks for your help

Parents
  • The basic first step for serial comms in any context - not specific to any particular microcontroller or system - is to start with a terminal.

    So - can your code successfully communicate with a terminal (or a terminal emulator) on a PC?

Reply
  • The basic first step for serial comms in any context - not specific to any particular microcontroller or system - is to start with a terminal.

    So - can your code successfully communicate with a terminal (or a terminal emulator) on a PC?

Children