-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserial.c
More file actions
45 lines (34 loc) · 1.12 KB
/
serial.c
File metadata and controls
45 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
1. WAP to transmit the character ‘S’ to the serial window use 9600 as the baud rate?
28800 is the maximum baud rate of the 8051 microcontroller
28800/9600= 3
That baud rate ‘3’ is stored in the timers
#include<reg51.h>
void main()
{
SCON=0x50; //start the serial communication//
TNOD=0x20; //selected the timer mode//
TH1=3; // load the baud rate//
TR1=1; //Timer ON//
SBUF=’S’; //store the character in the register//
while(TI==0); //check the interrupt register//
TI=0;
TR1=0; //OFF the timer//
while(1); //continuous loop//
}
2. WAP to receive the data from the hyperterminal and send that data to the PORT 0 of the Microcontroller using 9600 baud?
28800 is the maximum baud rate of the 8051 microcontroller
28800/9600= 3
That baud rate ‘3’ is stored in the timers
#include<reg51.h>
void main()
{
SCON=0x50; //start the serial communication//
TMOD=0x20; //selected the timer mode//
TH1=3; // load the baud rate//
TR1=1; //Timer ON//
PORT0=SBUF; //send the data from SBUF to port0//
while(RI==0); //check the interrupt register//
RI=0;
TR1=0; //OFF the timer//
while(1); //stop the program when character is received//
}