Вы находитесь на странице: 1из 9

Design an 8051 MC based system for serial data communication

with a PC as per the requirements given below.


 Use AT89s8252 (flash MC with In System Programming(ISP)
 Use 12 MHz freq.
 Use on chip program memory to storing program instructions
 Baudrate for communication is 9600
 Serial data transmission format is 1 start bit, 8 data bits and 1
stop bit
 The system echoes (sends back) the data byte received from
PC to the PC.
 On receiving the data byte from the serial port it is indicated
through the flashing of an LED connected to a port pin.
 Use Maxim’s MAX232 RS232 level IC shifter for converting the
TTL serial data signal to RS-232 compatible voltage levels.
 Use ‘Hyper Terminal’ application provided by windows OS for
sending and receiving serial data to and from the MC.
Serial Polling
ORG 0000H
MOV TH1, #FD
JMP 0050H
ORG 0003H MOV TL1, #FD
RETI MOV SCON, #50
ORG 000BH ANL PCON, #EF
RETI SETB TR1
ORG 0013H
Recv: JNB RI, Recv
RETI
ORG 001BH CLR P2.0
RETI MOV A, SBUF
ORG 0023 CLR RI
RETI MOV SBUF, A
ORG 0050H
transmit : JNB TI, transmit
SETB P2.0
MOV SP, #08H SETB P2.0
CLR TR1 CLR TI
MOV TMOD, #20H JMP Recv
CLR EA END
Serial
Interrupt
ORG 0000H
JMP 0050H
ORG 0003H
RETI MOV TMOD, #20H
ORG 000BH MOV IE, #90
RETI MOV TH1, #FD
ORG 0013H
MOV TL1, #FD
RETI
ORG 001BH MOV SCON, #50
RETI (reset double baud rate)ANL PCON, #EF

ORG 0023 SETB TR1


CALL serial_interrupt repeat forever JMP $
RETI
ORG 0050H
(Turn off data reception indicator)SETB P2.0

MOV SP, #08H


CLR TR1
serial_interrupt :
JNB RI, check_ti
CLR P2.0
MOV A, SBUF
CLR RI
MOV SBUF, A
RET
check_ti: SETB P2.0
CLR TI
RET

Вам также может понравиться