mishra12
Advanced Member level 2
- Joined
- Feb 18, 2009
- Messages
- 672
- Helped
- 136
- Reputation
- 272
- Reaction score
- 122
- Trophy points
- 1,323
- Location
- some where left alone
- Activity points
- 4,915
hi experts
a project from efy june 2010 cell phone based project not working .code provided with cd seems ok but real hardware simulation is not working pls help me on this issue here is detail source code
$large
$regfile = "89c51cc.DAT"
$crystal = 11059200
' DECLERATION OF FUNCTIONS
Declare Sub Keypad
Declare Sub Device_action
Declare Sub Voice_alert
Declare Sub Dtmf_input
' INPUT FROM DTMF DECODER
Dtmf_a Alias P2.4
Dtmf_b Alias P2.3
Dtmf_c Alias P2.2
Dtmf_d Alias P2.1
Dtmf_ack Alias P2.0
' INPUT FROM KEYPAD
Key_1 Alias P1.0
Key_2 Alias P1.1
Key_3 Alias P1.2
Key_4 Alias P1.3
Key_5 Alias P1.4
Key_6 Alias P1.5
Key_a Alias P1.6
Key_v Alias P1.7
' OUTPUT TO AUDIO SELECTION
Aud_1 Alias P0.0
Aud_2 Alias P0.1
Aud_3 Alias P0.2
Aud_4 Alias P0.3
Aud_5 Alias P0.4
Aud_6 Alias P0.5
Aud_on Alias P0.6
Aud_off Alias P0.7
'Aud_rewind Alias P2.6
'INPUT FROM APR9600
Aud_busy Alias P2.7
'OUTPUT TO DEVICE
Device_1 Alias P3.0
Device_2 Alias P3.1
Device_3 Alias P3.2
Device_4 Alias P3.3
Device_5 Alias P3.4
Device_6 Alias P3.5
'CONTROLLING MODE SELECTION
Device_a Alias P3.6
Device_b Alias P3.7
' DECLARING VARIABLES
Dim Keypad_value As Byte
Dim Device_1_status As Bit
Dim Device_2_status As Bit
Dim Device_3_status As Bit
Dim Device_4_status As Bit
Dim Device_5_status As Bit
Dim Device_6_status As Bit
Dim Common_status As Bit
Dim Voice As Bit
Dim Status_enable As Bit
'INTIALIZING VALUES
Keypad_value = 15
Aud_1 = 1
Aud_2 = 1
Aud_3 = 1
Aud_4 = 1
Aud_5 = 1
Aud_6 = 1
Aud_on = 1
Aud_off = 1
'Aud_rewind = 0
Device_1_status = 0
Device_2_status = 0
Device_3_status = 0
Device_4_status = 0
Device_5_status = 0
Device_6_status = 0
Device_1 = 0
Device_2 = 0
Device_3 = 0
Device_4 = 0
Device_5 = 0
Device_6 = 0
Voice = 1
Do
If Device_a = 0 And Device_b = 0 Then
P2 0.5 = 0
ElseIf Device_a = 0 And Device_b = 1 Then
P2 0.5 = 1
Call Keypad
'If Keypad_value < 9 Then
Call Device_action
end If
ElseIf Device_a = 1 And Device_b = 0 Then
P2 0.5 = 1
Call Dtmf_input
'If Keypad_value < 9 Then
Call Device_action
'End If
ElseIf Device_a = 1 And Device_b = 1 Then
P2 0.5 = 1
Call Keypad
Call Dtmf_input
'If Keypad_value < 9 Then
Call Device_action
' End If
End If
If Status_enable = 1 Then
While Keypad_value > 7
If Device_b = 1 Then
Call Keypad
End If
If Device_a = 1 Then
Call Dtmf_input
End If
Wend
Call Voice_alert
Status_enable = 0
End If
Loop
Sub Keypad()
If Key_1 = 0 Then
Keypad_value = 1
Bitwait Key_1 , Set
ElseIf Key_2 = 0 Then
Keypad_value = 2
Bitwait Key_2 , Set
ElseIf Key_3 = 0 Then
Keypad_value = 3
Bitwait Key_3 , Set
ElseIf Key_4 = 0 Then
Keypad_value = 4
Bitwait Key_4 , Set
ElseIf Key_5 = 0 Then
Keypad_value = 5
Bitwait Key_5 , Set
ElseIf Key_6 = 0 Then
Keypad_value = 6
Bitwait Key_6 , Set
ElseIf Key_a = 0 Then
Keypad_value = 7
Bitwait Key_a , Set
ElseIf Key_v = 0 Then
Keypad_value = 8
Bitwait Key_v , Set
Else
Keypad_value = 15
End If
End Sub
Sub Device_action()
If Keypad_value = 1 Then
Device_1_status = Not Device_1_status
Device_1 = Device_1_status
Call Voice_alert
ElseIf Keypad_value = 2 Then
Device_2_status = Not Device_2_status
Device_2 = Device_2_status
Call Voice_alert
ElseIf Keypad_value = 3 Then
Device_3_status = Not Device_3_status
Device_3 = Device_3_status
Call Voice_alert
ElseIf Keypad_value = 4 Then
Device_4_status = Not Device_4_status
Device_4 = Device_4_status
Call Voice_alert
ElseIf Keypad_value = 5 Then
Device_5_status = Not Device_5_status
Device_5 = Device_5_status
Call Voice_alert
ElseIf Keypad_value = 6 Then
Device_6_status = Not Device_6_status
Device_6 = Device_6_status
Call Voice_alert
ElseIf Keypad_value = 7 Then
Keypad_value = 15
Status_enable = 1
ElseIf Keypad_value = 8 Then
If Voice = 1 Then
Voice = 0
ElseIf Voice = 0 Then
Voice = 1
End If
End If
Keypad_value = 15
End Sub
Sub Dtmf_input()
If Dtmf_ack = 1 Then
Bitwait Dtmf_ack, Reset
If Dtmf_d = 0 And Dtmf_c = 0 And Dtmf_b = 0 And Dtmf_a = 1 Then
Keypad_value = 1
ElseIf Dtmf_d = 0 And Dtmf_c = 0 And Dtmf_b = 1 And Dtmf_a = 0 Then
Keypad_value = 2
ElseIf Dtmf_d = 0 And Dtmf_c = 0 And Dtmf_b = 1 And Dtmf_a = 1 Then
Keypad_value = 3
ElseIf Dtmf_d = 0 And Dtmf_c = 1 And Dtmf_b = 0 And Dtmf_a = 0 Then
Keypad_value = 4
ElseIf Dtmf_d = 0 And Dtmf_c = 1 And Dtmf_b = 0 And Dtmf_a = 1 Then
Keypad_value = 5
ElseIf Dtmf_d = 0 And Dtmf_c = 1 And Dtmf_b = 1 And Dtmf_a = 0 Then
Keypad_value = 6
ElseIf Dtmf_d = 1 And Dtmf_c = 0 And Dtmf_b = 1 And Dtmf_a = 1 Then
Keypad_value = 7
ElseIf Dtmf_d = 1 And Dtmf_c = 1 And Dtmf_b = 0 And Dtmf_a = 0 Then
Keypad_value = 8
Else
Keypad_value = 15
End If
End If
End Sub
Sub Voice_alert()
If Voice = 1 And Keypad_value < 7 Then
If Keypad_value = 1 Then
Common_status = Device_1_status
Aud_1 = 0
Wait 1
Aud_1 = 1
ElseIf Keypad_value = 2 Then
Common_status = Device_2_status
Aud_2 = 0
Wait 1
Aud_2 = 1
ElseIf Keypad_value = 3 Then
Common_status = Device_3_status
Aud_3 = 0
Wait 1
Aud_3 = 1
ElseIf Keypad_value = 4 Then
Common_status = Device_4_status
Aud_4 = 0
Wait 1
Aud_4 = 1
ElseIf Keypad_value = 5 Then
Common_status = Device_5_status
Aud_5 = 0
Wait 1
Aud_5 = 1
ElseIf Keypad_value = 6 Then
Common_status = Device_6_status
Aud_6 = 0
Wait 1
Aud_6 = 1
End If
'Bitwait Aud_busy , Set
Wait 5
If Common_status = 1 Then
Aud_off = 0
Wait 1
Aud_off = 1
ElseIf Common_status = 0 Then
Aud_on = 0
Wait 1
Aud_on = 1
End If
Bitwait Aud_busy , Set
End If
End Sub
a project from efy june 2010 cell phone based project not working .code provided with cd seems ok but real hardware simulation is not working pls help me on this issue here is detail source code
$large
$regfile = "89c51cc.DAT"
$crystal = 11059200
' DECLERATION OF FUNCTIONS
Declare Sub Keypad
Declare Sub Device_action
Declare Sub Voice_alert
Declare Sub Dtmf_input
' INPUT FROM DTMF DECODER
Dtmf_a Alias P2.4
Dtmf_b Alias P2.3
Dtmf_c Alias P2.2
Dtmf_d Alias P2.1
Dtmf_ack Alias P2.0
' INPUT FROM KEYPAD
Key_1 Alias P1.0
Key_2 Alias P1.1
Key_3 Alias P1.2
Key_4 Alias P1.3
Key_5 Alias P1.4
Key_6 Alias P1.5
Key_a Alias P1.6
Key_v Alias P1.7
' OUTPUT TO AUDIO SELECTION
Aud_1 Alias P0.0
Aud_2 Alias P0.1
Aud_3 Alias P0.2
Aud_4 Alias P0.3
Aud_5 Alias P0.4
Aud_6 Alias P0.5
Aud_on Alias P0.6
Aud_off Alias P0.7
'Aud_rewind Alias P2.6
'INPUT FROM APR9600
Aud_busy Alias P2.7
'OUTPUT TO DEVICE
Device_1 Alias P3.0
Device_2 Alias P3.1
Device_3 Alias P3.2
Device_4 Alias P3.3
Device_5 Alias P3.4
Device_6 Alias P3.5
'CONTROLLING MODE SELECTION
Device_a Alias P3.6
Device_b Alias P3.7
' DECLARING VARIABLES
Dim Keypad_value As Byte
Dim Device_1_status As Bit
Dim Device_2_status As Bit
Dim Device_3_status As Bit
Dim Device_4_status As Bit
Dim Device_5_status As Bit
Dim Device_6_status As Bit
Dim Common_status As Bit
Dim Voice As Bit
Dim Status_enable As Bit
'INTIALIZING VALUES
Keypad_value = 15
Aud_1 = 1
Aud_2 = 1
Aud_3 = 1
Aud_4 = 1
Aud_5 = 1
Aud_6 = 1
Aud_on = 1
Aud_off = 1
'Aud_rewind = 0
Device_1_status = 0
Device_2_status = 0
Device_3_status = 0
Device_4_status = 0
Device_5_status = 0
Device_6_status = 0
Device_1 = 0
Device_2 = 0
Device_3 = 0
Device_4 = 0
Device_5 = 0
Device_6 = 0
Voice = 1
Do
If Device_a = 0 And Device_b = 0 Then
P2 0.5 = 0
ElseIf Device_a = 0 And Device_b = 1 Then
P2 0.5 = 1
Call Keypad
'If Keypad_value < 9 Then
Call Device_action
end If
ElseIf Device_a = 1 And Device_b = 0 Then
P2 0.5 = 1
Call Dtmf_input
'If Keypad_value < 9 Then
Call Device_action
'End If
ElseIf Device_a = 1 And Device_b = 1 Then
P2 0.5 = 1
Call Keypad
Call Dtmf_input
'If Keypad_value < 9 Then
Call Device_action
' End If
End If
If Status_enable = 1 Then
While Keypad_value > 7
If Device_b = 1 Then
Call Keypad
End If
If Device_a = 1 Then
Call Dtmf_input
End If
Wend
Call Voice_alert
Status_enable = 0
End If
Loop
Sub Keypad()
If Key_1 = 0 Then
Keypad_value = 1
Bitwait Key_1 , Set
ElseIf Key_2 = 0 Then
Keypad_value = 2
Bitwait Key_2 , Set
ElseIf Key_3 = 0 Then
Keypad_value = 3
Bitwait Key_3 , Set
ElseIf Key_4 = 0 Then
Keypad_value = 4
Bitwait Key_4 , Set
ElseIf Key_5 = 0 Then
Keypad_value = 5
Bitwait Key_5 , Set
ElseIf Key_6 = 0 Then
Keypad_value = 6
Bitwait Key_6 , Set
ElseIf Key_a = 0 Then
Keypad_value = 7
Bitwait Key_a , Set
ElseIf Key_v = 0 Then
Keypad_value = 8
Bitwait Key_v , Set
Else
Keypad_value = 15
End If
End Sub
Sub Device_action()
If Keypad_value = 1 Then
Device_1_status = Not Device_1_status
Device_1 = Device_1_status
Call Voice_alert
ElseIf Keypad_value = 2 Then
Device_2_status = Not Device_2_status
Device_2 = Device_2_status
Call Voice_alert
ElseIf Keypad_value = 3 Then
Device_3_status = Not Device_3_status
Device_3 = Device_3_status
Call Voice_alert
ElseIf Keypad_value = 4 Then
Device_4_status = Not Device_4_status
Device_4 = Device_4_status
Call Voice_alert
ElseIf Keypad_value = 5 Then
Device_5_status = Not Device_5_status
Device_5 = Device_5_status
Call Voice_alert
ElseIf Keypad_value = 6 Then
Device_6_status = Not Device_6_status
Device_6 = Device_6_status
Call Voice_alert
ElseIf Keypad_value = 7 Then
Keypad_value = 15
Status_enable = 1
ElseIf Keypad_value = 8 Then
If Voice = 1 Then
Voice = 0
ElseIf Voice = 0 Then
Voice = 1
End If
End If
Keypad_value = 15
End Sub
Sub Dtmf_input()
If Dtmf_ack = 1 Then
Bitwait Dtmf_ack, Reset
If Dtmf_d = 0 And Dtmf_c = 0 And Dtmf_b = 0 And Dtmf_a = 1 Then
Keypad_value = 1
ElseIf Dtmf_d = 0 And Dtmf_c = 0 And Dtmf_b = 1 And Dtmf_a = 0 Then
Keypad_value = 2
ElseIf Dtmf_d = 0 And Dtmf_c = 0 And Dtmf_b = 1 And Dtmf_a = 1 Then
Keypad_value = 3
ElseIf Dtmf_d = 0 And Dtmf_c = 1 And Dtmf_b = 0 And Dtmf_a = 0 Then
Keypad_value = 4
ElseIf Dtmf_d = 0 And Dtmf_c = 1 And Dtmf_b = 0 And Dtmf_a = 1 Then
Keypad_value = 5
ElseIf Dtmf_d = 0 And Dtmf_c = 1 And Dtmf_b = 1 And Dtmf_a = 0 Then
Keypad_value = 6
ElseIf Dtmf_d = 1 And Dtmf_c = 0 And Dtmf_b = 1 And Dtmf_a = 1 Then
Keypad_value = 7
ElseIf Dtmf_d = 1 And Dtmf_c = 1 And Dtmf_b = 0 And Dtmf_a = 0 Then
Keypad_value = 8
Else
Keypad_value = 15
End If
End If
End Sub
Sub Voice_alert()
If Voice = 1 And Keypad_value < 7 Then
If Keypad_value = 1 Then
Common_status = Device_1_status
Aud_1 = 0
Wait 1
Aud_1 = 1
ElseIf Keypad_value = 2 Then
Common_status = Device_2_status
Aud_2 = 0
Wait 1
Aud_2 = 1
ElseIf Keypad_value = 3 Then
Common_status = Device_3_status
Aud_3 = 0
Wait 1
Aud_3 = 1
ElseIf Keypad_value = 4 Then
Common_status = Device_4_status
Aud_4 = 0
Wait 1
Aud_4 = 1
ElseIf Keypad_value = 5 Then
Common_status = Device_5_status
Aud_5 = 0
Wait 1
Aud_5 = 1
ElseIf Keypad_value = 6 Then
Common_status = Device_6_status
Aud_6 = 0
Wait 1
Aud_6 = 1
End If
'Bitwait Aud_busy , Set
Wait 5
If Common_status = 1 Then
Aud_off = 0
Wait 1
Aud_off = 1
ElseIf Common_status = 0 Then
Aud_on = 0
Wait 1
Aud_on = 1
End If
Bitwait Aud_busy , Set
End If
End Sub