用AT89C51制作八位數(shù)字頻率計源程序
ORG????? 00H?????????????? ;指定下條指令的地址
AJMP???? MAIN????????????? ;跳轉(zhuǎn)至MAIN
50M
??????? INC????? 23H
??????? RETI
??????? ORG????? 001BH????????????? ;定時器T1中斷入口,T1作定時,T0作計數(shù)
??????? PUSH???? A????????????????? ;累加器A壓入堆棧
?????? ?PUSH???? PSW??????????????? ;狀態(tài)寄存器壓入堆棧
??????? DJNZ???? 40H,JJ??????????? ;產(chǎn)生1s定時時標(biāo)
??????? MOV????? 40H,#0C8H
??????? DJNZ???? 41H,JJ
??????? CLR????? P3.1?????????????? ;關(guān)閉閘門
??????? ANL????? 88H,#0AFH???????? ;1s末,關(guān)閉T0和T1
??????? MOV????? 20H,P1
????? ??MOV????? 21H,TL0?????????? ;T0計數(shù)值送21H和22H
? MOV????? 22H,TH0
? SETB???? P3.0?????????????? ;LS393清零
? ACALL??? COUNT??????????? ;調(diào)用二進制轉(zhuǎn)BCD碼程序
JJ:??? POP????? PSW
??????? POP????? A
??????? RETI
??????? ORG????? 50H??????????????? ;以下程序從地址50H開始
MAIN:? MOV????? SP,#50H?????????? ;將初始值賦予SP
MOV????? TH1,#06H????????? ;將初始值賦予TH0
非常好我支持^.^
(2) 100%
不好我反對
(0) 0%