Docsity

Serial Communication-Embedded System Control-Lecture Slides, Slides of Embedded Control Systems

Partial preview of the text

Download Serial Communication-Embedded System Control-Lecture Slides and more Slides Embedded Control Systems in PDF only on Docsity!

Serial Communication z

Bit by Bit transfer

Simplex

Transmitter

Receiver

Half Duplex

Transmitter

Receiver

Receiver

Transmitter

Full Duplex

Transmitter

Receiver

Receiver

Transmitter

docsity.com

RS232 Standard z

EIA made interfacing standard in 1960.

DB

DB

docsity.com

Baud Rate Setting BRGH = 0 (Low Speed)

(Asynchronous)

Baud Rate = F

osc

/(64(X+1))

(Synchronous)

Baud Rate = F

osc

/(4(X+1))

BRGH = 1 (High Speed)

(Asynchronous)

Baud Rate = F

osc

/(16(X+1))

(Synchronous)

N/A

BRGH = 0 (Low Speed)

(Asynchronous)

SPBRG (X)

=

F

osc

/(64 x baud rate)) -

(Synchronous)

SPBRG (X)

=

F

osc

/(4 x baud rate)) -

BRGH = 1 (High Speed)

(Asynchronous)

SPBRG (X)

=

F

osc

/(16 x baud rate)) -

docsity.com

Baud Rate Error Calculation Error = (Calculated baud rate โ€“ desired baud rate) / desired baud rate Error = (Calculated SPBRG โ€“ Integer Part) / Integer Part Compute the value to be written into the SPBRG register to generate 9600 baud for

asynchronous mode high-speed transmission, assuming that the frequency of thecrystal oscillator is 20 MHz.

Solution:

Apply the formula The value (for BRGH = 1) to be written into the SPBRG

register is

SPBRG = (20,000,000 / (16 x 9600)) - 1 = 130 - 1 = 129 The actual baud rate is 20,000,000 / (16 x 130) = 9615.4 The resultant error rate is (9615.4 - 9600) / 9600 x 100% = 0.16% The same baud rate can also be achieved by using a low-speed (BRGH = 0) approach in

which

SPBRG = (20,000,000 / (64 + 9600)) - 1 = 31 The actual baud rate is 20000000 / (64 x 32) = 9765.6 The resultant error rate is (9765.6 - 9600) + 9600 x 100% = 1.7%

docsity.com

Registers for SerialCommunication RXSTA RegisterTXREG RCREG

SPEN

RX

SREN

CREN

ADDEN

FERR

OERR

RX9D

D

D

D

D

D

D

D

D

R

R

R

R

R

R

R

R docsity.com

Transmit Block Diagram

docsity.com

Receive Block Diagram

docsity.com

SUMMARY

docsity.com