I did as you suggested. I hard coded the the password and then sent it thorugh the if then statements and nothing happened, until I press 2 buttons on the phone, and then the menu message played. It will just wait until two buttons, any buttons, are pushed. Wierd huh. This is how I program the chip. Before I actually program the chip, I always erase it, then program it. Here is the snippet of code I used:
@ 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
trisa.3 = 0
trisb = %11111111
trisc = %00000000
'_________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]
codeword var byte[8]
codeword1 var byte[8]
c var byte
e var byte
'___________________Initial Conditions__________________
start:
pause 100
ce = 1
reset = 1
select_dtmf = 0
c = 0
e = 0
loop:
iF dtmf_ready = 1 Then
goto welcome
else
goto loop
endif
welcome:
portc = %00000000
pause 20
ce = 0
pause 20
ce = 1
pause 2000
c = 0
Entry:
pause 100
password[0] = "1"
password[1] = "2"
password[2] = "3"
password[3] = "4"
password[4] = "5"
password[5] = "6"
password[6] = "7"
password[7] = "8"
Pause 1000
password_check:
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
goto error
else
goto menu_message
endif
user_password:
if password [0] <> codeword [0] then error
if password [1] <> codeword [1] then error
if password [2] <> codeword [2] then error
if password [3] <> codeword [3] then error
if password [4] <> codeword [4] then error
IF password [5] <> codeword [5] then error
if password [6] <> codeword [6] then error
if password [7] <> codeword [7] then error
goto menu_message
error:
e = e + 1
if e>= 2 then
portc = %10010001
pause 20
ce = 0
pause 20
ce = 1
pause 3000
goto start
else
c = 0
portc = %00001000
pause 200
ce = 0
pause 200
ce = 1
pause 4000
goto loop
endif
menu_message:
portc = %00010010
pause 20
ce = 0
pause 20
ce = 1
menu:
if dtmf_ready = 0 then menu'waits for number to be depressed
gosub GetDtmf 'gets number
branch dtmf1,[menu_message,led1,led2,led3,led4]
Another thing that is interesting, is that after the menu message is done playing, I press a "0" as to send it back to paly the menu message again, but it goes to the top and plays the welcome message again. Thanks a lot for the help. This thing is annoying the hell out of me.
Travin
Bookmarks