Hello tenaja,
I tried your suggestion and still no go. Can you or anyone else here think of any other avenues that I could explore to get it working?
Thanks
jessey
Code:
Enter_Access_Code:
select_dtmf = 1 ' Enable the data output from the MT8870
Pause 1 ' Pause 1 mS to let data settle
dtmf_digit = (PORTB >> 4) ' Read the top nibble of PORTB for DTMF data
' Use LOOKUP to change the DTMF data to an ASCII character
LookUp dtmf_digit, ["_1234567890*#ABCD"], dtmf_digit
dtmf_wait2:
IF dtmf_ready Then dtmf_wait2 ' Loop here until DTMF signal stops
select_dtmf = 0 ' Disable the MT8870 data output
' access code is 2457316
Select Case dtmf_digit ' Take action based on the dtmf digit
'6th # in the correct sequence --- 1 = A
Case "1" ' sets A var to 1 if 1 is pressed and If-Then below is correct..
'IF (A=0) AND (B=1) AND (C=1) AND (D=1) AND (E=1) AND (F=0) AND (G=1) THEN A=1
IF (A=0) then
if (B=1) then
if (C=1) then
if (D=1) then
if (E=1) then
if (F=0) then
if (G=1) THEN
A=1
endif
endif
endif
endif
endif
endif
ELSE
A=2 ' 2681
ENDIF ' 2639
' 52
'1st # in the correct sequence --- 2 = B
Case "2" ' sets B var to 1 if 2 is pressed and If-Then below is correct..
'IF (A=0) AND (B=0) AND (C=0) AND (D=0) AND (E=0) AND (F=0) AND (G=0) THEN B=1
IF (A=0) then
if (B=0) then
if (C=0) then
if (D=0) then
if (E=0) then
if (F=0) then
if (G=0) THEN
B=1
endif
endif
endif
endif
endif
endif
ELSE
B=2
ENDIF
'5th # in the correct sequence --- 3 = C
Case "3" ' sets C var to 1 if 3 is pressed and If-Then below is correct..
'IF (A=0) AND (B=1) AND (C=0) AND (D=1) AND (E=1) AND (F=0) AND (G=1) THEN C=1
IF (A=0) then
if (B=1) then
if (C=0) then
if (D=1) then
if (E=1) then
if (F=0) then
if (G=1) THEN
C=1
endif
endif
endif
endif
endif
endif
ELSE
C=2
ENDIF
'2nd # in the correct sequence --- 4 = D
Case "4" ' sets D var to 1 if 4 is pressed and If-Then below is correct..
'IF (A=0) AND (B=1) AND (C=0) AND (D=0) AND (E=0) AND (F=0) AND (G=0) THEN D=1
IF (A=0) then
if (B=1) then
if (C=0) then
if (D=0) then
if (E=0) then
if (F=0) then
if (G=0) THEN
D=1
endif
endif
endif
endif
endif
endif
ELSE
D=2
ENDIF
'3rd # in the correct sequence --- 5 = E
Case "5" ' sets E var to 1 if 5 is pressed and If-Then below is correct..
'IF (A=0) AND (B=1) AND (C=0) AND (D=1) AND (E=0) AND (F=0) AND (G=0) THEN E=1
IF (A=0) then
if (B=1) then
if (C=0) then
if (D=1) then
if (E=0) then
if (F=0) then
if (G=0) THEN
E=1
endif
endif
endif
endif
endif
endif
ELSE
E=2
ENDIF
'7th # in the correct sequence --- 6 = F
Case "6" ' sets F var to 1 if 6 is pressed and If-Then below is correct..
'IF (A=1) AND (B=1) AND (C=1) AND (D=1) AND (E=1) AND (F=0) AND (G=1) THEN F=1
IF (A=1) then
if (B=1) then
if (C=1) then
if (D=1) then
if (E=1) then
if (F=0) then
if (G=1) THEN
F=1
endif
endif
endif
endif
endif
endif
ELSE
F=2
ENDIF
'4th # in the correct sequence --- 7 = G
Case "7" ' sets G var to 1 if 6 is pressed and If-Then below is correct..
'IF (A=0) AND (B=1) AND (C=0) AND (D=1) AND (E=1) AND (F=0) AND (G=0) THEN G=1
IF (A=0) then
if (B=1) then
if (C=0) then
if (D=1) then
if (E=1) then
if (F=0) then
if (G=0) THEN
G=1
endif
endif
endif
endif
endif
endif
ELSE
G=2
ENDIF
Case "8"
A=2 ' If the #8 key is pressed then it's a no go
Case "9"
A=2 ' If the #9 key is pressed then it's a no go
Case "0"
A=2 ' If the #0 key is pressed then it's a no go
End Select
'IF (A=1) AND (B=1) AND (C=1) AND (D=1) AND (E=1) AND (F=1) AND (G=1) THEN
IF (A=1) then
if (B=1) then
if (C=1) then
if (D=1) then
if (E=1) then
if (F=1) then
if (G=1) THEN
access_code = is_verified
FreqOut DTMF_out, 500, 800 ' Play 3 tones to confirm to the caller that
PAUSE 100 ' the correct access code has been entered
FreqOut DTMF_out, 500, 800
PAUSE 100
FreqOut DTMF_out, 500, 800
endif
endif
endif
endif
endif
endif
ENDIF
IF k = 0 THEN listen
Bookmarks