專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命
提供開發(fā)工具、應(yīng)用測試 完善的開發(fā)代碼案例庫分享
從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無限潛能!
一款摩托車防盜器資料 警報(bào)發(fā)聲模塊原代碼
注:警報(bào)音頻率為1.8K到3.5K之間,具體請查資料
OSCILLATION:R/C =晶振 CLOCK = 2
Frequency =4MHZ
;=================================================================*/
Fre_COUNT EQU 0X37 ;'聲音頻率變化計(jì)數(shù)器,從1.8~3.55KHZ
Fre_Repeat EQU 0x38 ;'同一頻率的重復(fù)次數(shù)
SOUND_TEMP EQU 0X39
;'Replace program variable value and debug is more than easy.
S_Loop EQU 67 ;'MAX-MIN
S_MAX EQU 138
S_MIN EQU 71
S_Repeat EQU 4
;開始0.2秒發(fā)音
SOUND200ms:
SOUND_LH: ;1.8~3.55
MOV A,@S_Loop ;66=134-68
MOV Fre_COUNT,A
SOUND_LH_LP:
MOV A,@S_Repeat ;
MOV Fre_Repeat,A
MOV A,Fre_COUNT
ADD A,@S_MIN ;
repeat0_lp BS PORT6,BUZ
CALL SOUNDDELAY0
BC PORT6,BUZ
CALL SOUNDDELAY0
DJZ Fre_Repeat
JMP repeat0_lp
DJZ Fre_COUNT
JMP SOUND_LH_LP
SOUND_HL: ;3.55~1.8
MOV A,@S_Loop ;66=134-68
MOV Fre_COUNT,A
SOUND_HL_LP:
MOV A,@S_Repeat ;
MOV Fre_Repeat,A
MOV A,Fre_COUNT
SUB A,@S_MAX ;
repeat1_lp BS PORT6,BUZ
CALL SOUNDDELAY0
BC PORT6,BUZ
CALL SOUNDDELAY0
DJZ Fre_Repeat
JMP repeat1_lp
DJZ Fre_COUNT
JMP SOUND_HL_LP
SOUND_END: ;
RET
;**********************************************************
Sound2s: ;2S內(nèi)短鳴兩聲
WARNING1:
CALL Sound200ms
CALL Delay800ms
CALL Sound200ms
CALL Delay800ms
RET
Delay800ms:
CLR TIME1 ;'get ready for 0.8 second delay.
Sound_delay MOV A,@196 ;'delay 0.8 second
SUB A,TIME1
JBS R3,0
JMP Sound_delay
RET
;************************************************
Sound15s: ;連續(xù)報(bào)警15S
WARNING2:
MOV A,@73
MOV SOUND_TEMP,A
Sound1s_lp CALL Sound200ms
JBC PORT6,SDT ;'SDT上電立即中斷報(bào)警
RET
DJZ SOUND_TEMP
JMP Sound1s_lp
RET
;============================
SOUNDDELAY1 EQU 0X3A
sounddelay:
mov a,@18 ;
sounddelay0 mov sounddelay1,a ;=(A*9)+3
wdtc
sounddelayus_1:
nop
nop
nop
nop
nop
nop
djz sounddelay1
jmp sounddelayus_1
ret