基于CH372的單片機(jī)波形采集程序
;*************************************
上位機(jī)軟件及pcb文件下載地址:http://www.51hei.com/bbs/dpj-19233-1.html
;STC89C51RC單片機(jī),6M晶振
;P0.7為紅外輸入
;P0.6為無線電信號(hào)輸入
;P0.5為外部信號(hào)輸入
;*************************************
CSEQUP0.0
A0EQUP0.1
DXEQUP0.3
CEEQUP0.4
GETEQUP0.2
ORG0000H
LJMPAMIT
ORG0030H
AMIT:MOVSP,#0FBH
MOVP0,#0FFH
MOVP1,#0FFH
MOVP2,#0FFH
MOVP3,#0FFH
MOVR0,#08H
MOVR7,#68
MOVR2,#00H
CLRP0.7
MOVTMOD,#01H
MOVTL0,#00H
MOVTH0,#00H
CLRTR0
;********CH372復(fù)位*********
FW:MOVA,#05H
MOVP2,A
CLRCS
SETBA0;寫復(fù)位命令
CLRDX
NOP
NOP;50NS就可以
SETBDX
LCALLDYL
JSCS:JBGET,$
MOVA,#22H;接受中斷數(shù)據(jù)
ACALLXML;調(diào)用CH372寫命令
ACALLDSJ;調(diào)用CH372讀數(shù)據(jù)
CJNEA,#01H,G1
AJMPOUT1
G1:CJNEA,#0F2H,G2
ACALLOUT2;如果CH372返回0F2則讀端口2的命令
AJMPCHKOF
G2:CJNEA,#0F5H,G3
AJMPPEND
G3:CJNEA,#0F6H,G4
AJMPLEEP
G4:CJNEA,#0F9H,G5
ACALLINO
AJMPJSCS
G5:CJNEA,#0FAH,JSCS
ACALLINO
AJMPJSCS
;*******采集子程序********
CHKOF:CJNEA,#0A1H,F1;捕獲輸入信號(hào)。
AJMPTIM
F1:CJNEA,#0A2H,F2;如果收到A2則復(fù)位主程序。
AJMPAMIT
F2:CJNEA,#0A3H,F3;紅外輸入。
AJMPHWX
F3:CJNEA,#0A4H,F4;無線電信號(hào)輸入。
AJMPWXD
F4:CJNEA,#0A5H,JSCS;外部信號(hào)輸入。
SETBP0.7
SETBP0.6
CLRP0.5
MOVR2,#02H
AJMPJSCS
HWX:SETBP0.5
SETBP0.6
CLRP0.7
MOVR2,#00H
AJMPJSCS
WXD:SETBP0.5
SETBP0.7
CLRP0.6
MOVR2,#01H
AML:AJMPJSCS
評(píng)論