Professional Documents
Culture Documents
Uart - (Cuuduongthancong - Com)
Uart - (Cuuduongthancong - Com)
om
.c
ng
co
an
th
ng
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
Cấu
hình
truyền
thống
om
.c
ng
co
3
an
th
ng
Phần cứng
o
du
u
cu
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
om
.c
ng
co
5
an
th
ng
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
om
.c
ng
co
7
an
th
ng
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
Ví dụ
• Nếu FCY=8MHz, và tốc độ truyền là 9600
baud,
– UxBRG=(8•106/(16•9600))-1=51.083.
• UxBRG=51.
om
• Sai số truyền là UxBRG=51 is 9615.384, i.e.
the deviation is 0.16%
.c
ng
co
9
an
th
ng
Ví dụ (tiếp)
o
du
u
cu
10
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
UART - Transmission
om
.c
ng
co
11
an
th
ng
UART - Transmission
o
du
u
cu
12
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
om
tiên của bộ đệm
• UTXBF status bit thông báo bộ đệm đầy.
.c
ng
co
13
an
th
ng
• Chế độ UTXISEL= 1
cu
14
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
UART – nhận
om
.c
ng
co
15
an
th
ng
UART nhận
o
du
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
om
– Ngắt xảy ra khi bộ đệm đầy, 4 bytes
• URXISEL bits = 10
.c
– Ngắt xảy ra khi bộ đệm có 3 bytes
ng
• When URXISEL bits = 01 or 00
– Ngắt xảy ra khi bộ đệm có dữ liệu
co
17
an
th
ng
• Parity Error
du
• Framing Error
– When a STOP bit is expected on UxRX pin but a low
logic level is detected
– Indicated by FERR bit in the UxSTA register set
• Receive Overrun Error
– When the Receive Buffer is full and a 5th character
is received
– Indicated by OERR bit in the UxSTA register set
18
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
om
register must be set to 00 or 01
– On receiving the Address word, the user inspects
.c
the lower byte to verify an address match
– If an address match occurred, the user should
clear the ADDEN bit, after which the module will
ng
wait for Data words (9-bit words with MSB clear)
co
19
an
th
ng
• Alternate I/O
– Sử dụng cặp đôi chân TX/RX khác
u
cu
10
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
Ví dụ
om
.c
ng
co
21
an
th
ng
Circular Buffer
o
du
u
cu
22
11
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
om
.c
ng
co
23
an
th
ng
Xử lý lỗi
o
du
24
12
CuuDuongThanCong.com https://fb.com/tailieudientucntt
10/12/2012
Ví dụ
om
.c
ng
co
25
an
th
o ng
du
u
cu
13
CuuDuongThanCong.com https://fb.com/tailieudientucntt