?? ht9200a.asm
字號:
;HT9200A驅動程序
;
entone equ 2 ;rc HT9200A使能,低有效
tonedat equ 1 ;rc HT9200A數據端
toneclk equ 0 ;rc HT9200A時鐘端,下降沿鎖存數據
;
temp0 equ 70h
temp1 equ 71h
temp2 equ 72h
temp3 equ 73h
temp4 equ 74h
temp5 equ 75h
temp6 equ 76h
temp7 equ 77h
;----------------------------------------------------------
org 000h
goto main_program
;--------------------------------------------------------
; the son-program area
;--------------------------------------------------------
org 005h
;--------------------------------------------------------
;-----------------------------
delay_200ms
movlw .200
movwf temp6
goto delay_public
delay_100ms
movlw .100
movwf temp6
goto delay_public
delay_40ms
movlw .40
movwf temp6
goto delay_public
delay_30ms
movlw .30
movwf temp6
goto delay_public
delay_10ms
movlw .10
movwf temp6
goto delay_public
delay_6ms
movlw .6
movwf temp6
goto delay_public
delay_1ms
movlw .1
movwf temp6
delay_public
movlw .223
movwf temp7
public_2
clrwdt
decfsz temp7,1
goto public_2
decfsz temp6,1
goto delay_public
return
;-----------------------------
;-----------------------------
dialout
nop
movlw .5 ;bit0~bit4 total 5bit∕﹚ 0~abcd
movwf temp2
dialout_1
bsf rc,tonedat
btfss temp1,0
bcf rc,tonedat
nop
nop
nop
nop
bcf rc,toneclk
nop
nop
nop
nop
nop
nop
bsf rc,toneclk
nop
nop
clrc
rrf temp1,1
decfsz temp2,1
goto dialout_1
return
;*********************************************
;
dial
bcf rc,entone
call delay_200ms
movlw 40h
movwf f4
dial_1
movf f0,w
movwf temp0
skpnz
goto loop_1
movlw 0dh ;delay
clrz
xorwf temp0,w
skpz
goto dial_2
incf f4
bsf f3,5
movlw 0eh
movwf 81h
bcf f3,5 ;1.25s
clrf intcon
sleep
bsf f3,5
movlw 0fh
movwf 81h
bcf f3,5 ;2.5s
clrf intcon
sleep
call delay_100ms
goto dial_1
;
dial_2
movf temp0,w
movwf temp1
call dialout
call delay_100ms
movlw 1fh
movwf temp1
call dialout
movf temp0,w
movlw 0ch ;#
clrz
xorwf temp0,w
skpnz
goto dial_3
call delay_100ms
incf f4
goto dial_1
dial_3
bsf f3,5
movlw 0eh
movwf 81h
bcf f3,5 ;1.25s
clrf intcon
sleep
call delay_100ms
incf f4
goto dial_1
;
bsf rc,entone
return
;-----------------------------
; the mainprogram area
;-----------------------------
main_program
bsf f3,5
movlw 0fh
movwf 81h
movlw 00h
movwf trisc
bcf f3,5 ;bank 0
movlw 0ffh
movwf rc
reset_delay
movlw 20h
movwf f4
next
clrf f0
incf f4,1
movlw 80h ;clr 20h--7fh ram
clrz
xorwf f4,w
skpz
goto next
;
clrf intcon
;
movlw 0ah
movwf 40h
movwf 4ah
movlw 03h
movwf 41h
movlw 07h
movwf 42h
movlw 09h
movwf 43h
movwf 48h
movlw 0dh
movwf 44h
movlw 03h
movwf 45h
movwf 46h
movlw 01h
movwf 47h
movlw 06h
movwf 49h
movlw 02h
movwf 4bh
movlw 0ch
movwf 4ch
;
call dial
;
loop
call delay_100ms
goto loop
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -