Hello all,
I am working on a control circuit using dtmf. I can decode the dtmf fine it is getting it into a usable format that is troubling me. I am looking to make an eight digit password. I have looked on the site but I don't seem to understand their method. I am using a 16f876a with 20 mhz. Here is my attempt. I also am controlling a isd 25120 chip based on the entry.

@ device pic16F876A, hs_osc, wdt_on, lvp_off, protect_off
include "MODEDEFS.BAS"
define OSC 20
adcon1=7
trisa.0 = 1
trisa.1 = 0
trisa.2 = 0
trisb = %11111111
trisc = %00000000
low portc
low portb

'_________pic to mc145436a assignments______________________

dtmf_ready VAR PORTA.0 'pin 12 (DV)
select_dtmf VAR PORTA.1 'pin 3 (Enamble)
reset VAR PORTA.2 'pin 5 (GT)
DT0 VAR PORTB.4 'pin 2 (D1)
DT1 VAR PORTB.5 'pin 1 (D2)
DT2 VAR PORTB.6 'pin 14 (D4)
DT3 VAR PORTB.3 'pin 13 (D8)
ce var portA.3 'pin from isd chip
'____________________variables____________________ ______

dtmf VAR byte ' Stores most recent DTMF digit
dtmf1 var byte
password var byte [8]
entry var byte
'___________________Initial Conditions__________________
start:
High reset
pause 500
high ce
low select_dtmf
c = 0
e = 0
loop:
IF dtmf_ready = 0 Then loop ' Check for DTMF present, if none loop again

welcome:
portc = %00000000
pause 500
gosub play 'play welcome statement
begin:
if dtmf_ready = 0 then begin 'waits for number to be depressed
gosub GetDtmf 'gets number
select case entry 'places number in an array
case c = 0
dtmf = password [0]
case c = 1
dtmf = password [1]
case c = 2
dtmf = password [2]
case c = 3
dtmf = password [3]
case c = 4
dtmf = password [4]
case c = 5
dtmf = password [5]
case c = 6
dtmf = password [6]
case c = 7
dtmf = password [7]
end select
c = c + 1
if c =< 7 then begin
if password [0] <> "1" then error
if password [1] <> "2" then error
if password [2] <> "3" then error
if password [3] <> "4" then error
if password [4] <> "5" then error
if password [5] <> "6" then error
if password [6] <> "7" then error
if password [7] <> "8" then error

play_menu_message:
portc = %000100100
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
dtmf_wait:
IF dtmf_ready Then dtmf_wait ' Loop here until DTMF signal stops
select_dtmf = 0
low reset
high reset
return

I can't seem to get the password go work correctly. I appreciate any help. There may very well be an easier method of creating a password for the user to enter, so please give me some ideas if possible.

Travin