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.

DTMF to 8051 uC code problem

Status
Not open for further replies.

jepoy12

Junior Member level 3
Joined
Aug 19, 2011
Messages
26
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,463
Im making a remote dtmf switch using a 89s52 uC. using the dtmf 4bit output to switch on the device through relay.
Im using bascom IDE(only know the basic) and heres my program. after burning it, I tried to run the circuit and the result was failure. all relays go high already and I havent press any number keys yet.
Can someone help with my code? I dont know what to do. : (

Code:
Q1 Alias P1.0                                  'DTMF input
Q2 Alias P1.1
Q3 Alias P1.2
Q4 Alias P1.3

Relay1 Alias P2.0                            'microcontroller output
Relay2 Alias P2.1
Relay3 Alias P2.2

Buzzer Alias P0.0                            'buzzer output
Relayled Alias P0.1                         'Led output

Const Dur_on = 1000                      'buzzer duration and freq.
Const Freq_on = 90
Const Dur_off = 100
Const Freq_off = 90




Do
   If Q4 = 0 And Q3 = 0 And Q2 = 0 And Q1 = 1 Then                                     'if dtmf output is  0001 or key num "1" is pressed
   Relay1 = 1                                                                                               'relay1 switch on
   Sound Buzzer , Dur_on , Freq_on
   Wait 1
   Buzzer = 0
   Relayled = 1


   Elseif Q4 = 0 And Q3 = 0 And Q2 = 1 And Q1 = 0 Then                                'if dtmf output is  0010 or key num "2" is pressed
   Relay2 = 1                                                                                                'relay2 switch on
   Sound Buzzer , Dur_on , Freq_on 
   Wait 1
   Buzzer = 0
   Relayled = 1

   Elseif Q4 = 0 And Q3 = 0 And Q2 = 1 And Q1 = 1 Then
   Relay3 = 1
   Sound Buzzer , Dur_on , Freq_on
   Wait 1
   Buzzer = 0
   Relayled = 1

   Elseif Q4 = 0 And Q3 = 1 And Q2 = 0 And Q1 = 0 Then                                  'if dtmf output is  0100 or key num "4" is pressed
   Relay1 = 0                                                                                                  'relay1 switch off
   Sound Buzzer , Dur_off , Freq_off
   Wait 1
   Buzzer = 0
   Relayled = 0

   Elseif Q4 = 0 And Q3 = 1 And Q2 = 0 And Q1 = 1 Then                                   'if dtmf output is  0101 or key num "5" is pressed
   Relay2 = 0                                                                                                   'relay2 switch off
   Sound Buzzer , Dur_off , Freq_off
   Wait 1
   Buzzer = 0
   Relayled = 0

   Elseif Q4 = 0 And Q3 = 1 And Q2 = 1 And Q1 = 1 Then
   Relay3 = 0
   Sound Buzzer , Dur_off , Freq_off
   Wait 1
   Buzzer = 0
   Relayled = 0

   End If

Loop

End
 
Last edited:

he uses a telephone and it automatically answers when it rings. Im making a different version. what I wanted to do is cellphone receiver(autoanswer)---->DTMF--->microcontroller---->relaydriver--->relay.
I dont know anything about assembly. can you help me like take out the ring answer in his code and make it more like what I wanted. please help.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top