I haven't been able to get this thing to work. Maybe you smarter people can assist. Here is the gist: I call the phone and the welcome message asks for the password. The user then enters the password on the keypad. The password is 8 digits long. Everything works fine until this part, naturaly. For some reason, the program is not recognizing the password. Any help is appreciated. Using 16f876a with 20mhz and PBP
'____________________variables____________________ ______
dtmf VAR byte ' Stores most recent DTMF digit
dtmf1 var byte
password var byte [8]
codeword var byte [8]
codeword1 var byte [8]
c var byte
e var byte
Start:
c = 0
e = 0
loop:
iF dtmf_ready = 0 Then loop ' Check for DTMF present, if none loop again
welcome:
portc = %00000000
pause 20
gosub play 'play welcome statement
begin:
if dtmf_ready = 0 then begin 'waits for number to be depressed
gosub GetDtmf 'gets number
select case c 'places number in an array
case 0
dtmf = password [0]
case 1
dtmf = password [1]
case 2
dtmf = password [2]
case 3
dtmf = password [3]
case 4
dtmf = password [4]
case 5
dtmf = password [5]
case 6
dtmf = password [6]
case 7
dtmf = password [7]
end select
c = c + 1
if c =< 7 then begin
if password [0] = "1" then
goto password1
else
goto user_password
endif
password1:
if password [1] = "2" then
goto password2
else
goto error
endif
password2:
if password [2] = "3" then
goto password3
else
goto error
endif
password3:
if password [3] = "4" then
goto password4
else
goto error
endif
password4:
if password [4] = "5" then
goto password5
else
goto error
endif
password5:
if password [5] = "6" then
goto password6
else
goto error
endif
password6:
if password [6] = "7" then
goto password7
else
goto error
endif
password7:
if password [7] = "8" then
goto play_menu_message
else
goto error
endif
play_menu_message:
portc = %00010010
gosub play 'play menu message
GetDtmf:
select_dtmf = 1 ' Enable the data output from the MT8870
Pause 1 ' Pause 1 mS to let data settle
dtmf = 0
IF DT0 = 1 Then 'Check Input port 0
dtmf = dtmf + 1
EndIF
IF DT1 = 1 Then 'Check Input port 1
dtmf = dtmf + 2
EndIF
IF DT2 = 1 Then 'Check Input port 2
dtmf = dtmf + 4
EndIF
IF DT3 = 1 Then 'Check Input port 3
dtmf = dtmf + 8
EndIF
LookUp dtmf,["_1234567890*#"],dtmf
Bookmarks