??? 05/04/09 16:50 Modified: 05/04/09 18:04 Read: times |
#165036 - Serial communications between 2 8051s |
Hey guys, I've been trying to get two 8051 connected to each other via the serial port, but I'm getting nowhere.
First, let me clarify my hardware connections. I need to send the letter 'A' from the first 8051 (lets call it 8051-X) to the second 8051 (8051-Y). Both controllers are using a 22.1184MHz crystal. I connected the TXD pin (pin 11) of 8051-X directly to the RXD pin (pin 10) of 8051-Y. Now the codes. On 8051-X, I have the following: ORG 0000H CLR P1.4 CLR P1.5 MOV SCON, #01010000B MOV TMOD, #21h MOV TH1, #high(232) SETB TR1 WAIT: CLR TI JNB P1.5, $ ;this thing is just so that I send one 'A' at a time JNB P1.4, $ MOV SBUF, #'A' JNB TI, $ CLR P1.5 CLR P1.4 JMP WAIT END On 8051-Y, I have this: ORG 0000H CLR P3.7 MOV SCON, #01010000B MOV TMOD, #21h MOV TH1, #high(232) SETB TR1 WAIT: JNB RI, $ MOV A, SBUF SUBB A, #'A' JNZ WAIT SETB P3.7 ;this is connected to a transistor and an LED END Using an oscilloscope, I can see that the TTL version of the letter A reaches the RXD pin (pin 10) of 8051-Y. But the code never seems to go to the SETB 3.7 line as the LED never lights up. I would really appreciate some help here. Thanks! *ps: the transistor-LED combo works when I manually do SETB 3.7. |
Topic | Author | Date |
Serial communications between 2 8051s | 01/01/70 00:00 | |
End receiver program with a dummy loop | 01/01/70 00:00 | |
Embarassing mistake![]() | 01/01/70 00:00 |