ai giup em BTL thiet ke he thong chuong bao truong hoc co dong ho thoi gian su dung LCD
Thông báo
Collapse
No announcement yet.
ae giup em BTL thiet ke he thong chuong bao truong hoc dung 8051 hien thi ra lcd
Collapse
X
-
bạnmuoossn mọi người giúp thì bạn phải cho người ta biết bạn đã có được những gì rồi chư. cách xin của bạn khác gi đi xin chứ. mình nghĩ sẽ ko ai có time để đi làm tất cả cho bạn đâu
thân.!
Nguyên văn bởi icecandylove Xem bài viếtai giup em BTL thiet ke he thong chuong bao truong hoc co dong ho thoi gian su dung LCDNguyễn Huy Biên - 01649 802 694
gmail :
-
#include <sfr51.inc>
;************
org 000h
Ljmp main
scl bit p1.0
sda bit p1.1
mode bit p3.0
tang bit p3.1
giam bit p3.2
hengio bit p3.4
giay bit 28h.0
phut bit 28h.1
gio bit 28h.2
ngay bit 28h.3
thang bit 28h.4
nam bit 28h.5
kiemtra bit 29h.0
tt bit 29h.1
diachi equ 30h
dulieu equ 32h
dulieund equ 33h
dulieunc equ 34h
dulieutd equ 35h
dulieutc equ 36h
dems equ 40h
demp equ 41h
demh equ 42h
demn equ 43h
demt equ 44h
demnd equ 45h
tam2 equ 49h
demndd equ 55h
demndc equ 56h
demncd equ 57h
demncc equ 58h
demp1 equ 59h
demh1 equ 60h
demp1d equ 61h
demp1c equ 62h
demh1d equ 63h
demh1c equ 64h
dem equ 65h
org 030h
;################################################# ###############
;############## Chuong trinh chinh ##########################
;################################################# ###############
main:
clr p3.5
mov p0,#00h
mov dptr,#led7anode
mov dems,#00
mov demp,#00
mov demh,#00
mov demn,#00
mov demt,#00
mov demh1,#00
mov demp1,#00
;################################################# ################
;############# Hien thi led 7 doan ##########################
;################################################# ################
Acall nhanthoigian
clr p3.5
clr tt
clr kiemtra
hienthiled7doan:
Acall nhanthoigian
Acall quetled7doan
baothuc:
jnb kiemtra,kiemtramode
setb p3.5
jb mode,kiemtramode
Acall t50ms
jnb mode,$
clr p3.5
clr tt
clr kiemtra
Ljmp hienthiled7doan
kiemtramode:
jb mode,x
Acall t50ms
jnb mode,$
Ljmp chinhthoigian
x:
jb hengio,kiemtra1
Acall t50ms
jnb hengio,$
Ljmp hengio1
;################################################# ################
;################################################# ################
;############# Bao thuc ##############################
;################################################# ################
kiemtra1:
jnb tt,hienthiled7doan
mov a,r5
cjne a,demh1c,hienthiled7doan
Acall nhanthoigian
Acall quetled7doan
mov a,r4
cjne a,demh1d,hienthiled7doan
acall nhanthoigian
acall quetled7doan
mov a,r3
cjne a,demp1c,hienthiled7doan
Acall nhanthoigian
Acall quetled7doan
mov a,r2
cjne a,demp1d,hienthiled7doan
Acall nhanthoigian
Acall quetled7doan
setb kiemtra
Ljmp hienthiled7doan
;################################################# ################
;################################################# ################
;############# Hen gio ##############################
;################################################# ################
hengio1:
modeh1:
mov tam2,demh1
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p0.4
Acall t50ms
clr p0.4
mov a,52h
movc a,@a+dptr
mov p2,a
setb p0.5
Acall t50ms
clr p0.5
kiemtratangh1:
jb tang,kiemtragiamh1
Acall t50ms
jnb tang,$
inc demh1
mov a,demh1
cjne a,#24,modeh1
mov demh1,#00
Ljmp modeh1
kiemtragiamh1:
jb giam,kiemtramodep1
Acall t50ms
jnb giam,$
dec demh1
mov a,demh1
cjne a,#0ffh,modeh1
mov demh1,#23
Ljmp modeh1
kiemtramodep1:
jb hengio,modeh1
Acall t50ms
jnb hengio,$
modep1:
mov tam2,demh1
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p0.4
Acall t50ms
clr p0.4
mov a,52h
movc a,@a+dptr
mov p2,a
setb p0.5
Acall t50ms
clr p0.5
mov tam2,demp1
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p0.2
Acall t50ms
clr p0.2
mov a,52h
movc a,@a+dptr
mov p2,a
setb p0.3
Acall t50ms
clr p0.3
kiemtratangp1:
jb tang,kiemtragiamp1
Acall t50ms
jnb tang,$
inc demp1
mov a,demp1
cjne a,#60,modep1
mov demp1,#00
Ljmp modep1
kiemtragiamp1:
jb giam,kiemtramodes1
Acall t50ms
jnb giam,$
dec demp1
mov a,demp1
cjne a,#0ffh,modep1
mov demp1,#59
Ljmp modep1
kiemtramodes1:
jb hengio,modep1
Acall t50ms
jnb hengio,$
mov tam2,demp1
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#0ah
Acall truyen
mov tam2,demh1
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#0bh
Acall truyen
setb tt
Ljmp hienthiled7doan
;################################################# ################
;################################################# ################
;############# Chinh thoi gian ##############################
;################################################# ################
chinhthoigian:
mov 28h,#00
mov diachi,#00h
Acall nhan
mov tam2,dulieu
Acall chuyenbcdsanghex
mov dems,tam2
mov diachi,#01h
Acall nhan
mov tam2,dulieu
Acall chuyenbcdsanghex
mov demp,tam2
mov diachi,#02h
Acall nhan
mov tam2,dulieu
Acall chuyenbcdsanghex
mov demh,tam2
mov diachi,#04h
Acall nhan
mov tam2,dulieu
Acall chuyenbcdsanghex
mov demn,tam2
mov diachi,#05h
Acall nhan
mov tam2,dulieu
Acall chuyenbcdsanghex
mov demt,tam2
mov diachi,#06h
Acall nhan
mov tam2,dulieu
Acall chuyenbcdsanghex
mov demnd,tam2
mov dem,#020
modeh:
Acall quetled7doanchoptat
dec dem
mov a,dem
cjne a,#00,kiemtratangh
mov dem,#020
cpl gio
kiemtratangh:
jb tang,kiemtragiamh
Acall t50ms
jnb tang,$
inc demh
mov a,demh
cjne a,#24,modeh
mov demh,#00
Ljmp modeh
kiemtragiamh:
jb giam,kiemtramodep
jnb giam,$
dec demh
mov a,demh
cjne a,#0ffh,modeh
mov demh,#23
Ljmp modeh
kiemtramodep:
jb mode,modeh
Acall t50ms
jnb mode,$
mov 28h,#00
modep:
Acall quetled7doanchoptat
dec dem
mov a,dem
cjne a,#00,kiemtratangp
mov dem,#020
cpl phut
kiemtratangp:
jb tang,kiemtragiamp
Acall t50ms
jnb tang,$
inc demp
mov a,demp
cjne a,#60,modep
mov demp,#00
Ljmp modep
kiemtragiamp:
jb giam,kiemtramodes
Acall t50ms
jnb giam,$
dec demp
mov a,demp
cjne a,#0ffh,modep
mov demp,#59
Ljmp modep
kiemtramodes:
jb mode,modep
Acall t50ms
jnb mode,$
mov 28h,#00
modes:
Acall quetled7doanchoptat
dec dem
mov a,dem
cjne a,#00,kiemtratangs
mov dem,#020
cpl giay
kiemtratangs:
jb tang,kiemtragiams
Acall t50ms
jnb tang,$
inc dems
mov a,dems
cjne a,#60,modes
mov dems,#00
Ljmp modes
kiemtragiams:
jb giam,kiemtramoden
Acall t50ms
jnb giam,$
dec dems
mov a,dems
cjne a,#0ffh,modes
mov dems,#59
Ljmp modes
kiemtramoden:
jb mode,modes
Acall t50ms
jnb mode,$
mov 28h,#00
moden:
Acall quetled7doanchoptat
dec dem
mov a,dem
cjne a,#00,kiemtratangn
mov dem,#020
cpl ngay
kiemtratangn:
jb tang,kiemtragiamn
Acall t50ms
jnb tang,$
inc demn
mov a,demn
cjne a,#32,moden
mov demn,#00
Ljmp moden
kiemtragiamn:
jb giam,kiemtramodet
Acall t50ms
jnb giam,$
dec demn
mov a,demn
cjne a,#0ffh,moden
mov demn,#31
Ljmp moden
kiemtramodet:
jb mode,moden
Acall t50ms
jnb mode,$
mov 28h,#00
modet:
Acall quetled7doanchoptat
dec dem
mov a,dem
cjne a,#00,kiemtratangt
mov dem,#020
cpl thang
kiemtratangt:
jb tang,kiemtragiamt
Acall t50ms
jnb tang,$
inc demt
mov a,demt
cjne a,#13,modet
mov demt,#01
Ljmp modet
kiemtragiamt:
jb giam,kiemtramodenam
Acall t50ms
jnb giam,$
dec demt
mov a,demt
cjne a,#0ffh,modet
mov demt,#12
Ljmp modet
kiemtramodenam:
jb mode,modet
Acall t50ms
jnb mode,$
mov 28h,#00
modenam:
Acall quetled7doanchoptat
dec dem
mov a,dem
cjne a,#00,kiemtratangnam
mov dem,#020
cpl nam
kiemtratangnam:
jb tang,kiemtragiamnam
Acall t50ms
jnb tang,$
inc demnd
mov a,demnd
cjne a,#100,modenam
mov demnd,#00
Ljmp modenam
kiemtragiamnam:
jb giam,kiemtramodethoat
Acall t50ms
jnb giam,$
dec demnd
mov a,demnd
cjne a,#0ffh,modenam
mov demnd,#099
Ljmp modenam
kiemtramodethoat:
jb mode,modenam
Acall t50ms
jnb mode,$
Acall guithoigian
Ljmp hienthiled7doan
;################################################# ################
;################################################# ################
;############# Nhan thoi gian ##############################
;################################################# ################
nhanthoigian:
mov diachi,#00h
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov r0,53h
mov r1,52h
mov diachi,#01h
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov r2,53h
mov r3,52h
mov diachi,#02h
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov r4,53h
mov r5,52h
mov diachi,#04h
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov dulieund,53h
mov dulieunc,52h
mov diachi,#05h
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov dulieutd,53h
mov dulieutc,52h
mov diachi,#06h
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov demndd,53h
mov demndc,52h
jnb tt,x2
mov diachi,#0ah
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov demp1d,53h
mov demp1c,52h
mov diachi,#0bh
Acall nhan
mov tam2,dulieu
Acall chuyensanghex
mov demh1d,53h
mov demh1c,52h
ret
;################################################# ################
;################################################# ################
;############# Gui thoi gian ###############################
;################################################# ################
guithoigian:
mov tam2,dems
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#00h
Acall truyen
mov tam2,demp
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#01h
Acall truyen
mov tam2,demh
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#02h
Acall truyen
mov tam2,demn
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#04h
Acall truyen
mov tam2,demt
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#05h
Acall truyen
mov tam2,demnd
Acall chuyensangbcd
mov r1,#52h
mov r0,#53h
xchd a,@r1
swap a
xchd a,@r0
mov dulieu,a
mov diachi,#06h
Acall truyen
ret
;################################################# ################
;################################################# ################
;############# Truyen I2C ###################################
;################################################# ################
;################################################# ################
;################################################# ################
;############# Nhan du lieu #################################
;################################################# ################
nhan:
Acall start
mov a,#0d0h
Acall send
setb sda
setb scl
jb sda,nhan
clr scl
mov a,diachi
Acall send
setb sda
setb scl
jb sda,nhan
clr scl
Acall start
mov a,#0d1h
Acall send
setb sda
setb scl
jb sda,nhan
clr scl
Acall receive
Acall stop
ret
receive:
mov r7,#08h
lap_receive:
setb scl
mov c,sda
clr scl
rlc a
djnz r7,lap_receive
mov dulieu,a
setb scl
clr sda
clr scl
ret
;################################################# ################
;################################################# ################
;############# Truyen du lieu ###############################
;################################################# ################
truyen:
Acall start
mov a,#0d0h
Acall send
setb sda
setb scl
jb sda,truyen
clr scl
mov a,diachi
Acall send
setb sda
setb scl
jb sda,truyen
clr scl
mov a,dulieu
Acall send
setb sda
setb scl
jb sda,truyen
clr scl
Acall stop
ret
send:
mov r7,#08h
lap_send:
rlc a
mov sda,c
setb scl
clr scl
djnz r7,lap_send
ret
;################################################# ################
;################################################# ################
;############# Start I2C ####################################
;################################################# ################
start:
setb sda
setb scl
nop
nop
clr sda
nop
nop
clr scl
nop
ret
;################################################# ################
;################################################# ################
;############# Stop I2C #####################################
;################################################# ################
stop:
clr sda
nop
nop
setb scl
nop
nop
setb sda
ret
;################################################# ################
;################################################# ################
;############# Quet led 7 doan chop tat #####################
;################################################# ################
quetled7doanchoptat:
jb gio,phut1
mov tam2,demh
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p0.4
Acall t50ms
clr p0.4
mov a,52h
movc a,@a+dptr
mov p2,a
setb p0.5
Acall t50ms
clr p0.5
phut1:
jb phut,giay1
mov tam2,demp
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p0.2
Acall t50ms
clr p0.2
mov a,52h
movc a,@a+dptr
mov p2,a
setb p0.3
Acall t50ms
clr p0.3
giay1:
jb giay,ngay1
mov tam2,dems
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p0.0
Acall t50ms
clr p0.0
mov a,52h
movc a,@a+dptr
mov p2,a
setb p0.1
Acall t50ms
clr p0.1
ngay1:
jb ngay,thang1
mov tam2,demn
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p0.7
Acall t50ms
clr p0.7
mov a,52h
movc a,@a+dptr
mov p2,a
setb p0.6
Acall t50ms
clr p0.6
thang1:
jb thang,nam1
mov tam2,demt
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p1.3
Acall t50ms
clr p1.3
mov a,52h
movc a,@a+dptr
mov p2,a
setb p1.2
Acall t50ms
clr p1.2
nam1:
jb nam,thoatquet
mov tam2,demnd
Acall chuyensangbcd
mov a,53h
movc a,@a+dptr
mov p2,a
setb p1.7
Acall t50ms
clr p1.7
mov a,52h
movc a,@a+dptr
mov p2,a
setb p1.6
Acall t50ms
clr p1.6
mov a,#00h
movc a,@a+dptr
mov p2,a
setb p1.5
Acall t50ms
clr p1.5
mov a,#02h
movc a,@a+dptr
mov p2,a
setb p1.4
Acall t50ms
clr p1.4
ret
thoatquet:
ret
;################################################# ################
;################################################# ################
;############# Quet led 7 doan ##############################
;################################################# ################
quetled7doan:
mov a,r0
movc a,@a+dptr
mov p2,a
setb p0.0
Acall t50ms
clr p0.0
mov a,r1
movc a,@a+dptr
mov p2,a
setb p0.1
Acall t50ms
clr p0.1
mov a,r2
movc a,@a+dptr
mov p2,a
setb p0.2
Acall t50ms
clr p0.2
mov a,r3
movc a,@a+dptr
mov p2,a
setb p0.3
Acall t50ms
clr p0.3
mov a,r4
movc a,@a+dptr
mov p2,a
setb p0.4
Acall t50ms
clr p0.4
mov a,r5
movc a,@a+dptr
mov p2,a
setb p0.5
Acall t50ms
clr p0.5
mov a,dulieund
movc a,@a+dptr
mov p2,a
setb p0.7
Acall t50ms
clr p0.7
mov a,dulieunc
movc a,@a+dptr
mov p2,a
setb p0.6
Acall t50ms
clr p0.6
mov a,dulieutd
movc a,@a+dptr
mov p2,a
setb p1.3
Acall t50ms
clr p1.3
mov a,dulieutc
movc a,@a+dptr
mov p2,a
setb p1.2
Acall t50ms
clr p1.2
mov a,demndd
movc a,@a+dptr
mov p2,a
setb p1.7
Acall t50ms
clr p1.7
mov a,demndc
movc a,@a+dptr
mov p2,a
setb p1.6
Acall t50ms
clr p1.6
mov a,#00h
movc a,@a+dptr
mov p2,a
setb p1.5
Acall t50ms
clr p1.5
mov a,#02h
movc a,@a+dptr
mov p2,a
setb p1.4
Acall t50ms
clr p1.4
ret
;################################################# #######################
;################################################# #######################
;############################# Thoi gian quet led #######################
;################################################# #######################
t50ms:
push 30h
push 31h
mov 30h,#4
mov 31h,#1
lap:
djnz 31h,$
djnz 30h,lap
pop 31h
pop 30h
ret
;################################################# ########################
;################################################# ########################
;########################## Chuyen BCD sang HEX ##########################
;################################################# ########################
chuyenbcdsanghex:
mov a,tam2
anl a,#00001111b
mov 53h,a
mov a,tam2
anl a,#11110000b
swap a
mov 52h,a
mov b,52h
mov a,#0ah
mul ab
add a,53h
mov tam2,a
ret
;################################################# ########################
;################################################# ########################
;########################## Chuyen sang HEX ##############################
;################################################# ########################
chuyensanghex:
mov a,tam2
anl a,#00001111b
mov 53h,a
mov a,tam2
anl a,#11110000b
swap a
mov 52h,a
ret
;################################################# ########################
;################################################# ########################
;########################## Chuyen sang BCD ##############################
;################################################# ########################
chuyensangbcd:
tam equ 51h
tam1 equ 50h
mov tam,tam2
mov a,tam
mov b,#10
div ab
mov 52h,a
mov b,#10
mul ab
mov tam1,a
mov a,tam
clr c
subb a,tam1
mov 53h,a
ret
;################################################# ############################
;################################################# ############################
;###################### Du lieu quet led 7 doan ##############################
;################################################# ############################
led7anode:
db 01000000b,01111001b,00100100b,00110000b,00011001b, 00010010b,00000010b,01111000b,00000000b,00010000b
;################################################# ############################
end
ban nao biet sua code tren va dua hien thi ra LCD giup minh voi
Comment
Bài viết mới nhất
Collapse
-
Trả lời cho Yêu thơ mê nhạc, mời các bác vào đây!bởi dinhthuong92GIỚI THIỆU CA KHÚC VỀ CHA MẸ:
Nặng Nghĩa Mẹ Cha
Sáng tác: Hoàng Đình Thường
Giọng hát: AI
Công cha cao tựa như Thái Sơn
Nghĩa mẹ sâu nước biếc xanh trong
Mong con khôn lớn đời hạnh phúc
Mẹ cha...-
Channel: Tâm tình dân kỹ thuật
12-05-2026, 16:22 -
-
bởi afrendlyCảm ơn bạn. Mình hỏi để thợ có thể tham khảo thôi chứ không đủ kiển thức để sửa, mà cũng không có đồ nghề, mua đồ nghề quá tiền máy. Gọi nhiều lần mà thợ hẹn mãi chưa có tới ấy bạn. Mình muốn sửa được chứ bỏ thì uống, nhưng sợ là được mỗi người thợ mà lại không sửa nổi....
-
Channel: Điện tử gia dụng
11-05-2026, 00:34 -
-
bởi mèomướpDạ nó bị tắc ẩm hoặc rò thiếu gas hoặc lốc yếu hoặc van tiết lưu có vấn đề hoặc tất cả những nguyên nhân trên ạ. Chú ko chuyên về mảng này thì bán đi, giành thời gian trồng rau sạch đem ra chợ bán lấy tiền mua tủ mới ạ. Còn...
-
Channel: Điện tử gia dụng
10-05-2026, 17:01 -
-
bởi afrendlyXin chào mọi người. Mình lại có vấn đề về đồ điện cần nhờ mọi người hỗ trợ giúp. Mình có tủ lạnh Sharp dùng cũng lâu rồi. Trước có bị kém lạnh, không đông đá thì có thợ họ mang về, sục đường ga gì đó hết 900k và đã dùng...
-
Channel: Điện tử gia dụng
10-05-2026, 16:53 -
-
bởi dinhthuong92Đấy, cái tôi thắc mắc là chỗ màu hồng ấy bạn, để áp vào cao chứ không bị sụt gần bằng áp pin thì rất cần cuộc cảm để làm điều đó. Tuy nhiên, trong công thức bác thớt dẫn không thấy mặt L, và một vài mạch MPPT tôi đã kiểm...
-
Channel: Nguồn!
09-05-2026, 10:01 -
-
bởi mèomướpDạ mạch sạc là 1 cục nguồn, nó sẽ điều chỉnh công suất đầu ra để có tổng trở bằng nội trở của pin ạ. Và cái cách nó chỉnh công suất đầu ra sẽ là dạng buck, boot. Đều cần đến cuộn cảm ạ. Tất nhiên chú thích thì có thể dùng dạng tuyến tính transistor để bù trừ nhưng mà nó đốt năng lượng vô ích ạ...
-
Channel: Nguồn!
08-05-2026, 16:26 -
-
bởi dinhthuong92Tng trở R của tải (gồm pin và mạch sạc) trong công thức đó rõ ràng khống có L xuất hiện. Nếu tính các dây dẫn thì rất nhỏ, bỏ qua. Vì nội trở pin là rất nhỏ, có thể nói luôn lớn hơn nội trở solar, nên mạch MPPT sẽ hầu như luôn tính...
-
Channel: Nguồn!
08-05-2026, 11:00 -
-
bởi dinhthuong92Chào bác. Đã là công thức phải tổng quát chứ, nó phải thể hiện cả quá trình, rối thì quá độ hay xác lập tính sau vì tùy điều kiện. Cũng như công thức tính diện tích chả hạn, phải là tích phân....
-
Channel: Nguồn!
08-05-2026, 10:49 -

Comment