Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8870 & 9200 & 8951

Status
Not open for further replies.

Li_ereunpisan

Full Member level 5
Joined
Jul 14, 2009
Messages
260
Helped
32
Reputation
64
Reaction score
28
Trophy points
1,308
Location
Bandung, Indonesia
Activity points
2,768
I will be designing using MT8870 DTMF detector and using the HT9200 DTMF Generator both use AT89C51 .....
I have made it alone detector and generator run ,, the results ok .... I want to combine both, but the code that I made did not work .. please help me in troubleshooting the code just use asm


Code:
;*******************************************************
;---------------A U T O   D I A L E R-------------------
;*******************************************************
;-----------------------Bismillah----------------------
;bit ouput------------------------
led            bit   p2.7
htcs             BIT   P2.4
htclk            BIT   P2.6
htdin            BIT   P2.5
rly_hook_urt   BIT   P2.1;active high
rly_hook_wtr   BIT   P3.5;active low
tone           bit   p2.3  
;bit input----------------------
in_hook        bit   p2.0
std            bit   p3.2
rev_pol        bit   p3.6
ring_wtr       bit   p3.7
counter   equ 22h
flagtone         equ 21h

        Org	0H			;Reset Vector
	Ajmp	init			;
	Org	3H			;External Interrupt 0 Vector
	Reti				;
	Org	0BH			;Timer 0 Interrupt Vector
	Reti				;
	Org	13H			;External Interrupt 1 Vector
	Reti				;
	Org	1BH			;Timer 1 Interrupt Vector
	ljmp tone425				;
	Org	23H			;Serial Interrupt Vector
	Reti				;

init: 
        acall delay50
        clr htcs
        clr tr1
        clr ea
res_inc_pstn:
        clr 20h
        lcall blank_memory         ;reset memory 
        setb rly_hook_wtr  ;witura on_hook  
        clr rly_hook_urt  ;eurotech on_hook
;------------standby status-----------------       
                          
led_kiceup:        ; setb ring_wtr
                     clr led
                     jb ring_wtr,c_r_h  ;tlp asup ti witura???
                     acall delay200ms
                     setb led
                     jb ring_wtr,c_r_h  ;tlp asup ti witura???
                     acall delay200ms
                     clr led
                     jb ring_wtr,c_r_h  ;tlp asup ti witura???
                     acall delay200ms
                     setb led
                     jb ring_wtr,c_r_h  ;tlp asup ti witura???
                     acall delay200ms
uwih:                SJMP led_kiceup
;-----------------------------------------
c_r_h:       setb ring_wtr
             jb ring_wtr,$ ;call progress 1
             acall delay200ms       
             jb ring_wtr,$  
             acall delay200ms   
             jb ring_wtr,$   ;call progress 2
             acall delay50
             clr rly_hook_wtr ;witura auto answer /off hook
             jb in_hook,$
tone_act:    setb flagtone
             mov tmod,#12h
             setb ea
             setb et1
             setb tr1
 ;--------------------detect loop sadayana tujuan--------------------------
det_dial:    
             mov r0,#30h                                                                     
loopb:       
             mov p1,#0fh
             call delay_1
             setb rev_pol
             jnb rev_pol,start1
             setb std
             jnb std,loopb
             clr led
             clr c
dtmf_valid:
             jnb flagtone,det_dial1
             clr tr1
             clr ea
             clr flagtone  
det_dial1:  
             clr led ;led dial indication
             clr c
             mov a,p1
             MOV @R0,A
             INC R0
             setb  LED
             clr p3.0
;-------------ngantosan dial sampei 2 detik------------                 
                     MOV 23H,#0aH  ;antosan dipencet
                     MOV R6,#00H
                     MOV R7,#00H
antosan_dipencet:    setb rev_pol
                     jnb rev_pol,start1
                     setb std
                     jb std,loopb 
                     DJNZ R7,antosan_dipencet
                     DJNZ R6,antosan_dipencet
                     DJNZ 23H,antosan_dipencet
DIALING:    ;--------nulis dtmf------------  
                     MOV R0,#30H
                     setb rly_hook_urt ;eurotech off hook
                     ;acall delay50   
                     ;acall delay50                   
                     ;acall delay50
                     setb rev_pol
                     jnb rev_pol,start1
                     acall delay200ms
                      
AMBIL_DATA:          setb rev_pol
                     jnb rev_pol,start1
                     CLR C
                     MOV A,@R0
                     MOV 25H,A    
                     acall convert      ;/dial 200ms tos fixed
                     setb rev_pol
                     jnb rev_pol,start1
                     INC R0
                     MOV A,25H
                     mov p0,a
                     CJNE A,#0FFH,AMBIL_DATA
                     
;-------------------------mangga geura ngawaos--------------                   
CALLING:             setb rev_pol
                     jnb rev_pol,start1;walaikumsalam`	
                     clr led
                     acall delay50
                     setb led
                     acall delay50
                     sjmp calling
start1:ajmp init
;----------------------------------------
CONVERT:;ngarobah dtmf                         
;-----------------------------------------  
dig1:           
                      CLR C
                      MOV A,25H
                      CJNE A,#01H,dig2 
                      ;push acc
                      acall dig_1
                      ;pop acc
                      ret
dig2:     
                      CLR C
                      MOV A,25H
                      CJNE A,#02H,dig3  
                      ;push acc
                      acall dig_2
                      ;pop acc                
                      ret
dig3:                
                      CLR C
                      MOV A,25H
                      CJNE A,#03H,dig4
                      ;push acc
                      acall dig_3
                      ;pop acc
                      ret
dig4:           
                      CLR C
                      MOV A,25H
                      CJNE A,#04H,dig5
                      ;push acc
                      acall dig_4
                      ;pop acc
                      ret
dig5:         
                      CLR C
                      MOV A,25H
                      CJNE A,#05H,dig6
                      ;push acc
                      acall dig_5
                      ;pop acc
                      ret
dig6:           
                      CLR C
                      MOV A,25H
                      CJNE A,#06H,dig7
                      ;push acc
                      acall dig_6
                      ;pop acc
                      ret
dig7:     
                      CLR C
                      MOV A,25H
                      CJNE A,#07H,dig8 
                      push acc
                      acall dig_7
                      pop acc                
                      ret
dig8:                
                      CLR C
                      MOV A,25H
                      CJNE A,#08H,dig9
                      ;push acc
                      acall dig_8
                      ;pop acc
                      ret
dig9:           
                      CLR C
                      MOV A,25H
                      CJNE A,#09H,dig0
                      ;push acc
                      acall dig_9
                      ;pop acc
                      ret
dig0:         
                      CLR C
                      MOV A,25H
                      CJNE A,#0aH,CONV_END
                      ;push acc
                      acall dig_0
                      ;pop acc
CONV_END:             
                      RET
;-----------------------dial 9200----------------------------
dig_1:	
	mov a,#1h 
	mov counter,#5
send1:
	acall send_dtmf
	djnz counter,send1
	acall stop_dtmf
	ret
dig_2:	
	mov a,#2h 
	mov counter,#5
send2: 
	acall send_dtmf
	djnz counter,send2
	acall stop_dtmf
	ret
dig_3:	
	mov a,#3h 
	mov counter,#5
send3:  
	acall send_dtmf
	djnz counter,send3
	acall stop_dtmf
	ret
dig_4:	
	mov a,#4h 
	mov counter,#5
send4:  
	acall send_dtmf
	djnz counter,send4
	acall stop_dtmf
	ret
dig_5:	
	mov a,#5h 
	mov counter,#5
send5:  
	acall send_dtmf
	djnz counter,send5
	acall stop_dtmf
	ret
dig_6:	
	mov a,#6h 
	mov counter,#5
send6:  
	acall send_dtmf
	djnz counter,send6
	acall stop_dtmf
	ret
dig_7:	
	mov a,#7h 
	mov counter,#5
send7:  
	acall send_dtmf
	djnz counter,send7
	acall stop_dtmf
	ret
dig_8:	
	mov a,#8h 
	mov counter,#5
send8:  
	acall send_dtmf
	djnz counter,send8
	acall stop_dtmf
	ret
dig_9:	
	mov a,#9h 
	mov counter,#5
send9:  
	acall send_dtmf
	djnz counter,send9
	acall stop_dtmf
	ret
dig_0:	
	mov a,#0ah 
	mov counter,#5
send0:  
	acall send_dtmf
	djnz counter,send0
	acall stop_dtmf
        ret
;------------------------------------------------------------     
send_dtmf:
	setb htclk
	acall delay50 
	rrc a
	mov htdin,c
	clr htclk
	acall delay50
	ret
stop_dtmf:
        mov a,#0ffh 
	mov counter,#5
muter5x:
	acall send_dtmf
	djnz counter,muter5x
	acall delay200ms
	
	ret 
;------------------------------------------------------------      
Delay50:	push 06h
                push 07h				
                MOV	R6,#150	
Del50:	
         	MOV	R7,#165	
		DJNZ	R7,$		
		DJNZ	R6,Del50
		pop 07h
		pop 06h	
		RET
DELAY_1:             push 07h
                     MOV R7,#00H
TUNGG:               DJNZ R7,TUNGG
                     pop 07h
                     RET 
delay200ms:     acall delay50
                acall delay50
                acall delay50
                acall delay50
                ret

;-----------------------------------------------
blank_memory:     
                     MOV R0,#30H ;Genaral purpose ram
                     MOV R1,#20H
ISI_LAGI:            MOV @R0,#0FFH
                     INC R0
                     DJNZ R1,ISI_LAGI 
                     ret   
;-------------------------------------------------
; GENERATOR 425 HZ
;-------------------------------------------------
tone425:             
                    MOV TH1,#-5H
                    MOV TL1,#0D0H 
                    cpl tone
                    CLR TF1
                    RETI
;----------------Shodakallohilaziim-----------
                    END
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top