怎么用8253设计一个频率计
- 提问者网友:山高云阔
- 2021-05-03 14:08
- 五星知识达人网友:杯酒困英雄
- 2021-05-03 14:17
你可以参考一下这篇论文,就会明白了
《基于单片机C语言的数字频率计设计》
http://www.doc88.com/p-5750296720.html
- 1楼网友:青尢
- 2021-05-03 17:01
org 0000h ajmp start org 000bh reti org 001bh ajmp int_t1 org 0030h start:mov b,#0ffh mov tmod,#15h mov tl0,#0h mov th0,#0h mov tl1,#77h mov th1,#0ech call panduan setb tr0 setb et0 setb tr1 setb et1 setb ea sjmp $
int_t1: clr tr1 mov tl1,#77h mov th1,#0ech
djnz r0,exit call panduan mov r1,tl0 mov r2,th0 call dcdth call xianshi
mov 60h,#0ffh mov tl0,#00h mov th0,#00h exit: setb tr1 reti xianshi:clr p2.0 mov a,r6 anl a,#0fh call xianshi1 call del setb p2.0 clr p2.1 mov a,r6 swap a anl a,#0fh anl a,#0fh call xianshi1 call del setb p2.1 clr p2.2 mov a,r5 anl a,#0fh call xianshi1 call del setb p2.2 clr p2.3 mov a,r5 swap a anl a,#0fh call xianshi1 call del setb p2.3 clr p2.4 mov a,r4 anl a,#0fh call xianshi1 call del setb p2.4 clr p2.5 mov a,r4 swap a anl a,#0fh call xianshi1 call del setb p2.5 djnz b,xianshi mov b,#0ffh ret
xianshi1:mov dptr,#table movc a,@a+dptr mov p1,a ret dcdth:clr a mov r4,a mov r5,a mov r6,a mov r7,#16 loop:clr c mov a,r1 rlc a mov r1,a mov a,r2 rlc a mov r2,a mov a,r6 addc a,r6 da a mov r6,a mov a,r5 addc a,r5 da a mov r5,a mov a,r4 addc a,r4 da a mov r4,a djnz r7,loop ret Del: mov R3,#250 NOP Del2: DJNZ r3,DEL2 RET panduan:mov r0,#200 jb p0.0,hui call del call del mov r0,#20 hui: ret table:db 0fch ;0 db 60h ;1 db 0dah ;2 db 0f2h ;3 db 66h ;4 db 0b6h ;5 db 0beh ;6 db 0e0h ;7 db 0feh ;8 db 0f6h ;9 db 0eeh ;灭 end
- 2楼网友:归鹤鸣
- 2021-05-03 15:26
- 3楼网友:迷人又混蛋
- 2021-05-03 14:52
org 0000h ajmp start org 000bh reti org 001bh ajmp int_t1 org 0030h start:mov b,#0ffh mov tmod,#15h mov tl0,#0h mov th0,#0h mov tl1,#77h mov th1,#0ech call panduan setb tr0 setb et0 setb tr1 setb et1 setb ea sjmp $
int_t1: clr tr1 mov tl1,#77h mov th1,#0ech
djnz r0,exit call panduan mov r1,tl0 mov r2,th0 call dcdth call xianshi
mov 60h,#0ffh mov tl0,#00h mov th0,#00h exit: setb tr1 reti xianshi:clr p2.0 mov a,r6 anl a,#0fh call xianshi1 call del setb p2.0 clr p2.1 mov a,r6 swap a anl a,#0fh anl a,#0fh call xianshi1 call del setb p2.1 clr p2.2 mov a,r5 anl a,#0fh call xianshi1 call del setb p2.2 clr p2.3 mov a,r5 swap a anl a,#0fh call xianshi1 call del setb p2.3 clr p2.4 mov a,r4 anl a,#0fh call xianshi1 call del setb p2.4 clr p2.5 mov a,r4 swap a anl a,#0fh call xianshi1 call del setb p2.5 djnz b,xianshi mov b,#0ffh ret
xianshi1:mov dptr,#table movc a,@a+dptr mov p1,a ret dcdth:clr a mov r4,a mov r5,a mov r6,a mov r7,#16 loop:clr c mov a,r1 rlc a mov r1,a mov a,r2 rlc a mov r2,a mov a,r6 addc a,r6 da a mov r6,a mov a,r5 addc a,r5 da a mov r5,a mov a,r4 addc a,r4 da a mov r4,a djnz r7,loop ret Del: mov R3,#250 NOP Del2: DJNZ r3,DEL2 RET panduan:mov r0,#200 jb p0.0,hui call del call del mov r0,#20 hui: ret table:db 0fch ;0 db 60h ;1 db 0dah ;2 db 0f2h ;3 db 66h ;4 db 0b6h ;5 db 0beh ;6 db 0e0h ;7 db 0feh ;8 db 0f6h ;9 db 0eeh ;灭 end