?? sp200.asm
字號:
mov R_TempA,a ;save acc
mov a,status ;save status flag
mov R_status,a
set flag_set_exit
clr flag_store
clr flag_endring_T ;clear end ring flag
clr flag_endringadd_T ; add 255
clr R_endring_T ;clear end ring count
clr PFDC.4 ;disable PFD output
clr dtmfc ; stop dial
set D_PWDN
clr Flag_first_ring ;clear finish active first ring flag
sz dialerio.1 ;test HFO
jmp L_phone_is_using_notclear ;hand free ,hfo=1
; clr dialerio.1
sz dialerio.4 ;test hook switch
jmp L_phone_not_use
jmp L_phone_is_using_notclear ;po=1
L_phone_not_use: ;on hook status
clr flag_first_memory
sz flag_dial_pause
set R_Redial_count
clr flag_dial_pause ;11/4 debug add
clr flag_dial_pause1
clr flag_pause_between
sz flag_save_over32
clr R_dial_code_buffer
clr flag_first_pause ;10/17
sz flag_pause_between
jmp L_clear_dadfadfasfa
mov a,R_dial_code_buffer
mov R_dial_count_p,a ;debug add 10/9
L_clear_dadfadfasfa:
sz flag_pause_between
set flag_pause_hook_on ;11/4
clr flag_pause_between
sz headset_countral ;9/11 debug add
jmp L_exit_test_phone ;headset use
set flag_onhook_T ;set on hook flag !
clr R_onhook_T
set [16h].6 ;disable mute
clr R_flag
clr R_flash_time
snz flag_store
clr pd.0
jmp L_exit_test_phone
L_phone_is_using_notclear: ;off hook status
;//// wake up from here,than enter green mode
set [16h].6 ;11/10 add ;disable mute
clr flag_save_over32 ;9/11
set [16h].7 ;off mute XMute pin =0
snz flag_store
clr pd.0
set flag_hook_status_change
clr [22h].7 ;linec
set [16h].5 ;turn on po
clr flag_onhook_T ;clear onhook flag
clr R_onhook_T ;clear onhook counting
clr pd.1 ;disable earphone function
clr flag_headset
clr R_key_hold
set Flag_phone_use
clr flag_line_hold
L_exit_test_phone:
; nop
mov a,R_status
mov status,a ;back up status flag
mov a,R_TempA ;back up acc
reti
;----------------------------------------------------------------
;----------------------------------------------------------------
; Function: scan routine
; output : R_key_value
;----------------------------------------------------------------
org 500h ;Key code table
;// the next is SP400 key configure ///
dc 0 ;not key press value is '0'
dc 33,34,35,16 ;c0
dc 1, 2, 3, 14 ;c1
dc 4, 5, 6, 32 ;c2
dc 7, 8, 9, 38 ;13 ;c3
dc 10,11,12,13 ;c4
dc 17,18,19,20 ;c5
dc 21,22,23,24 ;c6
dc 25,26,15, 0 ;c7
dc 0, 0, 36, 28 ;c8
dc 0, 27, 37, 0 ;c9
; dc 0, 27, 28, 37 ;c9
;----------- key panel -----------------------------------------
; R0 R1 R2 R3
;C0 Mute Vup Vdown M0
;C1 1 2 3 Flash
;C2 4 5 6 Store
;C3 7 8 9 Redial
;C4 * 0 # Pause
;C5 M1 M2 M3 M4
;C6 M5 M6 M7 M8
;C7 M9 M10 DISC NOT
;C8 not Not HeadSET M12 ;Not
;C9 not VoiceMailHold not
;----------------------------------------------------------------
; Function: portA0 ~ portA4 pull High input
; portE0 ~ portE3 CMOS output ,output Low scan
;----------------------------------------------------------------
F_key_Scan:
F_key_Scan_in_setting:
mov a,0
mov pE,a ;port D low 4 bit output '0'
CALL NOP4T ;Wait I/O stable
CALL NOP4T ;Wait I/O stable
mov a,pa
nop
and a,01fh
mov R_Temp1,a
xor a,01fh
sz acc ;have key press?
jmp L_Have_Key_press
clr R_Key_Hold ;not key press clear the key hold
clr R_key_value
clr R_hold_time_setR
clr flag_on_ring
ret ;not key press exit key scan
L_Have_Key_press:
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
call F_delay ;debounce
mov a,pa
nop
and a,01fh
xor a,R_Temp1
sz acc ;have key press?
jmp L_new_old_value_not_equal
jmp L_debounce_ok
L_new_old_value_not_equal:
; clr R_Key_Hold ;not key press clear the key hold
clr R_key_value
ret ;not key press exit key scan
L_debounce_ok:
mov a,00001110b
mov pe,a ;portD bit0 scan 1line output '0'
call nop4t ;wait I/O stable
call nop4t ;wait I/O stable
mov a,pa
; nop
and a,1fh
mov R_Temp1,a
xor a,1fH
sz acc
jmp L_1Line_Key_Press
;//////////////////////
mov a,00001101b
mov pe,a ;portD bit1 scan 2line output '0'
call nop4t ;wait I/O stable
call nop4t ;wait I/O stable
mov a,pa
; nop
and a,1fh
mov R_Temp1,a
xor a,1fH
sz acc
jmp L_2Line_Key_Press
;//////////////////////
mov a,00001011b
mov pe,a ;portD bit2 scan 3line output '0'
call nop4t ;wait I/O stable
call nop4t ;wait I/O stable
mov a,pa
; nop
nop
and a,1fH
mov R_Temp1,a
xor a,1fH
sz acc
jmp L_3Line_Key_Press
;//////////////////////
mov a,00000111b
mov pe,a ;portD bit3 scan 4line output '0'
call nop4t ;wait I/O stable
call nop4t ;wait I/O stable
mov a,pa
; nop
and a,1fh
mov R_Temp1,a
xor a,1fH
sz acc
jmp L_4Line_Key_Press
ret ;complete scan 4line not key press exit
;////////////////////////
L_1Line_Key_Press:
call F_test_bit_com
jmp L_code0
;_________________________________________________________
L_2Line_Key_Press:
call F_test_bit_com
jmp L_code1
;_________________________________________________________
L_3Line_Key_Press:
call F_test_bit_com
jmp L_code2
;_________________________________________________________
L_4Line_Key_Press:
call F_test_bit_com
jmp L_code3
;_________________________________________________________
;;//////////////////
L_code0:
mov a,1
add a,R_H
jmp L_Read_Table
L_code1:
mov a,2
add a,R_H
jmp L_Read_Table
L_code2:
mov a,3
add a,R_H
jmp L_Read_Table
L_code3:
mov a,4
add a,R_H
; jmp L_Read_Table
;///////////
L_Read_Table:
mov tblp,a
tabrdc R_Key_Value
sz R_Key_Hold
jmp L_key_Hold_invalid
mov a,R_Key_Value
mov R_Key_Hold,a
;/// debug add 12/14
mov a,37
xor a,R_key_value
sz acc
ret
sz pa.6
jmp L_is_hold_fuck
;// is Memory
mov a,28
mov R_key_value,a
ret
L_is_hold_fuck:
mov a,37
mov R_key_value,a
;/// debug add 12/14
ret
L_key_Hold_invalid:
clr R_Key_Value
mov a,3
sub a,R_hold_time_setR ;R_dial_code_buffer
snz c
jmp L_hold_large4
;/// dial count <= 4
ret
L_hold_large4:
clr R_hold_time_setR
mov a,R_key_hold
xor a,D_Vup
sz acc
jmp L_test_Vdown
clr flag_off_ring
sz flag_phone_use
ret
sz flag_on_ring
ret
MOV A,D_Vup
MOV R_key_value,A
CLR R_KEY_hold
set flag_on_ring
ret
L_test_Vdown:
mov a,R_key_hold
xor a,D_Vdown
sz acc
ret
set flag_off_ring
clr PFDC.4 ;disable PFD output
ret
;----------------------------------------------------------------
F_delay: ;delay
mov a,0ffh
mov R_Debounce,a
d1:
sdz R_Debounce
jmp d1
inc R_Debounce ;0ffh --> R_Debounce
d2:
sdz R_Debounce
jmp d2
ret
;----------------------------------------------------------------
; Function: dial code 1,2,3,4,5,6,7,8,9,*,0,#
; parameter: dial code in --> R_key_value
;----------------------------------------------------------------
F_Dial_code:
mov a,12
sub a,R_key_value
snz c
ret ;not dial code number exit
;/// <=12
mov a,R_Key_Value
sz acc
jmp L_dial_dial ;Aug/7 debug add
ret
L_dial_dial:
mov R_Dial_Code,a
dec R_Dial_Code
call F_Start_Dial_up
ret
;;;-------------------------------------------------------
F_dial_pause:
set flag_dial_pause
set flag_dial_pause1 ;use real time count
clr flag_dial_pause2 ;use 5ms count unit
snz flag_first_dial ;;;;
set flag_first_pause ;10/17 night
set flag_pause_between ;pause between dial code
mov a,R_dial_code_buffer
mov R_dial_count_p,a ;back up the code number
clr [16h].7 ;10/12
call F_turn_on_real_time
mov a,R_pause_time
swap acc
and a,0fh
mov R_Hold_time,a
;use real time count !!!
; clr R_key_value ;24/24
ret
;-----------------------------------------------------------
F_delay_500ms: ;wait stable
; mov a,100 ;0.1s
; mov R_Time_count_L,a
; clr R_Time_count_h
; set Flag_counting
; call F_turn_on_time1
;F_wait_time_500_1:
; sz Flag_counting
; jmp F_wait_time_500_1
; ret
;
;-----------------------------------------------------------
F_delay_200ms: ;wait stable
mov a,100 ;0.1s
mov R_Time_count_L,a
clr R_Time_count_h
set Flag_counting
call F_turn_on_time1
F_wait_time_200_1:
sz Flag_counting
jmp F_wait_time_200_1
ret
;------------------------------------------------------------------
F_Real_time_INT:
mov R_TempA,a ;save acc
mov a,status
mov R_status,a ;save status falg
sz R_ring_ajust
dec R_ring_ajust ;12/5 debug add
sz R_ring_timea
dec R_ring_timea
sz R_Hold_time_set
dec R_Hold_time_set
inc R_Hold_time_setR
sz R_Hold_time ;count hold time
dec R_Hold_time
sz flag_onhook_T
inc R_onhook_T
snz flag_endring_T
jmp L_not_inc_endringcount
inc R_endring_T
sz R_endring_T
jmp L_not_set_255flag
set flag_endringadd_T
L_not_set_255flag:
L_not_inc_endringcount:
mov a,R_status
mov status,a ;back up status flag
mov a,R_TempA ;back up acc
reti
;------------------------------------------------------------------
;;------------------------------------------------
org 600h ;DTMF code
dc 00010001b ; '1'
dc 00010010b ; '2'
dc 00010100b ; '3'
dc 00100001b ; '4'
dc 00100010b ; '5'
dc 00100100b ; '6'
dc 01000001b ; '7'
dc 01000010b ; '8'
dc 01000100b ; '9'
dc 10000001b ; '*'
dc 10000010b ; '0'
dc 10000100b ; '#'
;----------------------------------------------------------------
; Function : Start Dial up
; input : Dial code --> R_Dial_Code
; output : DTMF pin output corresponding DTMF tone
;----------------------------------------------------------------
F_Start_Dial_up:
clr [16h].7 ;XMute pin =0
mov a,R_Dial_Code
mov tblp,a
tabrdc DTMFD
mov a,00000100b
mov DTMFC,a
mov a,14 ;25 ;19 ;dial 100ms
mov R_Time_count_L,a
clr R_Time_count_H
set Flag_counting
call F_turn_on_time1
ret
;----------------------------------------------------------------
F_Start_Dial_up_R:
clr [16h].7 ;XMute pin =0
mov a,R_Dial_Code
mov tblp,a
tabrdc DTMFD
mov a,00000100b
mov DTMFC,a
ret
;----------------------------------------------------------------
; Function : stop Dial code
;----------------------------------------------------------------
F_Stop_Dial:
sz R_Key_Hold ;test key
ret ;key hold not stop dial
sz Flag_counting
ret
clr flag_dialing
snz flag_pause_between ;10/12
set [16h].7 ;xmute pin floating !!!
set D_PWDN ;count end stop dial
ret
;----------------------------------------------------------------
F_turn_on_time1: ;5ms /1ms interrupt
mov a,5bh ;5ch ;0deh
mov tmr1L,a
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -