| ??? 07/24/03 05:56 Read: times |
#51278 - Half-Duplex |
i've a small Half-duplex(but working as simplex) program in 8051 using Timer0 for delay and Timer1 for Serial Transmission. The Tx transmits one byte which is received by the Rx. Rx just after receiving the byte sends the same byte to the Tx. Tx receives the same byte and displays it on the port and then sends the next byte.
Serial Interrupt Code for Tx: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SERIAL: JB RI,RECEIVE ;If Tx receives one byte, RI ;is set, and RECEIVE is reached. CLR TI ; else Tx transmits the byte MOV SBUF,@R0 RETI RECEIVE: CLR RI MOV P0,SBUF RETI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Code for Rx: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SERIAL: CLR RI ; byte is received and displayed MOV A,SBUF MOV P0,A CLR TI MOV SBUF,A ; same byte is Transmitted back RETI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Now the code runs as a half-duplex control. Tx is transmitting and the byte is being received by the Rx. But Rx is not transmitting the same byte it receives from Tx. and thus RI in Tx is not set. Why Rx is unable to send the byte by this code. Pl. help. Thanks Pawan |
| Topic | Author | Date |
| Half-Duplex | 01/01/70 00:00 | |
| RE: Half-Duplex | 01/01/70 00:00 | |
| RE: Half-Duplex | 01/01/70 00:00 | |
| RE: Half-Duplex | 01/01/70 00:00 | |
RE: Half-Duplex | 01/01/70 00:00 | |
| RE: Half-Duplex | 01/01/70 00:00 | |
| RE: Half-Duplex | 01/01/70 00:00 |



