Serial Communication with the 8031 - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Serial Communication with the 8031

Description:

Baud (bps) sets the transfer rate. There are many other standards. How does it work? ... Timer1 Used for setting the baud. rate. Note that you must divide the ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 12
Provided by: lance94
Category:

less

Transcript and Presenter's Notes

Title: Serial Communication with the 8031


1
Serial Communication with the 8031
ECET3220
2
Why Serial?
  • 1 wire versus 8
  • communicate over long distances
  • no need to modulate/demodulate
  • The 8031 has a built in UART!
  • The 8031 has full duplex capability
  • There are standard protocols such
  • as RS232 (by the EIA in 1960!)
  • Note RS232C is not TTL compatible! (a binary
    1 -3 to 25 V and 0 3 to 25 V) MAX232 ICs are
    available.

3
How does it work?
  • Framing the byte
  • Overhead due to stop/start parity
  • Baud (bps) sets the transfer rate
  • There are many other standards

4
8031 Serial Pins
  • RI (or RxD) is P3.0 (pin 10)
  • TI (TxD) is P3.1 (pin 11)

5


6
8031 Serial Registers
  • SBUF Used for transmission and
  • reception of serial bytes
  • SCON Used for initializing the
  • the serial setup and INTs
  • Timer1 Used for setting the baud
  • rate. Note that you must divide the
  • machine cycle frequency by 32 and
  • use mode 2 (I.e 8 bit auto-reload)
  • msb of PCON (not bit-addressable)

7
Simple Program Snippet
MOV TMOD, 32 set T1 to mode 2 MOV TH1,
baud baud rate setup MOV SCON, 80 Mode 1,
REN 1 SETB TR1 start timer Repeat MOV SBUF
, A send 41h to the PC Wait JBC TI,
Repeat do again if done SJMP Wait wait
till last bit Tx
8
More Modular approach
LCALL SendString db I am smarter than PCs said
the 8031, 0 SendString
9
Now Receive some data
MOV TMOD, 32 set T1 to mode 2 MOV TH1,
baud baud rate setup MOV SCON, 80 Mode 1,
REN 1 SETB TR1 start timer Wait JNB RI,
Wait wait till data sent MOV R5, SBUF grab
the data CLR RI get ready to
repeat SJMP Wait
10
(No Transcript)
11
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com