??? 03/01/04 20:19 Read: times |
#65769 - What is wrong in my serial comm prog |
The program is supposed to display OPEN on pressing O and CLOSE on pressing C on the terminal screen
$mod51 ORG 0000H ;Origin address LJMP MAIN ; Jump to intialisation ORG 000BH ORG 0023H ;Serial interupt LJMP SERIAL ; Jump to serial action routine ORG 30H MAIN: MOV P1,#0FFH ;Make P1 input port MOV TMOD,#20H ; Timer1 8 bit auto reload MOV TH1,#0FDH ;Set TH1 for 9600 bps MOV SCON,#50H ;8 bit data mode with 1 start and stop bit and receive enable MOV IE,#90H ;Global interrupt, serial interrupt enable,TIMER OVERFLOW ET0 INTERRUPT CLR P1.0 ;led Glows SETB TR1 ; Start timer for serial transmission CLR TI LOOP:SJMP LOOP ;-----------------END OF MAIN------------------------ ORG 350H SERIAL: JB TI,CLEAR MOV A,SBUF CJNE A,#'S',RET_OPEN MOV SBUF,#'K' SJMP RET_END RET_OPEN:CJNE A,#'O',RET_CLOSE CLR P1.0 CLR P1.1 MOV SBUF,#'O' MOV SBUF,#'P' MOV SBUF,#'E' MOV SBUF,#'N' SJMP RET_END RET_CLOSE:CJNE A,#'C',RET_END SETB P1.0 SETB P1.1 MOV SBUF,#'C' MOV SBUF,#'L' MOV SBUF,#'O' MOV SBUF,#'S' MOV SBUF,#'E' RET_END: CLR RI RETI CLEAR: CLR TI RETI END |