Exp 08:- Aim: To develop the
skills to interface 8051 microcontroller (AT89C51) to a computer via serial
port, RS232.
Algorithm:
- Initialize TMOD register with respective timer and its mode.
- Load the value in the timer register corresponding to the baud rate.
- Load SCON with 50H value indicating mode 1, 1 stop and start bit.
- Set the timer run bit.
- Load the character 'A' in SBUF.
- Start transmitting the data by setting the timer run bit.
- Check TI to determine whether the transmission process if completed.\]
- Repeat the process continuously.
Flowchart:
Program:
#include <reg51.h> void main (void) { TMOD =0X20; TH1=0XFD; SCON=0X50; TR1=1; while (1) { serial = ‘E’; serial = ‘S’; serial = ‘Y’; while (TI= = 0); TI=0; } } |
/*Special
function register declarations*/ /*
for the intended 8051 derivative */ //Use Timer 1 , 8 bit auto reload //9600 baud rate //place a value in
buffer |
Conclusion: Hence
we conclude that we developed and tested ‘C’ program to perform data transmission.