BM Dept., Govt. Engg. College, Gandhinagar Page 41
MOV P1,#0ffh ;Make P1 output port
MOV P2,#00h ;Make P2 output port
MOV TMOD,#20h ;Timer 1, mode-2 ( auto reload mode)
MOV TH1,#0FDh ;Count value for baud rate 9600
MOV SCON,#50h ;8 bit UART mode, REN enable
MOV IE,#90h ; Enable serial interrupt and EA bit
MOV R0,#20h ;Pointer to the RAM location
SETB TR1 ;Start timer 1 to generated baud rate.
next: MOV A,@R0
MOV SBUF,A
INC R0
CJNE R0,#2Fh,next
serial: JB TI, transmit
MOV A, SBUF
MOV P0, A
CLR RI
RETI
transmit: CLR TI
RETI
END
:: WORKSHEET::
Exercise:
A. Modify program to transmit string “WELCOME TO GEC GANDHINAGAR” using
serial port. Use interrupt method and baud rate 9600.
Memory
Location
HEX
code
Label Opcode Operands Comments
Comments to this Manuals