电子实时时钟,请高手帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/05 00:30:24
功能要求:
(1) 显示准确的北京时间(时、分、秒),可用24小时制式;
(2) 随时可以调校时间。
(3) 增加公历日期显示功能(年、月、日),年号只显示最后两位;
(4) 随时可以调校年、月、日;
(5) 允许通过转换功能键转换显示时间或日期。
发挥部分:
(1) 增加闹钟
(2) 减少按键个数
使用 AT89S52芯片

代码:
trans macro
mov ah,al
and ah,0f0h
shr ah,1
shr ah,1
shr ah,1
shr ah,1
or ah,30h
mov [bx],ah
and al,0fh
or al,30h
inc bx
mov [bx],al
endm
trans1 macro
mov bh,[si]
inc si
mov bl,[si]
and bl,0fh
shl bh,1
shl bh,1
shl bh,1
shl bh,1
or bl,bh
endm
data segment
buffer1 db 9
buffer2 db ?
buffer3 db 10 dup(0),'$'
cool db 0
it db ?
temp1 db 0
temp2 db 0
temp3 db 0
data ends

code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov dl,':'
mov ah,02h
int 21