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

📄 dial-08asm.asm

📁 DIAL-08.asm for burning 508a chips
💻 ASM
字号:
	;DIAL-08.asm for burning '508a chips 
	;            
	
	;Dialing Alarm

		;'508A  Files 
		;These files are common to both F84 and '508A chips
			;07h 
			;08h 
			;09h
			;0Ah 
			;0Bh 
			;0Ch 
			;0Dh 
			;0Eh loop file
			;0Fh 
			;10h jump file for tables
			;11h 
			;12h Count file
			;13h Carrier DTMF			
			;14h Low tone 
			;15h decrementable low tone
			;16h High tone 
			;17h decrementable high tone
			;18h 
			;19h delay routine
			;1Ah delay routines
			;1Bh delay routines
			;1Ch delay routines
			;1Dh File to ring second number
			;1Eh Ring numbers the second time
			;1Fh 
			


SetUp	MOVLW 08	;Put 0000 1000 into W
	TRIS 06	 	;Make GP3 input		
	CLRF 06         ;Clear port 6 of junk	
	BSF 01h,0	;Prescaler bit0
	BSF 01h,1	;Prescaler bit1
	BSF 01h,2	;Prescaler bit2  =  WDT x 128
	BSF 01h,3	;Prescaler assigned to WDT
	BSF 06,2	;Turn on turn-on cct
	NOP
	NOP
	BSF 06,0	;Turn off audio
	GOTO Main1

		



		;Table 1 for digits爋f YOUR two phone numbers
		

Table1	ADDWF 02,1	;File 02 = Low bits of program counter 
	RETLW 0Ah	;0	
	RETLW 02h 	; 
	RETLW 01h 	;
	RETLW 03h 	;
	RETLW 03h 	;
	RETLW 02h 	;
	RETLW 05h 	;
	RETLW 07h 	;
	RETLW 06h 	;  
	RETLW 08h 	;
	RETLW 0Eh 	;E = End of number
	RETLW 09h 	;
	RETLW 05h 	;
	RETLW 05h 	; 
	RETLW 08h 	;
	RETLW 08h 	;
	RETLW 08h 	;
	RETLW 08h 	;
	RETLW 08h 	;	
	RETLW 0Eh 	;E = End of number

	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh

	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh

	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh

	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh

	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh
	RETLW 0FFh

	
	;Table2 DTMF Low tones 

Table2	ADDWF 02,1	;File 02 = Low bits of program counter 
	NOP
	RETLW 075h 	;1 
	RETLW 075h 	;2
	RETLW 075h 	;3
	RETLW 06Bh 	;4
	RETLW 06Bh 	;5
	RETLW 06Bh 	;6
	RETLW 060h 	;7
	RETLW 060h 	;8  
	RETLW 060h 	;9
	RETLW 057h 	;0
	
	
	;Table3 DTMF HIGH tones 

Table3	ADDWF 02,1	;File 02 = Low bits of program counter 
	NOP
	RETLW 044h 	;1 
	RETLW 03Dh 	;2
	RETLW 037h 	;3
	RETLW 044h 	;4
	RETLW 03Dh 	;5
	RETLW 037h 	;6
	RETLW 044h 	;7
	RETLW 03Dh 	;8  
	RETLW 037h 	;9
	RETLW 03Dh 	;0


	;Short delay between tones approx 50mS

Del1	CLRWDT
	MOVLW 40h	;64 loops
	MOVWF 1B	;
Del1A	DECFSZ 1A,1	;Will produce 256 decrements
	GOTO Del1A
	DECFSZ 1B,1	;64 decrements of file 1B
	GOTO Del1A
	RETLW 00


	;General purpose Delay approx 0.7sec

Del2	MOVLW 03	
	MOVWF 19h	
Del2A	CLRWDT	
	DECFSZ 1A,1	;After one pass, files 1A, 1B will be
	GOTO Del2A	;256 and will produce the longest
	DECFSZ 1B,1	;delay-time.
	GOTO Del2A
	DECFSZ 19,1
	GOTO Del2A
	RETLW 00

Del3	MOVLW 0C	;Approx 5sec delay
	MOVWF 19h	;Delay file
Del3A	CLRWDT
	DECFSZ 1A,1
	GOTO Del3A
	DECFSZ 1B,1
	GOTO Del3A
	DECFSZ 19,1
	GOTO Del3A
	RETLW 00

	;DETECT detects any DTMF tone or whistle

Detect1	BSF 06h,0	;Turn off audio	
	CALL Del2	;Allow 1u electro to discharge 0.7sec
	CALL Del2	;Allow 1u electro to discharge 0.7sec	
	CLRF 12h	;Clear detect file
	BTFSS 06,3	;Input will be low when tone detected
	INCF 12h,1	
	BCF 06,0	;Turn on audio	
	RETLW 00



	;Dial1 dials the DTMF phone number
	;13h = carrier file
	;14h = low tone
	;15h = decrementable low tone
	;16h = high tone
	;17h = decrementable high tone
	

Dial1	MOVF 10h,0	;Put file 10h into W
	CALL Table1
	MOVWF 13h	;Put W into 13h - carrier
	MOVLW 0E	;Look for E - end of number
	XORWF 13h,0	;Is 13h = E?
	BTFSC 03,2
	RETLW 00
	MOVF 13h,0	;File 13h will be 1,2,3 ..0A
	CALL Table2	;Get low-tone value
	MOVWF 14h	;Put low-tone into 14h
	MOVWF 15h	;Decrementable low-tone
	MOVF 13h,0
	CALL Table3
	MOVWF 16h	;Put high-tone into 16h
	MOVWF 17h	;Decrementable high-tone
	CALL DTMF1
	CALL Del1		
	CALL Del1	;100mS delay between tones
	INCF 10h,1
	GOTO Dial1

	


DTMF1	MOVLW 80h	;80 loops of tone 
	MOVWF 11h	;   to produce 1/10th sec
DTMF2	DECFSZ 17h,1	;Decrement high-tone file
	GOTO DTMF3
	MOVLW 01h	;To toggle GP0	
	XORWF 06,1	;Toggle GP0
	MOVF 16h,0	;To re-load high-tone file
	MOVWF 17h	;Re-load high-tone file
DTMF3	DECFSZ 15h,1	;Decrement low-tone file
	GOTO DTMF2
	MOVLW 02h	;To toggle GP1
	XORWF 06,1	;Toggle GP1
	MOVF 14h,0	;To re-load low-tone file
	MOVWF 15h	;Re-load low-tone file
	DECFSZ 11h,1	;Decrement loops file
	GOTO DTMF2
	BSF 06,0	;Turn on output & audio off
	BCF 06,1	;Turn off output
	RETLW 00

	;Hee Haw produces alarm-sound

Hee	CLRWDT
	MOVLW 0FFh
	MOVWF 0Ch
Hee1	MOVLW 0C0h
	MOVWF 0Dh
	BSF 06,2
Hee2	NOP
	DECFSZ 0Dh,1
	GOTO Hee2	
	MOVLW 0C0h
	MOVWF 0Dh
	BCF 06,2
Hee3	NOP
	DECFSZ 0Dh,1
	GOTO Hee3
	DECFSZ 0Ch,1
	GOTO Hee1

	CLRWDT
Haw	MOVLW 0C0h
	MOVWF 0Ch
Haw1	MOVLW 0FFh
	MOVWF 0Dh
	BSF 06,2
Haw2	NOP
	DECFSZ 0Dh,1
	GOTO Haw2	
	MOVLW 0FFh
	MOVWF 0Dh
	BCF 06,2
Haw3	NOP
	DECFSZ 0Dh,1
	GOTO Haw3
	DECFSZ 0Ch,1
	GOTO Haw1
	BSF 06,2	;Keep alarm ON after Hee Haw
	BCF 06,0	;Turn on audio
	RETLW 00





	;Main
	

Main1	MOVLW 02
	MOVWF 1Dh	;to ring 2nd number
	MOVWF 1Eh	;to ring numbers second time
	BSF 06,2	;to keep circuit ON
	CALL Del2	;0.7sec delay
	CALL Del2	;0.7sec delay	
Main1A	CLRF 10h	;Jump value for Table1
Main2	MOVF 10h,0	;Look for NOPs in Table1
	CALL Table1	;  so chip can be re-burnt
	XORLW 00h
	BTFSS 03,2
	GOTO Main3
	INCF 10h,1
	GOTO Main2
Main3	CALL Dial1
	CALL Del2	;Silence after dialling
	BCF 06,0	;Turn on audio
	MOVLW 04h	;Put 4 loops into W
	MOVWF 1C
Main4	CALL Del3	;5 second delay		
	CALL Detect1		
	BTFSC 12h,0	;Has tone been detected
	GOTO Main8	;Shut off alarm
	DECFSZ 1C,1
	GOTO Main4
	CALL Hee	;Hee Haw sound
	MOVLW 04h	;Put 4 loops into W
	MOVWF 1C
Main5	CALL Del3		
	CALL Detect1		
	BTFSC 12h,0	;Has tone been detected
	GOTO Main8	;Shut off alarm
	DECFSZ 1C,1
	GOTO Main5
	CALL Hee	;Hee Haw sound	
	MOVLW 04h	;Put 4 loops into W
	MOVWF 1C
Main6	CALL Del3		
	CALL Detect1		
	BTFSC 12h,0	;Has tone been detected
	GOTO Main8	;Shut off alarm
	DECFSZ 1C,1
	GOTO Main6
	CALL Hee	;Hee Haw sound
	BCF 06,2	;To hang up phone
	MOVLW 05
	MOVWF 1C
Main7	CALL Del2	;5xDel2 before ringing 
	DECFSZ 1C,1	;     2nd number
	GOTO Main7	
	BSF 06,2	;To pick up phone line
	DECFSZ 1Dh,1	;File to ring 2nd number
	GOTO Main3
	DECFSZ 1E,1	;Ring numbers the second time
	GOTO Main1A
Main8	BCF 06,2	;To turn project off
	CLRWDT	
	GOTO Main8	;Micro will reset when it detects 0v


	END
	





	
			
	

		

	
	

⌨️ 快捷键说明

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