Serial Communication: 8051 Microcontroller
Serial Communication: 8051 Microcontroller
Serial Communication
Virendra Singh
Associate Professor
Computer Architecture and Dependable Systems Lab
Department of Electrical Engineering
Indian Institute of Technology Bombay
http://www.ee.iitb.ac.in/~viren/
E-mail: [email protected]
EE-309: Microprocessors
Lecture
16
(21
Aug
2014)
CADSL
TI
RI
SM0 SCON.7
SM1 SCON.6
SM2 SCON.5
REN
SCON.4
TB8
SCON.3
RB8
SCON.2
TI
SCON.1
RI
SCON.0
EE-309@IITB
CADSL
19 Aug 2014
EE-309@IITB
CADSL
EE-309@IITB
CADSL
8051
To PC
COM
port
TxD
RxD
ORG
MOV
MOV
MOV
MOV
SETB
MOV
20 Aug 2014
0
P2,#0FFH
TMOD,#20H
TH1,#0FAH
SCON,#50H
TR1
DPTR,#MYDATA
EE-309@IITB
P1
LED
P2
SW
CADSL
(a)
(c)
(b)
B1:
EE-309@IITB
CADSL
EE-309@IITB
CADSL
20 Aug 2014
EE-309@IITB
CADSL
PCON Register
SMOD
Double
baud
rate.
If
Timer
1
is
used
to
generate
baud
and
SMOD=1,
the
baud
rate
is
doubled
when
the
Serial
Port
is
used
in
modes
1,2,3
GF1,GF0
General
purpose
ag
bit.
PD
Power
down
bit.
Secng
this
bit
acCvates
Power
Down
operaCon
in
the
80C51BH.
(precedence)
IDL
Idle
Mode
bit.
Secng
this
bit
acCvates
Idle
Mode
operaCon
in
the
80C51BH.
(MSB)
SMOD
(LSB)
--
--
--
GF1 GF2
PD
IDL
EE-309@IITB
CADSL
20 Aug 2014
EE-309@IITB
10
CADSL
(Hex)
SMOD = 0
SMOD = 1
-3
FD
9,600
19,200
-6
FA
4,800
9,600
-12
F4
2,400
4,800
-24
E8
1,200
2,400
XTAL
oscillator
Machine
cycle freq.
12
921.6 kHz
SMOD = 1
16
32
57600 Hz
28800 Hz
To timer
1 to set
baud
rate
SMOD = 0
20 Aug 2014
EE-309@IITB
11
CADSL
Default
on
reset
20 Aug 2014
EE-309@IITB
12
CADSL
20 Aug 2014
EE-309@IITB
13
CADSL
Example
MOV
SETB
MOV
MOV
MOV
MOV
SETB
MOV
A1: CLR
MOV
H1: JNB
SJMP
A,PCON
ACC.7
PCON,A
TMOD,#20H
TH1,#-3
SCON,#50H
TR1
A,#B
TI
SBUF,A
TI H1
A1
20 Aug 2014
14
CADSL
Thank You
20 Aug 2014
EE-309@IITB
15
CADSL