100%(1)100% нашли этот документ полезным (1 голос)
19 просмотров9 страниц
The document describes requirements for designing an 8051 microcontroller-based system for serial data communication with a PC. It specifies using an AT89s8252 microcontroller running at 12MHz with on-chip program memory. The system will communicate with a PC at 9600 baud using 1 start bit, 8 data bits and 1 stop bit. It will echo any received data bytes back to the PC and indicate reception by flashing an LED. An MAX232 chip will convert between TTL and RS-232 levels. The microcontroller program will implement a serial polling interrupt routine to handle transmission and reception with the PC using a serial terminal program.
The document describes requirements for designing an 8051 microcontroller-based system for serial data communication with a PC. It specifies using an AT89s8252 microcontroller running at 12MHz with on-chip program memory. The system will communicate with a PC at 9600 baud using 1 start bit, 8 data bits and 1 stop bit. It will echo any received data bytes back to the PC and indicate reception by flashing an LED. An MAX232 chip will convert between TTL and RS-232 levels. The microcontroller program will implement a serial polling interrupt routine to handle transmission and reception with the PC using a serial terminal program.
The document describes requirements for designing an 8051 microcontroller-based system for serial data communication with a PC. It specifies using an AT89s8252 microcontroller running at 12MHz with on-chip program memory. The system will communicate with a PC at 9600 baud using 1 start bit, 8 data bits and 1 stop bit. It will echo any received data bytes back to the PC and indicate reception by flashing an LED. An MAX232 chip will convert between TTL and RS-232 levels. The microcontroller program will implement a serial polling interrupt routine to handle transmission and reception with the PC using a serial terminal program.
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