統(tǒng)計(jì)單片機(jī)引腳輸入脈沖個(gè)數(shù),邊沿觸發(fā)編程
已知負(fù)跳邊脈沖從51單片機(jī)P3.3引腳輸入,且該脈沖數(shù)少于65535個(gè),試?yán)?INT1中斷,統(tǒng)計(jì)輸入脈沖個(gè)數(shù)。脈沖數(shù)存內(nèi)RAM30H(低位)31H(高位),并調(diào)用數(shù)據(jù)處理子程序WORK和顯示子程序DIR(已知,可直接調(diào)用)顯示,要求用邊沿觸發(fā)方式。
參考MCS-51單片機(jī)程序:
org 000h
ljmp main
org 013h
ljmp i_int1
org 050h
main: mov sp,#60h
mov tcon,#00000100b
mov ie,#10000100b
mov 30h,#0
mov 31h,#0
sjmp $
i_int1: mov a,#1
add a,30h
mov 30h,a
clr a
addc a,31h
mov 31h,a
acall work
acall dir
reti
work: ;
ret
dir: ;
ret
end