⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp200.asm

📁 合泰MCU写的电话机源程序
💻 ASM
📖 第 1 页 / 共 5 页
字号:
	set		[16h].5             ;on po

	SZ		flag_earphone
	set		pd.1
	clr		flag_earphone

	jmp		L_Main_exit
;	jmp		L_not_first_dial         ;save in dial buffer
;;----------------------------------------------------------------
L_is_15:         ;/// Disc key
	clr		flag_store         ;qpj 10/9 add 
	set		pdc.2           ;set pd.2 as input
	call	nop4t			;wait port stable 
	snz		pd.2            ;have power=H
	jmp		L_Main_exit

	snz		flag_phone_use   ;[16h].5
	jmp		L_Main_exit

;	snz		flag_save_over32
;	set		flag_flash


	mov		a,31
	sub		a,R_dial_code_buffer
	snz		c
	jmp		jkpldssad
;	jmp		L_save_over32               		
	;///  dial count <= 32	

	sz		R_dial_code_buffer
	set		flag_flash
	set		flag_disc
jkpldssad:



L_save_over32_can_notredial_1:
;	sz		flag_store
;	jmp		L_is_in_store_operating         ;10/9 debug skip		

;	snz		[16h].6           ;test SDNPO
;	jmp		L_clear_this_bit_active_mute
;	;/// inactive mute 
	set		[16h].6            ;10/12
;	jmp		L_Main_exit
;L_clear_this_bit_active_mute:
;	clr		[16h].6

	
	sz		pd.1
	SET		flag_earphone

	SZ		flag_earphone
	clr		pd.1
;	clr		Flag_first_dial         ;add add
	clr		[16h].5             ;off po
	clr		[16h].7           ;XMute pin =0 

	call	F_dial_disc         ;F_dial_flash
	set		[16h].7           ;XMute pin =1 

	set		[16h].5             ;on po

	SZ		flag_earphone
	set		pd.1
	clr		flag_earphone

	mov		a,R_dial_code_buffer    
	mov		R_dial_count_p,a       ;debug add 10/9      

	jmp		L_Main_exit

;	jmp		L_not_first_dial         ;save in dial buffer
;;----------------------------------------------------------------
	;///  16<= key value <=31  
L_is_Memorykey:
;	set		pbc.6           ;set pb.6 as input
;	nop
;	nop
;	snz		pb.6            ;ring signal coming	pb.6=L
;	jmp		L_Main_exit     ;ringing not process memory key
;	sz		flag_line_hold

	snz		flag_phone_use
	jmp		L_Main_exit       ;200/300 add 


	sz		flag_dial_pause
	jmp		L_Main_exit     ;11/9 ,between dial pause exit
	
	set		pbc.7
	call	nop4t
	snz		pb.7
	jmp		L_Main_exit     ;9/7 debug add hold cannot dial
L_is_using_can_save_dial:   ;memory key 
;	clr		pbc.7
;	sz		pb.7
;	set		[16h].5             ;turn on po 

	mov		a,30
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_large30
	;/// M0 -- M14  save in EEPROM page 0 15numbers
	;/// R_key_Value  , 16 <= & <=30 ; M1 ~ M15

	set		pdc.2
	call	nop4t
	sz		pd.2         ;have power H		
	jmp		L_have_power_run_continue1
	;// no power	
	snz		flag_phone_use
	jmp		L_Main_exit     ;fuck fuck

	call	F_turn_on_3_58MHz
	
L_have_power_run_continue1:
	mov		a,R_Key_Value
	sub		a,16

	mov		R_temp1,a           ;save it for test voice mail key use
								; A*17
	and		a,0fh               ;why A*17 ? because save one tel number
	mov		R_Key_Value,a       ;use 17bytes ,the first is save the tel 
	swap	R_Key_Value         ;number quantity
	or		A,R_Key_Value       ;here,a is the eeprom address 
	mov		R_key_value,a       ;!!!!

	sz		Flag_store
	jmp		L_store_fuck1
	jmp		L_Get_data_from_ee_and_dial_014
L_store_fuck1:	
	sz		R_store_code              ;test store quantity
	jmp		L_store_fuck1_real
	jmp		L_dele_memoryM0_M14       ;R_store_code=0 ,dele EEPROM data
L_store_fuck1_real:
	snz		Flag_store_over
	jmp		L_store_not_large32M14
	call	F_Fail_sound             ;over 32 not save exit
	clr		Flag_store_over          ;clear the store over flag
	clr		R_store_code             ;clear store count
	jmp		L_Main_exit

L_store_not_large32M14:
	mov		a,R_key_value             ;back feed the eeprom address
	mov		R_WR_EE_address,a

	mov		a,offset L_EE_count_Number
	add		a,R_store_code  ;get the tel number quantity
	mov		tblp,a
	tabrdl	acc

	mov		R_EE_Byte_count,a
	mov		a,offset R_store_code  ;get the indirect address
	mov		mp0,a
	mov		a,0a0h                 ;operating eeprom bank0
	mov		R_EE_bank,a
	call	F_Write_EE_Byte
	clr		R_store_code          ;clear the store count

 	call	F_finish_sound
	jmp		L_Main_exit
L_is_large30:
	;///R_key_value=31 , M16 is voice mail, save in EEPROM page 1

	sz		Flag_store
	jmp		L_store_fuck2
	jmp		L_Get_data_from_ee_and_dial_15
L_store_fuck2:	
	sz		R_store_code
	jmp		L_store_fuck2_real
	jmp		L_dele_memoryM15       ;R_store_code=0 ,dele EEPROM data
L_store_fuck2_real:
	snz		Flag_store_over
	jmp		L_store_not_large32M15
	call	F_Fail_sound             ;over 32 not save exit
	clr		Flag_store_over          ;clear the store over flag
	clr		R_store_code             ;clear store count
	jmp		L_Main_exit
L_store_not_large32M15:
	mov		a,0                    ;store in eeprom bank1
	mov		R_WR_EE_address,a

	mov		a,offset L_EE_count_Number
	add		a,R_store_code  ;get the tel number quantity
	mov		tblp,a
	tabrdl	acc

	mov		R_EE_Byte_count,a
	mov		a,offset R_store_code  ;get the indirect address
	mov		mp0,a
	mov		a,0a2h                 ;operating eeprom bank1
	mov		R_EE_bank,a
	call	F_Write_EE_Byte
	clr		R_store_code          ;clear the store count

 	call	F_finish_sound

	jmp		L_Main_exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

L_dele_memoryM0_M14:

	mov		a,R_key_value
	mov		R_WR_EE_address,a
	mov		a,1                    ;write 1 byte
	mov		R_EE_Byte_count,a
	clr		R_temp1                ;write 0
	mov		a,offset R_temp1       ;get the indirect address
	mov		mp0,a

	mov		a,0a0h                 ;operating eeprom bank0
	mov		R_EE_bank,a

	call	F_Write_EE_Byte
 	call	F_finish_sound
	jmp		L_Main_exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

L_dele_memoryM15:             ;viocemail number save in bank1

	mov		a,0                   ;R_key_value
	mov		R_WR_EE_address,a
	mov		a,1                    ;write 1 byte
	mov		R_EE_Byte_count,a
	clr		R_temp1                ;write 0
	mov		a,offset R_temp1       ;get the indirect address
	mov		mp0,a

	mov		a,0a2h                 ;operating eeprom bank1
	mov		R_EE_bank,a

	call	F_Write_EE_Byte
 	call	F_finish_sound

	jmp		L_Main_exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

L_Get_data_from_ee_and_dial_014:     ;get data from ee bank0
;	mov		a,11
;	xor		a,R_temp1          ;test if is message key press?
;	sz		acc
;	jmp		L_isnot_voice_mail_number		
;	clr		flag_message
;	clr		pb.5
;L_isnot_voice_mail_number:

	mov		a,R_key_value            ;EEPROM address
	mov		R_WR_EE_address,a
	mov		a,1
	mov		R_EE_Byte_count,a
	mov		a,0a0h
	mov		R_EE_bank,a
	mov		a,offset R_store_code
	mov		mp0,a
	call	F_Read_EE_Byte
	sz		R_store_code
	jmp		L_memory_have_code_can_read
	jmp		L_Main_exit                 ;memory not code exit
L_memory_have_code_can_read:

	sz		Flag_phone_use            ;test phone using ?
	jmp		L_is_using_can_save_dial11  ;po on can save
;	jmp		L_Main_exit               ;on hook cann't dial & save, exit
;/// auto handfree function /// 
	clr		pbc.3
;	nop
	nop
	set		pD.3       ;
	call	F_wait_time_100ms        ;auto handfree function
	clr		pd.3
	call	F_wait_time_1s           ;wait stable

L_is_using_can_save_dial11:         ;kill

	call	nop4t
;///////////////////////////////

	mov		a,R_key_value            ;EEPROM address
	mov		R_WR_EE_address,a
	mov		a,offset L_EE_count_Number
	add		a,R_store_code           ;get the tel number quantity
	mov		tblp,a
	tabrdl	acc

	mov		R_EE_Byte_count,a
	mov		a,0a0h
	mov		R_EE_bank,a
	mov		a,offset R_store_code      ;+1
	mov		mp0,a
	call	F_Read_EE_Byte
	call	F_store_number_code_in_dial_buffer

	call	F_dial_memory
	jmp		L_Main_exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

L_Get_data_from_ee_and_dial_15:     ;get data from ee bank1

	clr		R_WR_EE_address
	mov		a,1
	mov		R_EE_Byte_count,a
	mov		a,0a2h
	mov		R_EE_bank,a
	mov		a,offset R_store_code
	mov		mp0,a
	call	F_Read_EE_Byte
	
	sz		R_store_code
	jmp		L_memory_have_code_can_read1
	jmp		L_Main_exit                 ;memory not code exit
L_memory_have_code_can_read1:

	sz		Flag_phone_use            ;test phone using ?
	jmp		L_is_using_can_save_dial22  ;po on can save
;	jmp		L_Main_exit               ;on hook cann't dial & save, exit
;/// auto handfree function /// 
	clr		pbc.3
	nop
	nop
	set		pD.3       ;
	call	F_wait_time_100ms        ;auto handfree function
	clr		pd.3
	call	F_wait_time_1s           ;wait stable

L_is_using_can_save_dial22:



	clr		R_WR_EE_address

	mov		a,offset L_EE_count_Number
	add		a,R_store_code  ;get the tel number quantity
	mov		tblp,a
	tabrdl	acc

	mov		R_EE_Byte_count,a
	mov		a,0a2h
	mov		R_EE_bank,a
	mov		a,offset R_store_code      ;+1
	mov		mp0,a
	call	F_Read_EE_Byte
	call	F_store_number_code_in_dial_buffer

	call	F_dial_memory
	jmp		L_Main_exit
;;----------------------------------------------------------------
	;/// key value >=32	
L_is_Functionkey:
	mov		a,37                
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_38key
	;/// <=37
	mov		a,36                
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_37key
	;/// <=36
	mov		a,35                
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_36key
	;/// <=35
	mov		a,34                
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_35key
	;/// <=34
	mov		a,33                
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_34key
	;/// <=33
	mov		a,32                
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_33key
	;/// <=32

;	mov		a,31                
;	sub		a,R_Key_Value
;	snz		c
;	jmp		L_is_32key
;	;/// <=31
;	mov		a,30                
;	sub		a,R_Key_Value
;	snz		c
;	jmp		L_is_31key
;;----------------------------------------------------------------
L_is_32key:                   ;store key
	sz		Flag_phone_use        ;test phone using ?
	jmp		L_is_using_can_set_store       ;po on can dial
	jmp		L_Main_exit
	set		pdc.2
	call	nop4t
	snz		pd.2            ;have power=H
	jmp		L_no_power_phone_use?      ;no power exit 
	jmp		L_is_using_can_set_store
L_no_power_phone_use?:
	sz		Flag_phone_use        ;test phone using ?
	jmp		L_is_using_can_set_store       ;po on can dial
	jmp		L_Main_exit

L_is_using_can_set_store:
	set		Flag_store          ;set store flag
	clr		R_store_code		;clear store_code count
	call	F_set_sound       ;when enter number code clear the flag
	clr		Flag_store_over   ;clear store over flag

	set		Flag_flash_save   ;set store key hold count flag 
;	clr		Flag_store_press  ;!!!!!!!

	;//  start process store key // 
	
;	mov		a,2
;	mov	    R_Hold_time,a
;	call	F_turn_on_real_time
;L_Check_store_key_hold2S:
;	call	F_Turn_off_PFD   ;Flag_counting=0 stop pfd   
;	call	F_key_Scan_in_setting  ;F_key_scan
;	sz		R_key_hold
;	jmp		L_storekey_holding
;	jmp		L_Main_exit      ;store key hold less than 2s exit        
;L_storekey_holding:
;	sz		R_Hold_time
;	jmp		L_Check_store_key_hold2S

;L_wait_key_open: 	
;	call	F_Turn_off_PFD   ;Flag_counting=0 stop pfd   
;	nop
;	call	F_key_Scan_in_setting    ;F_key_scan

;	sz		R_key_hold
;	jmp		L_wait_key_open          ;9/20 debug qpj

    ;// store key hold 2s ok // 
	clr		R_key_value
	mov		a,10
	mov	    R_Hold_time,a
	call	F_turn_on_real_time
L_waiting4S_1:
	call	F_key_Scan_in_setting  ;F_key_scan             ;test * key press

	call	F_delay     ;debounce

	sz		R_key_value
	jmp		L_starkey_press?
;	jmp		L_star_key_not_press_wait4S

;L_star_key_not_press_wait4S:
	sz		R_Hold_time
	jmp		L_waiting4S_1
	clr		flag_store
	jmp		L_Main_exit
L_starkey_press?:
	mov		a,R_key_value
	xor		a,D_star_key
	sz		acc
	jmp		L_process_key_buffer           ;is not star key press 

	;// star key press ok // 
	jmp		L_item1_setting        ;10/11 gai gai 

L_process_key_buffer:
	mov		a,R_key_value
	xor		a,D_number_key          ;D_star_key
	sz		acc
	jmp		L_process_key

	jmp		L_item2_setting

;	call	F_set_sound
;
;	mov		a,10
;	mov	    R_Hold_time,a
;	clr		R_key_value

;L_waiting4S_2:
;	call	F_Turn_off_PFD   ;Flag_counting=0 stop pfd   
;	call	F_key_Scan_in_setting  ;F_key_scan              ;test 1 ~ 8 number key

;	call	F_delay     ;debounce

;	sz		R_key_value
;	jmp		L_numberkey_press?

;	sz		R_Hold_time
;	jmp		L_waiting4S_2
;	clr		flag_store
;	jmp		L_Main_exit
;L_numberkey_press?:

	;// item key press ok // 

;	mov		a,3                
;	sub		a,R_Key_Value
;	snz		c
;	jmp		L_process_key         ;is not 1 ~ 8 number key 
	;/// <=4


;	mov		a,2
;	sub		a,R_key_value
;	snz		c
;	jmp		L_item4_setting
;	mov		a,1
;	sub		a,R_key_value
;	snz		c
;	jmp		L_item3_setting
;
;	jmp		L_item2_setting
;
;-----------------------------------------------
L_item1_setting:
   ;// item 1 setting //        flash time setting
	clr	    flag_set_exit
;;	set		pd.0

	call	F_set_sound
	clr		R_key_value

    F_item_set_commond          ;macro

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -