Tải bản đầy đủ (.pdf) (76 trang)

Nghiên cứu thiết kế và tích hợp các chip chuyên dụng vào hệ thống đo lường và thu thập dữ liệu

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (49.08 MB, 76 trang )

DAI
HOC QUOC GIA
HA
NO
I
TRUfiMG
DAI HOC CONG NGHE
BAG
GAG TGNG KET
De
tai:
NGHI€N CIJU THifT KC'Vfl
TICK HOP
CflC
CHIP
CHUVCN
DUNG
VRO H€
THONG
DO
LUdNG V^
THU
TH^P DU U€U
MA
SO:
QG
05.08
Chu
tri:
PGS. TS Ngo Dien Tap
Tham gia


thuc
hien:
Th
S
Nguyin
Kiem
Hiing
CN
Nguy6n
Van Hieu
CN Phan Thu Ngan
"
Ha
Noi
2006
MUG LUC
Trang
Muc
luc
2
Dat
van
de 3
Chuong
1. Mot so hieu biet ca ban ve ky thuat lap
trinh
4
tren chip
Chuang 2.
Phdn

thuc nghiem va cac ket qua 9
2.1
Tich hop kha nang thong bao ket qua bang gigng noi 9
cho he thong do
ludng
2.2 Tich hop chip chuyen dung vao cac he thong do 16
nhieu man hien thi
2.3 Thiet ke va tich hop cac chip
FPGA
vao he thong 28
thu nhan anh ve tinh khi tugng
2.4 Nghien cuu thiet ke va tich hgp chip Xilinx CPLD 46
vao he thong thu nhan anh ve tinh khi tugng
Ketluan
51
Danh sach cac cong
trinh
da cong bo 53
Danh sach cac san pham dao tao 54
Tai lieu tham khao 55
DAT VAN DE
Trong
nhOng
nam gin day, cac thiet bi do
lucmg
va thu thap du lieu da vugt
qua
gidd
ban cac
hinh thiic

chi thi hoac hien thi thong thucmg va tra nen phong
phu
w6
chung
loai,
da dang ve
each
the hien ket qua nhu: dgc ket qua bang gigng
noi,
dgc ket qua
tif
xa, Tr6n dudng pho Ha Noi eo the nghe thay tieng dgc ket
qua can do th6ng s6 lien quan den
siie
khoe con
ngucfi
bang tieng Viet
tir
mot
san pham do Trung Quoc san
xua't.
Nhung
lai
eo mot dae diem dang chu y la eau
tao ben trong cua cac san pham loai nay lai khong
phiic
tap them nhieu
nh5 sii
dung cac
linh

kien s6 lap trinh duge (PLD; Programmmable Logic Device).
Huomg
nghien euru nay phat trien
6
mot so nu6c, nhung do dae tinh lap trinh
duge nen cho phep nhung
nu6c
nho eung eo the tiep can cong nghe vi
mach
hien
dai de lam ra
nhung
san pham mang dae thii eiia dat
nu6e
minh,
tieng noi
eiia
dan
t6e
minh,
Trong xu
hudmg
phat trien hien nay khong the
ehd nuac
khdc lam ra nhung
san pham the hien
tiSng
Viet tren man
hinh tuong
tac (nhu tren cac phuang tien

nghe
nhin a
nu6e ta hien nay) hoac dgc ket qua bang tieng Viet ma ta phai tu
lam duge
nhiJng
san phan loai nhu vay. De tai nay duge xay dung nham tiep can
mot yeu
edu
dang dat ra doi
vofi
cac san pham dien tu Viet nam.
Them vao do, cong nghe vi mach truyen thong chi c6 the thuc hien
a
cac
nu6e 16n
va giau vi kinh phi dau tu rat ton kem, nhung cac nu6e nho tham chi
ngheo van eo the tiep can cong nghe lap trinh cho vi mach (mot cong nghe
khong
gay
6
nhi6m
moi
trucmg
nhu cong nghe truyen thong !) de lam ra nhung
loat
nho san pham thich hgp
vod
yeu eau dat ra trong
timg
nude.

Thiet ke va tao ra mot so chip FPGA/CPLD chuyen dung (bang phan mem)
CO
kha nang tich hop duge vao cac he thong do lucmg va thu thap du lieu lam
tang them gia tri su dung va
linh
vue
limg
dung cua he thong. Mot thi du eo
ihi
dt
dang nhan thay la cac mach dong bg va
tach
tin hieu tu cac ve tinh khi tugng;
neu lam
tir
cac linh kien
r5i
rac,
ke ca cac vi mach, se rat phuc tap va ton kem
thdi
gian, nhung neu lam duge
tir
cac chip lap trinh thi mach dien se rat ggn nhe,
boat dgng tin cay va thdi gian
che
tao (nhan ban) se
riit
ggn di rat nhieu.
Nhimg
noi dung chinh se

duge
trinh bay trong bao cao nay bao
g6m:
- Mot so hieu biet ca ban ve ky thuat lap trinh tren chip.
- Phan thuc nghiem va mot so ket qua thuc hien da dang ky truac.
- Tom tat ket qua va mot so lai ban
luan.
Chu-orng
I
MOT
SO HIEU BIET
CO
BAN
VE KY THUAT
LAP TRINH TREN CHIP
1.1
MO
DAU
r
> y y
A
Nhu da noi den a phan dat van de, trong nhung nam gan day, kha nang tich
hgp tren cac chip lap trinh duge c6 xu huang tang
len
khong
ngimg,
tu vai chuc
cong logic den vai tram va cho den nay da tang len den mot trieu cong, tham chi
con cao ban
nira.

Vi vay cac chip kha lap trinh duge c6 xu huang dap ung
duge
nhung
ung dung kha phuc tap, nhu:
-
XOr ly
tin hieu so nang cao.
- Xu iy anh,
- Cac ung dung da phuang tien
[2],
[3],
[4]^
y^
[5]^
Thuc te cho thay, cho du cac chuang trinh nap vao chip eo phuc tap den dau
thi do eau true theo kieu modun van c6 the duge xem nhu duge xay dung tu
nhiing
phan nho,
nhiing
bg phan nho ket noi lai. Vi vay,
viee
xay dung nhung
modun so (digital) ca ban de tu do hinh thanh mot thu vien se tang tinh da dung
cua vi mach lap trinh duge, dong thai nit ngan duge thai gian tinh tu khi hinh
thanh thiet ke den cac ung dung cu the.
Trong khuon kho de tai
''Nghien ciru
thiet ke
vd
tich hop cac chip chuyen

dung vao he thong do
Itr&ng
vd thu thap
dCt
lieu''
cac chip lap trinh
duge
bao
gom hai loai:
* Cac vi dieu
khien,
cu the la vi dieu khien AVR, da duge nha san xuat che
tao san thanh cac vi
dieu
khien, chi can lap trinh cho thich hgp vai cac ung
dung cu the.
4
* Cac chip CPLD, kha nang lap trinh lam cho ung dung cua chip linh boat
ban.
Viec lap trinh cho cac vi dieu khien da duge trinh bay trong nhieu cuon sach
duge
xuat ban trong nuac, chang ban
[3],
Trong khi, ngon ngu dae ta de lap
trinh cho cac CPLD van con rat it tai lieu (trong nuac) de cap den. Vi vay, sau
day xin trinh bay ngan ggn ve cac vi mach lap trinh duge, ciing nhu ngon
ngO
de
lap trinh cho cac chip nay.
1.2 NGON

NG0M6 TA
PHAN
CUNG
HDL
L2.1
Mot so khai niem
• •
VHDL la mot thuat ngii duge viet tat cua Very High Speed (Integrated
Curcuits) Hardware Description Language (Ngon ngu mo ta phan cung mach
tich hgp toe do cao). Loai ngon
ngix
dae biet nay da duge phat trien tu
giiia
r
nhijng
nam 80 a Hoa ky. Bg Quoc phong va Vien IEEE (Institute of Electrical
and Electronics Engineers) da bao trg cho
sir
phat trien cua ngon
ngiJ
mo ta phan
cung vai muc tieu phat trien mach tich hgp toe do cao. Ngay nay VHDL da tra
thanh ngon
ngir
tieu chuan cong nghiep duge su dung de mo ta cac he thong so.
^
Mot loai ngon ngu mo ta phan cung khac cung duge dung rgng rai do la
Verilog. Ca hai deu la nhung ngon ngu manh, cho phep nguai thiet ke mo ta va
mo phong nhung he thong so tu dan gian den phuc tap. Mot ngon ngu HDL
(Hardware Description Language) thu ba la ABEL (Advanced Boolean Equation

Language), duge thiet ke danh rieng cho cac thiet
bj
logic kha trinh (PLD-
Programmable Logic Device). ABEL khong manh bang hai ngon ngu tren va it
duge ua chuong trong cong nghiep
VHDL
CO
nhumg dae diem giong cac ngon
ngir
lap trinh quen thugc khac
ve mat cu phap, eau true
lenh,
nhung lai eo nhung diem khac biet quan trong
ve mat thuc thi lenh. Ngon ngu mo ta phan cung noi chung va VHDL noi rieng
boat dgng theo dang song song, tuc la cac eau lenh tac dgng den cac cong
logic
duge
thuc thi mot each song song ngay khi c6 tin hieu
loi
vao tac dgng.
Cac chuang trinh mo ta phan cung noi chung giong nhu viec bat ehuae thuoc
tinh
eiia
mot quy
luat eiia
he thong vat ly, thong thuong la cac he thong so.
1.2.2 Mot so cong nghe phan
cirng
1.2.2.1
Cong nghe ASIC (Application Specific Integrated Circuit)

Cong nghe mach tich hgp chuyen dung, day la cong nghe thiet ke mach
bang mot chip chuyen dung duge dinh huang truac theo mot hoac mot so chuc
p p
r
/
r
nang nao do vai
each
ket noi c6 dinh hoac c6
sir
ket hgp mot so linh kien va
f f
w
t
chip vai cac duang ket noi c6 dinh. Do dae diem nay, cac ASIC khong c6 ban
tren thi truang duai dang vi mach don
le
nhu cac vi mach thong thuong, cung
khong
CO
ban thong so ky thuat (datasheet), ma duge lap rap trong nhung thiet bi
cu the cua mot nha san xuat nao day.
1.2.2.2
Cong nghe PLD (Programmable Logic Devices)
* Mot so loai linh kien logic lap trinh
dirac
- Simple Programmable Logic Devices (SPED): la mot con chip nho vai cac
cong noi tiep (day) hoac mot nhom cac cong duge noi vai nhau de dam
nhan mot chuc nang don gian.
- Complex Programmable Logic Devices (CPLD): eo eau true phuc tap ban

SPED,
no
CO
the chua mot vai khoi, moi khoi duge hieu nhu mot SPED.
- Field Programmable Gate Array (FPGA): c6 eau true va boat dgng phuc tap
ban CPLD, dong thai c6 kha nang thuc hien nhung chuc nang phuc tap.
* Cdc
phirang
tien
chu
yeu
diing
cho linh kien logic lap
trinh dirac
• Can
CO
PROM (Programmable Read Only Memory) trong PLD bai no
chua chuang trinh cho PLD. Chuang trinh
duge luu
lai ngay ca khi mat
nguon nuoi.
• Phan mem lap trinh cho PLD.
• Cac tai lieu huang dan phuc vu cho nguai phat trien.

Kha nang lap lai eau hinh cho linh kien.
The he PLD mai,
dugz
cong ty Xilinx phat trien c6 ket hgp he thong tren
r t
chip

dugz
xem nhu la the he FPGA. No duge ket hgp nhung mach dae biet cung
vai rat nhieu cong de tao nen nhung thiet bi truyen thong c6 chuc nang dae biet.
* Cong nghe CPLD
/ f '
ft
CPLD cung cap cho cac nha thiet ke mach logic c6 dung
lugng
rat
Ian
de
thiet ke
nhimg
mach phuc tap chi tren mot chip. CPLD c6 the coi la mot tap hgp
cua cac SPED.
Mot SPED la mot nhom cac cong
duge
noi lien vai nhau ma chung c6 the
lap trinh
duge
de thuc hien mot chuc nang nao do. Duge phat trien bat dau tu
\
r
"iff
nhung nam 1970, SPED la mot phan bet sue ca ban de thiet ke CPLD, PAL
(Programmable Array Logic), PEA (Programmable Logic Array). Noi khac di,
CPLD chua cac khoi SPED, trong do moi SPED duge coi la mot khoi logic bao
^
•>
gom PAL hoac PEA. Cong nghe CPLD duge phat trien cho cac ung dung nhu :

- Cac thiet ke dan gian.
- Cac thiet bi c6 gia thanh thap, chuc nang don gian.
- Giam
kich
thuac mach.
* Cong nghe FPGA
f
r \
•> >
Mot chip FPGA duge thiet ke bao gom hang ngan cong logic hoac nhieu
ban vai cac ket noi c6 kha nang lap trinh, thuong ap dung cho cac chuang trinh
phat trien phan cung vi c6 uu diem la boat dgng nhanh va dien ap thap. Cau tao
cua mot chip FPGA bao gom cac bg dem I/O, cac khoi logic eau hinh, thuong
If
f
r
f
duge
viet tat la CLB (Configurable Logic Blocks) va cac eau true ket noi c6 kha
r
f
\
nang lap trinh. Lap trinh cho cac ket noi duge thuc hien bang cac 6 RAM ma
\ r
f f t
dau ra
cuoi
cung cua no
duge
ket noi vai cac cong MOS ngang qua cac tranzito.

\
f
Mot CLB don bao gom bon tin hieu vao, mot tin hieu xung clock, cac bg
da hgp
lap
trinh duge, mot flip flop SR, bang tra
(LUT-Look
Up Table). Bang
__ f -> f f
LUT la bg nha so dung de cat giii bang chan ly cua ham so Boole. Mot CLB c6
rat nhieu ham logic khac nhau dung de sap dat chuang trinh.
*
f
r r \
\
Luu do thiet ke cho mot chip FPGA bat dau bang viec mo ta ham trang
f 1
thai,
thuong dung ngon ngu VHDL. Cau true sau do duge tong hgp tu cac luge
do mach hoac cac 6 logic. Ke
tiep
la
viec
sap dat va ehgn duang de dinh vi cac
CLB cho phu hgp vai mang netlist. Sau do la qua trinh mo phong va tham tra
truac khi nap chuang trinh vao chip,
t
r
r
r

, ,
LTU
diem
Ion
nhat
eiia
thiet ke FPGA la thai gian thuc hien rat ngan. Cac
cau true logic tren chip c6 the
duge
nguai su dung lap trinh
true
tiep ma khong
can mot cong cu che tao mach tich hgp nao. Vi khong c6 buae vat ly nen mot
ham don gian trong mot chip FPGA thong thuong c6 the thu duge ngay khi ve
f
Mapping. Viec san xuat chip theo ky thuat FPGA thuong c6 chi phi cao ban so
f
vai cac ky thuat khac, no thuong duge ap dung cho viec san xuat chip ASIC
(Application Specific Integrated Circuit) lam viec vai dien ap thap va cho cac
linh kien can toe do nhanh.
So sanh
giiia
cac cong nghe PLD thi FPGA la mot cong nghe mai
duge
phat trien c6 tiem nang rat
Ion.
1.2.3 So sanh cong nghe ASIC va PLD
Cong nghe PLD va cong nghe ASIC khac nhau a mot so diem sau:
>
f

W
f
- ASIC can mot thai gian dai cho viec thiet ke va che tao, trong khi do PLD
^ ^ f
tao ra chi nha vao viec nap mot phan mem nen rat nhanh ch6ng.
f f f
- ASIC thuong duge thiet ke toi uu cho mot chuc nang dae biet nen thuong
CO
toe do cao ban. Nhung vai cong nghe cao ngay cang phat trien thi PLD
van
CO
kha nang
vira
cho do linh dgng cao vua c6 toe do nhanh va gia
thanh re.
r
f f
- Vai so lugng
Ion
(tren 5000 chip) ASIC to ra kinh te hon, trong khi vai so
lugng nho, tham chi rat nho thi PLD lai the hien uu diem vugt trgi.
- ASIC
CO
gia thanh thuong dat gap nhieu
Ian
so vai cong nghe PLD.
- Tinh linh dgng, da dang trong chuc nang thi PLD hon ban ASIC.
8
Chu-oTig
2

PHAN
THV'C
NGHIEM VA
CAC
KET QUA
2.1 TICH
HQP
KHA NANG THONG
BAO
KET QUA
BANG
GIQNG
NOI CHO HE THONG DO
Ll/OfNG
2.1.1 Dat van de
Cham ngon eo eau "Tram nghe khong bang mot thay", nhung khi giao tiep
v6i
cac thiet bi dien
tir
thi trong nhieu trucmg hgp am thanh lai lam cho nguai
dung cam thay tien
Igi
ban
nhi6u.
Co the ke ra a day mot vai thi du: Tieng
loa
bao so tang khi di thang may, tieng
"bip"
bao chap mach khi do dien tra, tieng
"coi chit" bao nhiet do qua cao, tieng "coi bao dgng" khi ap suat qua cao, v. v

deu lam giam nhe su cang thang cho
ngudi
dung so v6i khi phai theo doi bang
mat. Tren dudng pho Ha Noi eo the nghe thay tieng dgc ket qua can do thong so
lien quan den
siie
khoe eon
ngu5i
bang tieng Viet
tir
mot san pham do Trung
Quoc san
xua't.
Moi day nhat la nhung dien thoai phat ra so ggi bang tieng Viet
m6i
khi
ngucri
dung nhan phim. Am thanh phat ra trong cac thi du neu tren
d6u
do mot vi
di6u
khien
ehi
dao.
Vi
vay trong chuong nay ta se xem xet eo the giao
tiep nhu the nao
v6i
mot vi
di6u

khien de kich boat cac chip phat ra
am
thanh.
Hien tugng nay duge ung dung trong cac thiet bi eanh bao,
chong
trgm, xu ly va
nhan dang tieng noi, dae biet la trong cac he thong do
ludng
va dieu khien.
Theo huong nghien cuu nay chung toi da dat duge mot so ket qua, chang
f
r
han tich hgp am thanh trong thiet bi quan ly hang cho, trong thiet bi bao dgng
hoac eanh bao. Trong phan nay se trinh bay cac ket qua thuc nghiem trong viec
r
f
I
r
-<
ma rgng thiet ke he do de tich hgp them mot bg phat am so de cho phep thong
bao cac ket qua do bang gigng noi tieng Viet. Sau mot khoang
thdi
gian dat
\
r
ft
y
trude hoac khi c6 mot phim yeu cau dgc ket qua
duge
bam, cac ket qua do ve do

1
/
^ f
am, nhiet do (hoac ca ap suatO se duge thong bao bang gigng
ndi
tieng Viet. He
I
^ ^
f
t
thong tren mang tinh minh boa ve mat phuang phap, ve nguyen tac viec doc ket
•\
t
f
qua do ludng bang gigng noi c6 the duge ap dung cho cac he thong do cac thong
so khac nhu: do huyet ap, do dien ap, cac long ap tre so sinh v. v
2.1.2 Xay
dyng
he thong
2.1.2.1 Modun
thu
phat am so
•»
f
De phat am so c6 hai phuang phap:
• Viet phan mem tren chip (chang ban bang ngon
ngir
VHDL) de tao ra cac
tieng noi tong hgp.
•}

f

Dung cac chip chuyen dung de thu phat am thanh, ggi tat la cac modun
RPM.
Thoat dau, chung toi di theo hudng thu nhat va da ed ket qua cong bd tai
Hoi Nghi Khoa hgc cua Khoa Cong Nghe (va dang tren tap chi cua Dai hgc
f
f
>
-y
y
Quoc Gia) vi nhan thay ngoai phan am thanh con ed the tich hgp cac phan khac
eiia
he thong do ludng tren cung mot chip. Ve sau, chung toi chuyen sang each
thu hai vi thay de dap ung tinh da dang cua ung dung hon.
f
y
Theo giai phap thu hai thi trong he thdng nay, phan quan trgng la mot
modun RPM duge su dung de thu/phat am thanh. RPM cung cap mot giai phap
I
f
thu/phat am thanh chat lugng cao cho cac ung dung nhan tin khoang thdi gian
f
y f
ngan. So do khoi cua RPM
duge
mieu ta trong hinh
1.
\
y

f
Modun RPM bao gom mot bg dao dgng, mot bg tien khuech dai micro-
•> t
f f y
1
phdn, mach dieu khien khuech dai tu dgng, bg
Igc
chdng chdng pho, bg
Igc
lam
f f f
t t
tron, va bg khuech dai loa. Mot he thdng con thu/phat am tdi thieu c6 the duge
cau hinh vdi mot micro-phdn, mot loa, mot vai linh kien thu dgng, hai nut bam
va mot ngudn nudi. Viec ghi am duge luu vao trong cac d nhd khdng bay hoi,
f
f f r
cung cap su luu
trir
tin nhan cdng suat zero. Giai phap duy nhat nay duge thuc
hien nhd cdng nghe luu tru da muc MLS. Tieng ndi va cac tin hieu am thanh
duge luu tru true tiep vao trong bg nhd dudi dang tu nhien
ciia
no, cung cap su
f
tai tao am thanh trang thai
Idng
chat lugng cao.
10
trurwcocii

Tifnrg
XCL<(
ANIIN
SanpungC


»n9

Jtt^ti^m-
^sfl-B^cve^
jifc^LtXT
ti-
me
<»~
MICR£f
>
A&;
Autontanc
S«lP
Control
1 ^it
lr «(
Atc^ac*
f-Poi«
i:t
/*
Srroolnirtg
F
itw
>LTO

o
5P
^W4r
Ccnctt«3nlng
/
_
v.

i 1
A3
Al
A:
AS


M
AT
C-«t«C;:nl':l
PE;
P_*
E
P_A»-
«C^EC
Hinh
7:
Sa do
khoi cua modun RPM.
f
RPM cung
cap mot

loat
cac
mddun thu/phat
am
thanh
vdi
thdi gian
f
thu/phat khoang
tu 20
giay den
vai
phiit.
Vdi cac
ung dung khong phuc
tap,
chung tdi
lira
ehgn mddun RPM ed khoang thu phat 20 giay. Cac thdng sd dang
f f
t
quan tam cua mddun RPM
la
kha nang nhd
tin
nhan den 100 nam
va sd
chu
trinh
ghi/xoa

la
100.000.
Cac dae tinh ky thuat chinh ed the ke ra nhu sau:
• Ngudn nudi don dau, +5 von,
• Khoang thdi gian ghi: 20 giay,
• Giai phap thu phat don chip de su dung,
• Su tao lai am thanh tu nhien vdi chat lugng cao,
f
y f
>
• Kha nang ndi tang true tiep khi can khoang ghi dai hon,
t f
• Che do tiet kiem nang lugng tu dgng,
f
f y
• Su luu tin nhan cdng suat bang khong,
• Cd kha nang dinh dia ehi cho tat ca cac tin nhan,
• Kha nang nhd tin nhan den
100
nam,
• Chiu duge
100.000
chu trinh ghi,
• Bg dao dgng on-chip,
• Nhiet do lam viec:
O'^C
tdi
TO'^C
ddi vdi cac san pham thuong mai,
-40°C

tdi
85°C
ddi vdi cac san pham cdng nghiep.
11
y
r
f
Hinh 2 chi ra mot so do khoi cho mot ung dung rat eo ban
eiia
RPM. Mach
nay cd ba
niit
nhan: mot cho ghi, mot cho phat lai theo sudn va mot cho phat lai
theo muc. Nut ghi am thuc hien chinh xac nhiem vu nhu ten ggi
eiia
nd: nhan
f
If
nut nay cho phep ghi lai am thanh; nha nut nay
dimg
ghi am. Neu gap diem ket
thuc bg nhd (EOM) cua chip trude khi nut duge nha, chip se tu dgng ket thuc
viec ghi va chuyen sang che do giam nang lugng.
Ciang
cd mot LED dd dung de
chi thj viec ghi am. LED nay duge bat sang khi ghi am. Am thanh ed the duge
ghi theo 2
each:
bang each su dung mot micrd-phdn nhu duge chi ra trong mach
^

»
ft
vi du phan tren, hoac bang each su dung mot tin hieu true tiep tu mot he thdng
II
f r
CD-stereo ket ndi true tiep tdi chan
Idi
vao tuong tu cua RPM.
Cd hai loai nut phat loai: kich boat theo sudn
(PLAYE)
va kich boat theo
f f
y
muc
(PEAYE).
Thiet bi bat dau mot chu trinh phat lai am khi phat hien mot
sudn chuyen muc tu muc HIGH tdi muc LOW tren chan
PL A
YE.
Viec dua
f f
chan PEAYE len muc HIGH trong sudt thdi gian phat lai am thanh se khdng ket
f f f
thuc chu trinh phat lai hien thdi. Su phat lai tiep tuc cho den khi mot dau hieu
EOM duge phat hien. Ngay sau khi hoan thanh chu ky phat lai, thiet bj tu dgng
1 f
giam nang lugng va chuyen sang che do Standby. Chuc nang phat duge kich
boat theo muc khdi tao mot chu trinh phat lai am thanh khi tin hieu
Idi
vao tren

f f f
chan nay duge giu d muc thap va su phat lai duge tiep tuc cho den khi chan
If
f
PEAYE duge keo len muc cao hoac gap dau hieu EOM (ket thuc bg nhd). Thiet
t
I
bi tu dgng chuyen sang che do giam nang lugng ngay khi chu trinh phat lai hoan
thanh.
S
f f
n
Dau ra loa
eiia
RPM duge thiet ke de su dung mot loa
16Q.
\
f f
Bang each su dung cac
Idi
vao dia ehi (A0-A7), hoac cac che do boat dgng
(bang each
sir
dung cung cac chan nhung vdi cac byte trang thai khac - chan 9
va
10
duge dat len muc cao), nhieu doan am eo the duge ghi va phat lai. Phan
sau se minh boa each su dung RPM de ghi am va phat lai nhieu doan am thanh.
2.1.2.2
He thong do

f f .
"*
' '
y
Thiet ke nay la su md rgng va phat trien he thong do nhiet do va do am. So do
khdi he do duge mieu ta trong hinh 2. So do cd the tich hgp ca hai cam bien
12
nhiet do (LM35) va do 4m
(HM1500
hoac
HM1520) bing
mot cam bien chung
la HM2500 cua cong ty Humerel.
MPXA6115A
LND5
HM152Cf-
Realtime
Keypad1
Enter |
:
ADCO
PORTC
O
ADCl
ADC2
A'nVIega8535
EEPROM 24C256
LCD
NliietDo:23.5*C
Do

Ain:
^5« o TROI
NANG
<ADD-CTOL RPM
I
KevpadZ
?LAYL \ZD
PLA\T \ZD
RECD
CD
Microphouj—
Speakei
Hinh
2:
He
thong do nhiet
do,
do am moi
tmong.
Trong ung dung nay, chuc nang do nhiet do duge thuc hien bdi cam bien
f f f f
HM2500, trong dd chan ra cua cam bien nhiet do duge ket ndi tdi chan
Idi
vao
ADCl
cua vi dieu khien va chuc nang do do am
duge
thuc hien bdi
Idi
ra cam

f t f f
bien do am ket ndi tdi chan ADC2 nhu duge chi tren hinh 2.
W fit
Cam bien nhiet do va do am: Cam bien do am duge su dung d day la HM2500.
i,
jtifMHtAil ^
Hinh
3:
Cam bien do am tuong doi HM2500.
13
Cac
dae
tinh chinh:
• Kich thudc nhd,
• Khdng bi anh hudng khi bi
nude
te vao,
»
^
y
f
• Cd the thay ddi ma khdng can tien hanh hieu chinh them,
• Do tm cay cao va cd do on dinh trong thdi gian dai,
• Cd the do do 4m tu 0
d§n
100%
RH,
• Do am duge dinh chuan vdi do chinh xac ±2% RH d 55% RH,
• Do nhiet do bang nhiet trd NTC
10 kQ

vdi
Idi
ra true tiep.
• Ngudn nudi cd the thay ddi trong dai rgng tu 3 den 10 V.
• Cam bien do am cd do ben cao vdi cac chat, thdi gian dap ung nhanh.
f f f f r
Gidng nhu vdi bat ky mach tuyen tinh nao khi duge ndi tdi cac day ndi
\ /^
f
t
trong mdi trudng cd nhieu nhieu, hieu suat cua nd cd the bj tac dgng mot each
f
\
i^
f
t
bat
Igi
bdi cac ngudn nhieu dien
tir
rat manh, chang ban nhu cac role, cac may
ft
f
-y
phat sdng vd tuyen, cac dgng ca chdi quet, v. v vi cac day ndi
eiia
nd ed the trd
thanh cac angten thu va cac
Idp
tiep giap ban dan ben trong cua nd ed the boat

t
f f f
dgng nhu cac bg chinh luu. De dat duge cac ket qua tdt nhat trong cac trudng
y
f
y
f
hgp nhu vay, mot tu
Igc
ngudn ndi tu ngudn nudi tdi dat va mot bg lam nhut RC
ndi tiep (chang ban, R
=
75Q,
C
=
l|iF)
tir Idi
ra tdi dat thudng duge su dung
nhu duge chi ra trong hinh 2.
t •> A
Mot do phan giai theo do am 0,2% RH cd the dat duge bang each su dung
mot A/D 10 bit nhu A/D
eiia
vi
di^u khiln
ATMega8535.
DI
ung dung RPM vao trong he thdng do, nd
duge
hieu chinh de cd kha

nang ghi cac mau gigng ndi theo dinh dang tep. Cho vi du, de thdng bao nhiet do
do duge trong ung dung nay,
Idi
dgc cua sd va cau
"Nhiet
do bay gid la", va
"do
C"
can duge ghi am. Sau dd td hgp cua
nhirng
am nay cho phep thdng bao ra cac
k^t
qua mong mudn, chang han nhu:
"Nhiet
do bay gid la 23 do
C".
2.1.3 Ket qua va ban luan
Ban mach cua he do sau khi lap rap
duge
chi ra (tuong tu)
niiir
trong hinh
4
14
Hinh
4:
Ban mach cua
he
do.
Dir

bao thoi tiet dan gian: Bang each bd sung them cam bien ap suat va lap
t
f
I.U
f
trinh the hien duge bien thien va tac dgng tuong hd cua cac tham sd nhiet do, ap
ft ft
fit
suat, do am cung nhu bien ddi theo thdi gian cua cac thdng sd, he thdng cd the
y
t
f
dua ra nhung thdng bao don gian ve thdi tiet nhu: do am qua cao hoac trdi sap
t
/y
mua hoac hdm nay trdi qua ndng, kieu nhu "Quy Ong qua map, nen giam an" d
f
cac can ngoai dudng phd.
^
f
t t
f
t
Ket qua: Cac thdng sd do nhu nhiet do, do am va cd the ca ap suat ed the duge
t
y
hien thi tren man LCD, duge luu tru trong bd nhd va ddng thdi cac thdng tin nay
> f
cung duge thdng bao bang gigng ndi tieng Viet.
Ket luan: Day la mot trong nhieu ung dung cua mddun RPM ket hgp vdi mot vi

dieu khien va cac cam bien trong cac he thdng do ludng de thdng bao ket qua
bang gigng ndi. Thiet ke nay ed the
duge sir
dung nhu la mot vi du tham khao
cho viec phat trien cac ung dung do ludng va dieu khien phuc tap hon nhu cac
f y
tram du bao thdi tiet cam tay, cac may ban hang tu dgng, do ludng
tir
xa, cung
f f '
nhu cac he thdng giam sat trong y te va cac he thdng tu dgng trong cong nghiep.
15
2.2 TICH
HQfP
CHIP CHUYEN DUNG
VAO CAC
HE THONG DO NHIEU
MAN
HIEN THI
2.2.1 Dat
van de
f
Trong cac
he
thdng
do
ludng dien hoac
do
ludng
Vat ly ndi

chung thudng
r
y
y
xuat hien
kha
nang phai quan
sat
nhieu
dai
lugng
do
ddng thdi
(xem
hinh
5).
Khi
dd, ve
nguyen
tac
phai
lap cho mdi bd
hien
thi mot bd
dieu khien hien
thi.
Sd
cac dai
lugng
do

ddng thdi cang nhieu
thi sd bo
dieu khien cung nhieu theo
f f
va
sd
linh kien, cdng
lap rap
ciing theo
dd ma
tang len.
Day la
mot
kha
nang
cd
the
dua
cac chip chuyen dung vao
de
ung dung.
W^^ii'^^^^'
H-'i^-'l
irifiiiiimrltiiimironiilfii
•>
f
y
t
Hinh
5:

Man hien
thj cua
he thong do
vol
nhieu man hien
thj
16
y
t t
f
y
I
Do cac bg dieu khien hien thi thudng gidng nhau ve mat cau true nen trong
trudng hgp nay ta cd the ap dung phuang phap lap trinh theo kieu mddun va
ngon ngu lap trinh la VHDL nhu da md ta d phan dau. Trong phan nay, chung
.
. '
' y
t t
tdi
se thdng bao mot sd ket qua trong viec lap trinh cho cac chip dieu khien hien
^ ^
f
y
f
thi ddng thdi nhieu mddun, tren thuc te da thu vdi 3 mddun nhung ve nguyen tac
•»
I y f y
I
CO

the md rgng sd mddun len nhieu hon; van de chi thudc vao sd chan cua "chip
f
trang" duge
lira
ehgn.
2.2.2 Phan
thirc
nghiem va cac ket qua
De ed duge cac chip vdi cac tinh nang can ed, qua trinh thiet ke va thuc hien
duge tien hanh theo 2 bude ca ban:
• Viet phan mem mo ta boat dgng thuc su cua mach dien can thiet ke bang
ngon ngir VHDL.
• Soat l6i,
dich
va nap chuong trinh vao chip.
2.2.2.1 Viet phdn mem vd nap vao chip Xilinx
Trong khuon kho de tai, ed 4 modun da duge thiet ke va
thir
nghiem, eu the
la:
1-
Bg dem Johnson.
2-
Bg dem
nhi
phan
3-
Bg giai ma BCD ra ma 7 doan
4-
Bg dem Johnson va giai ma thap phan.

5-
Bg hien thi
nhi^u
man hien thi
Cac modun nay da duge mo ta bang ngon ngu VHDL theo cac luu do thuat toan
tren eac trang sau: |
^^, -^c ^ .;.: o> *
•N.O
17
1)T/
^50
1) Bo dem Johnson
i
Khai bao c6ng vao/ra:
Clk:
in
stdjogic;
Dout
:inout std_logic_vector(7 downto 0));
Sai
Dung
Khdi
lao
Process
Dout( 7 downto 1) <= Dout( 6 downto 0)
Dout(0)<=
notdout(7)
Ket thuc
Process
Chu thich:

CIK
: cong
Idi
vao xung nhip
Dout:
Cong
Idi
ra bg dem 8 bit
18
2) Bo dem nhi phan : trong
lim
do nay thiet ke bo dem nhi phan 8 bit, viec
tang s6' bit chi doi hoi tang them so
lirong
loi ra va van de nay giai quyet
bang phan mem ttrong doi don gian. Van de chi la chip
duac sir
dung c6 du
so chan de gan thanh cac loi ra hay khong!
k
Khai bao c6ng vao/ra:
Clk:
in
sldjogic;
Doul
:inout
std_logic_vector(7
downto 0));
Diing
Khai tao

Process
Dout <= Dout
+
1
^
f
/ \
Ket
thuc
Process
^
J
Chu
thich
Clk
:
loi vao xung nhip
Dout: loi ra bo dem 8 bit
19
3) Bo giai ma BCD ra ma 7 doan
Bat
d^u
')
Khai bao c6ng vao/ra:
Clk:
in std_logic;
Din: in
sld_logic_vecior(3
downto 0);
Dout :inout std_logic_vector(7 downto 0));

Chu thich:
Clk: loi vao xung nhip
Din: loi vao 4 bit
Dout: loi ra 8 bit
CASE din is
WHEN "0000"
WHEN
"0(H)
1"
WHEN "(X)
10"
WHEN"(M)H"
WHEN "0100"
WHEN
"0101"
WHEN "0110"
WHEN "01
M"
WHEN "1000"
WHEN"I(K)1"
WHEN
"1010"
WHEN
"1011"
WHEN "
1100"
WHEN
"1101"
WHEN
"II10"

WHEN
"1111"
WHEN others
END CASE;
=>ra<=
"11000000"
=>ra<= "111
11001"
=>rd<="101(K)100"
=>ra<=
"10110000"
=>ra<=
"10011001"
=>rd<=
"10010010"
=>ra<=
"10000010"
=>rd<="111110(K)"
=>rd<="1000(K)00"
=>rd<="10010(KKr'
=>rd<=
"10100000"
=>ra<="
10000011"
=>ra<="I01001H
"
=>rd<=
"10100001"
=>rd<=
"10000100"

=>rd<=
"10001110"
-0
1
-2
3
4
-5
-6
-7
8
9
"A
-B
C
D
E
"F
=>null; ra<="110()00()0";
I
Ka't
thuc
Process
20
4) Bo dem Johnson va giai ma thap phan
Bit dau
^
i
Khai bio c6ng vao/ra:
Clk:

in std_logic;
Dout :inout
std_logic_vector(7
downto 0));
Dir :in std_logic
Dout( 7 downto 1) <= dout( 6 downto 0)
Dout(0)<= dout(7)
Dout( 6 downto 0) <= dout( 7 downto
1)
Dout(7)<=
dout(O)
i
Ket thuc
Process
Ket thuc
Process
Chu
thich
Clk: loi vao xung nhip
Dout:
loi ra 8 bit
Dir: loi vao xac dinh
hudns
dem
21
Toi uu boa phan mem
Mot chi tieu
ludn
duge chu y den trong qua trinh soan thao va soat
Idi

phan
y
1
f
t
mem VHDL la giam thieu vung bi chiem tren chip, eo nhu vay mdi ed the tich
hgp mot lugng
Idn
cac cdng
Idgic
tren mot chip. Sau mdi
Ian
dich ty le vung bi
f f y
t
chiem ludn duge xem xet, nhd vay tat ca cac md dun deu ed the tich hgp len
chip XC9536 (chi chua 36 d macro).
2.2.2.2 Xay
dtmg
cdc mach kiem
chimg
Sau khi chuong trinh da duge soan thao, duge
chay
thu va loai bd cac
I6i
thi
ed the chuyen sang bude nap phdn mem vao chip.
V6
nguyen tac, sau khi duge
nap chip se duge gan

chufc
nang va
"dat
ten" dung nhu ndi dung da duge mo ta
khi thiet ke. Tuy
vay
viec kiem tra
lai
hay nhu thudng ndi la kiem chung van la
ein thiet, qua dd khang dinh chang ban xem bg giai ma da dung la bg giai ma
chua va qua trinh boat dgng ed lam xuat hien Idi khdng, Trong khuon kho cua
de tai nghien cuu, cac mach kiem chung cho
timg
trudng hgp deu da duge thiet
ke va lap rap, cho dd thdi gian danh cho cdng viec nay dai khong kem phan thiet
ke luu do va viet chuong trinh da neu d tren
Bp
giai md BCD sang 7 thanh
De minh chung tinh diing dan va kha nang boat dgng cua bg giai ma BCD
sang 7 thanh mot bg dem nhi phan 4 bit va giai ma BCD sang 7 thanh da duge
tich hgp tren cung mot chip Xilinx. Tren mach dien minh boa, chip duge ndi vdi
mot LED 7 thanh (ddng vai trd hien thi ket qua) va mot bg tao xung nhip cap
cho bg dem dung vi mach djnh thdi gian NE555P. Loi ra
eiia
bg tao xung
NE555P duge ndi true tiep tdi chan clock
GCKl
(chan 5) cua chip
XilTn
XC9536. Cac dien trd va tu dien

diing
vdi NE555 duge
lua
ehgn de xung nhip
ed tan sd 22 Hz
(dii
de ket qua hien thj khong bi
nha'p
nhay !).
Viec nap chuang trinh vao chip duge thuc hien thong qua cap JTag (theo
chuan JTAG !) va phan mem cdng cu Xilinx
ISE.
Viec nap chuang trinh cho mot
chip Xilinx bat ky (trong trudng hgp nay su dung chip
XC9536)
ed the tien hanh
ngay ca khi chip dang duge gan tren mot ban mach ung dung. Cap Jtag cho phep
lap trinh,
kidm
tra, xoa va kiem tra chuc nang cua cac chip Xilinx
XC9536.
So do nguyen ly cua mach kiem chung da thiet ke duge mo ta tren
hinh
6.
22
vcc

0
2
5

R
TRIG
CVott
LM555
1—C2
104
00
B Q
>
DtS
GND
-
IC2
3
7
6
T
1
IMT
CI
473zzf:
lO/GTSl
I0«TS2
42
40
7
1
3
25
8

9
11
12
13
14
18
19
20
22
24
Jl
JTAG
CN
r*>
^
•<-,
«o
70 C
ICl
g H
OTD
OUT
r
"O
TDDJ
o u u
oo
>
IOJGCKJ
I0/GCK2

lO/GCIO
10
10
10
10
10
10
10
10
10
10
10
10
10
10
QQQ
ooo
XC9536
TCKcf-
TMS
-
10
10
10
lO/GSR
10
10
10
10
10

h
10
\-
10
i-
10
V-
10
i-
10
\-
10
i-
30
15
17
16
39
37
35
33
(
29
28
26
38
43
26
27
34

5oO
-•
-OSlZh
-CIS:
•r-TJ-A—I-
-I
R7
t-
-C:S2Z>
10
LI
b
O
O
e
f
p
c
! ^
d
2;
•SEG
NHO
//m/i
6: So do nguyen
t^c
ciia
mach dien minh
chung
kha nang

boat dong cua chip giai ma BCD sang 7 thanh
i '^
m^
-^'-s^
Hinh
7:
Ban mach minh
chumg
kha nang boat dong cua chip giai
ma BCD sang 7 thanh.
23
.Mach
dien sau khi lap rap va
di^u
chinh duge ehi ra tren hinh 7. Ta ed
the
d6
dang nhan
tha'y
chip Xilinx nam d chinh giiia
eiia
mach.
Phia
b6n
trai la vi mach NE555 duge dung de tao xung dem. Phia ben phai la
mdt
LED 7 thanh hien thi ket qua dem sd xung da dua vao chip Xilinx. Vi bg
dem nhi phan duge thiet ke d day
la
bg dem nhi phan 4 bit, nen ket qua hien thi

tr6n
LED 7 thanh se
la
t\i
0 den 15, trong dd
t\i
0 den 9 la dudi dang
chir
sd
edn
tiir
10 den 16
la
dudi dang
ehi?
cai:
a, b, e, d, E, F.
Bo dem Johnson vd giai md thap phdn
Ban mach minh
chiing
duge mieu ta d day la mot cdng cu minh boa cho kha
nang
lap
trinh trong he thdng
(tiie
kha nang thay doi chuang trinh cho chip ngay
trong ban mach
ung
dung ma khdng
ein

phai thao chip va dung mot ban mach
nap chuyen dung).
Mo td thiet ke
Thiet ke thuc hien mot bg dem Johnson 8 bit. Loi ra eiia bg dem
di6u
khien 8
LED cho phep quan sat tinh trang boat dgng eiia bg dem. Mot vi mach dinh thdi
gian NE555 duge
sir
dung de tao xung nhip cap cho bg dem. Loi ra
eiia
bg tao
xung NE555 duge ndi true tiep tdi chan clock
CLKl
(chan 5) eiia chip Xilinx (d
day la XC9536). Cac dien trd va tu dien trong mach tao xung NE555 cung
duge
lua
ehgn de tao ra xung ed tan sd 22 Hz. Chuang trinh
ciing
duge nap vao chip
thdng qua cap JTag gidng nhu d trudng hgp tren. So do nguyen ly
eiia
bg dem
Jonson duge chi ra trong
hinh
8.
I ri
p-i
^ o o

!
lO-CTSl
ICWTTO
v'-^
a
S3o TDIH
-
^^•^•X
rrT~r\
t
r
Hi
lOCCKl
IOKJCK3
Kxaa
10
10
[O
10
10
ro
10
10
10
10
10
10
10
10
DOO

•nc
[O
10
10
[OCSl
10
10
10
10
10
10
10
10
10
10
10
2 q
Hinh
8:
So do nguyen ly mach kiem chung bo dem
Johnson,
24
Mach
di6n
sau khi lap rap va
di6u
chinh duge ehi ra tren hinh 8.
.<?j^««» t-^'>^r^'B'>.f«t*-^^f^'
*
^&>ii

Hinh
9:
Mach dien minh chumg kha nang boat dong cua chip bo dem Johnson.
Ve ca ban thi mach dien nay ehi khac mach d hinh 9 la mot day 8 LED dan
da thay the cho LED 7 thanh. Khi bat dien cac LED se
Ian lugt
sang phu hgp vdi
gian do thdi gian d cac idi ra cua bg dem Johnson.
Theo thiet ke truyen thdng thi he thdng do tren day se bao gom 5 cam bien
ft
t
f
ft
nhiet, mdt cam bien do am, cac mach chuan tin hieu tu cam bien, cac bd bien doi
I
•?
t f f
tuong tu-sd de chuyen tin hieu vao mdt vi xu ly, cudi cung la cac khdi giai ma
\
9 1 •> y
r f
va dieu khien de dua ra 3 bd hien thi LED 7 thanh. So do khdi cua he thong c6
tit f
the hinh dung la rat phuc tap. De don gian cho viec tich hgp tren chip, he thong
\
r
duge chia ra thanh nhimg mddun va nit ggn thanh so ddi khdi nhu hinh 10.
CBNDI
CBND 2
CBND

3
CBND
4
"L;
1
r^
CBND 5
1—
.
.
1
PSoC
f
CBDA_I

t
XC9536
7
'
3
T
LED 1
NhdoTB
' 3
T
LED
2
Nhdp
5
" 3

V
LED
3
Do am
y
I
f
Hinh
10:
Sa
do khoi cua he thong
sir
dung cac chip
lap trinh
duac.
25

×