Question: LAB7 Using the 8051 Serial Port and Interrupts Overview The purpose of this lab is to control and program the serial port of the micro-controller
LAB7 Using the 8051 Serial Port and Interrupts Overview The purpose of this lab is to control and program the serial port of the micro-controller in a given sequence. Two switches SW1 and SW2 are connected to the micro-controller input port bits P1.1 and P1.2. The two switches define the required Baud rate requirements for the serial communication as follows: SW1 SW2 Baud (bps) 10 1200 2400 1 0 4800 1 9600 Steps First, write a subroutine "BCODE" (Baud Code) starting at code address 100H to detect the setting of SW1 and SW2 and return a value in accumulator B (0 for 1200, 1 for 2400, 2 for 4800, and 3 for 9600 Baud). It also setup the TH1 register for the requested BAUD rate. 2.Second, write a subroutine "CONFIG Timers, Interrupts, and Serial Configuration) starting at code address 160H to configure the serial port for Mode 1, timer 0 for mode 1, and timer 1 for mode 2. Also it enables the timer 0 interrupt and start timer 0 and timer 1. 3 Third, write a subroutine "SDISPLAY (Serial Display) starting at code starting address of 200H to display on the serial port the message "SERIAL BAUD IS XXXX BPS. "XXXX" s the actual Baud rate value selected. The subroutine will use polling on the TI flag
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
