A little DTMF help


Closed Thread
Results 1 to 40 of 49

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Posts
    89

    Default A little DTMF help

    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

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by Travin77
    low portc
    low portb
    portc = %000100100
    IF dtmf_ready Then dtmf_wait ' Loop here until DTMF signal stops
    I am not sure if you have figured this out by now but the above few lines look like possible trouble to me. I am not much of DTMF user so hopefully someone else will spot your woes.

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  3. #3
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Yup

    Thanks for pointing out the portc = %000100100. That controls the address of the isd chip. One zero on each side shouldn't be there. Unfortunately, that didn't fix it. Its not the dtmf that doesn't work. It is getting the data into a usable form. Once the phone picks up, the user pushes a button on the key pad. The pic then makes the isd chip play the welcome statement, which asks the user to enter their password, which in this case is 12345678. During the entry of the password, I tried to make each entry go into an array via the select case command. During this progression, I advanced the var "c". When "c" reached 8, I compare each individual array segment to the individual section of that password. This is where the code stops working. It doesn't give me the error message and doesn't go on to the next step of the program. I am not sure if I am getting the code inputed correctly nor am I sure that I am comparing it correctly. Thanks for the catch though.

    Travin

  4. #4
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Travin77
    trisa.0 = 1
    trisa.1 = 0
    trisa.2 = 0
    PortA ist an analog-input after reset. Look at the manual !

    Quote Originally Posted by Travin77
    trisb = %11111111
    trisc = %00000000
    low portc
    low portb
    OK, PortB is Input, why do you use the LOW-command,
    and this is written in the wrong way. If you adress the TRIS direct, better don't use LOW and HIGH.

    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
    While declaring this in the front of the program, you can easily use LOW/HIGH or INPUT/OUTPUT an this symbolic names, it is better to read!

    c = 0
    e = 0
    not declared !


    select case entry 'places number in an array
    case c = 0
    dtmf = password [0]
    Hä ?
    What is C ? Ever read the manual nearby "Select case" ?

    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
    dtmf=0:dtmf.0=DT0:dtmf.1=DT1:dtmf.2=DT2:dtmf.3=DT3 ??


    It's very quick'n'dirty !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  5. #5
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Dtmf

    PortA ist an analog-input after reset. Look at the manual !

    I used adcon1 = 7 to change port a to digital. Did I do something wrong?

    c = 0
    e = 0
    not declared !

    Right, somehow those got left off in the top as did these:
    entry var byte
    c var byte
    e var byte

    they are in the original program I just deleted them while I was cutting and pasting.

    In the select case statement I used c as a counter for the number of entries pressed into the key pad. For example, once the call initiates, c=0. The user inputs the first DTMF signal. That is decoded and a lookup table is used. That input is then placed in the dtmf variable:

    LookUp dtmf,["_1234567890*#"],dtmf

    The program then returns to the select case statement and places that dtmf value into an array based on what c equals. C is then advanced by 1.
    c = c + 1

    If c is 7 or less then the program returns to the if dtmf_ready = 0 then begin loop to retrieve the next digit.

    if c =< 7 then begin

    This is supposed to continue until c >=8, at which point the program starts comparing the array values to a set of constant numbers. Now, this is how it is supposed to work. Obviously it does not work. This is my first attempt at using the select case statement and first time trying a password out. Thanks for your help, its just I am not sure what you are telling me to do.

    Travin

  6. #6
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    In my example of the PicBasic-manual there is an example for SELECT-CASE like this:

    Example

    SELECT CASE x
    CASE 1
    y = 10
    CASE 2, 3
    y = 20
    CASE IS > 5
    y = 100
    CASE ELSE
    y = 0
    END SELECT
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  7. #7
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Case select

    So what you are saying is that portion of the code should look like this:

    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
    Is this what you are trying to say? Anyway I am going to try it. I guess I misuderstood what the example was telling me to do. Thanks for the help and suggestions.

    Travin

  8. #8
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    ...and smoother:

    dtmf=password[c] (replaces the hole Setect-part)

    or better:

    password[c]=dtmf

    this maybe will work as you expect....
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  9. #9
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Still broken

    Hello all. Hoping someone knows how to fix this damn thing. It still won't take the data into the array. I know it is decoding fine. Any ideas? All are welcome. My best guess is the if statements, but I don't know. If anyone has another option for a code, that would be just fine too. Thanks Paul, your help did make it run smoother. Here is the code:

    @ 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
    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 200
    ce = 0
    pause 200
    ce = 1
    begin:
    if dtmf_ready = 0 then begin 'waits for number to be depressed
    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_wait1:
    IF dtmf_ready = 1 Then dtmf_wait1 ' Loop here until DTMF signal stops
    select_dtmf = 0 ' Disable the MT8870 data output
    reset = 0
    reset = 1

    password[c]=dtmf

    Select case dtmf
    case "1"
    portc = %10010111
    case "2"
    portc = %10011001
    case "3"
    portc = %10011011
    case "4"
    portc = %10011101
    case "5"
    portc = %10011111
    case "6"
    portc = %10100001
    case "7"
    portc = %10100011
    case "8"
    portc = %10100101
    case "9"
    portc = %10100111
    case "0"
    portc = %10101001
    end select
    pause 200
    ce = 0
    pause 200
    ce = 1
    c = c + 1
    if c <= 7 then begin
    if password [0] <> "1" then user_password
    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 play_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 play_menu_message
    error:
    e = e + 1
    if e >= 2 then end_call
    c = 0
    portc = %00001000
    pause 200
    ce = 0
    pause 200
    ce = 1
    goto begin
    play_menu_message:
    portc = %00010010
    pause 200
    ce = 0
    pause 200
    ce = 1
    menu:
    if dtmf_ready = 0 then menu'waits for number to be depressed
    gosub GetDtmf 'gets number

  10. #10
    Join Date
    May 2005
    Location
    San Diego, CA
    Posts
    8


    Did you find this post helpful? Yes | No

    Lightbulb Advise!

    I built a DTMF decoder a few years back using a CM8880 and I would have been lost without the use of a LCD connected. I first wrote a routine to display the DTMF tone on the LCD, so as I played with the keypad, I could see the keys that I pushed. Once I was convinced my programming worked, I then started writing the second routine for the passcode, and with the LCD attached I could do checks within the programming when I ran into troubles. I hope this helps!

    Wink

  11. #11
    Join Date
    Mar 2006
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Hello,

    I looked at your code and had a couple of questions you might look into. They are marked with <--
    Hope this is helpfull.

    Keith

    if c <= 7 then begin
    if password [0] <> "1" then user_password ' <-- Why isn't this "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 play_menu_message ' <-- This is where the code gets to if the password was "12345678" Can you tell if the code ever gets here ?
    endif
    user_password:
    if password [0] <> codeword [0] then error ' <-- The value of codeword[0] is undefined.
    if password [1] <> codeword [1] then error ' <-- The value of codeword[1] is undefined etc.
    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 play_menu_message
    error:
    e = e + 1
    if e >= 2 then end_call <-- someof your code seems to be missing, where is end_call defined ?
    c = 0
    portc = %00001000
    pause 200
    ce = 0
    pause 200
    ce = 1
    goto begin
    play_menu_message:
    portc = %00010010
    pause 200
    ce = 0
    pause 200
    ce = 1
    menu:
    if dtmf_ready = 0 then menu'waits for number to be depressed
    gosub GetDtmf 'gets number

  12. #12
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Answers

    As for the LCD, I had the LCD hooked up. All of the decode works. Now, when the number is decoded, the isd25120 chip repeats the number entered. When the program initiates, the welcome statement plays when the user pushes any button. This prompts him to enter a password. The pic starts repeating the digits decoded after 5 digits have been input( for this I have no explanation why). Every tone decoded after is announced perfectly. That section of the code is after the password[c]. So I reason that the tone is being input into the array. When c = 8 the code should compare the array to the constants but it doesn't. It also doesn't play the error message. It allows about 7-8 more characters to be input and then starts over with the welcome message.

    if password [0] <> "1" then user_password ' <-- Why isn't this "then error" ?
    If password[0] doesn't equal "1", then I want the program to check codeword[0] to see if they equal.

    goto play_menu_message ' <-- This is where the code gets to if the password was "12345678" Can you tell if the code ever gets here ?

    As far as I can tell, The code never gets here.

    if password [0] <> codeword [0] then error ' <-- The value of codeword[0] is undefined.
    if password [1] <> codeword [1] then error ' <-- The value of codeword[1] is undefined etc.

    These are undefined because in the play_menu_message the option is given to set this. I will post this section of the code. Here is the entire program:

    @ 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
    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 200
    ce = 0
    pause 200
    ce = 1
    begin:
    if dtmf_ready = 0 then begin 'waits for number to be depressed
    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_wait1:
    IF dtmf_ready = 1 Then dtmf_wait1 ' Loop here until DTMF signal stops
    select_dtmf = 0 ' Disable the MT8870 data output
    reset = 0
    reset = 1

    password[c]=dtmf

    Select case dtmf
    case "1"
    portc = %10010111
    case "2"
    portc = %10011001
    case "3"
    portc = %10011011
    case "4"
    portc = %10011101
    case "5"
    portc = %10011111
    case "6"
    portc = %10100001
    case "7"
    portc = %10100011
    case "8"
    portc = %10100101
    case "9"
    portc = %10100111
    case "0"
    portc = %10101001
    end select
    pause 200
    ce = 0
    pause 200
    ce = 1
    c = c + 1
    if c <= 7 then begin
    if password [0] <> "1" then user_password
    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 play_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 play_menu_message
    error:
    e = e + 1
    if e >= 2 then end_call
    c = 0
    portc = %00001000
    pause 200
    ce = 0
    pause 200
    ce = 1
    goto begin
    play_menu_message:
    portc = %00010010
    pause 200
    ce = 0
    pause 200
    ce = 1
    menu:
    if dtmf_ready = 0 then menu'waits for number to be depressed
    gosub GetDtmf 'gets number

    If dtmf = "1" then set_password
    else
    goto play_menu_message:
    endif

    set_password:
    c = 0
    portc = %01100101
    pause 20
    gosub play 'play enter password message
    hold:
    if dtmf_ready = 0 then hold
    gosub getdtmf
    codeword[c] = dtmf
    c = c + 1
    if c =< 7 then hold
    c = 0
    portc = %11011010
    pause 20
    gosub play 'play re-enter password message
    hold1:
    if dtmf_ready = 0 then hold1
    gosub getdtmf
    codeword1[c]=dtmf
    c = c + 1
    if c =< 7 then hold1
    if codeword[0] <> codeword1[0] then password_entry_error
    if codeword[1] <> codeword1[1] then password_entry_error
    if codeword[2] <> codeword1[2] then password_entry_error
    if codeword[3] <> codeword1[3] then password_entry_error
    if codeword[4] <> codeword1[4] then password_entry_error
    if codeword[5] <> codeword1[5] then password_entry_error
    if codeword[6] <> codeword1[6] then password_entry_error
    if codeword[7] <> codeword1[7] then password_entry_error
    password_correct:
    portc = %01111110
    pause 20
    gosub play 'play password has been changed message
    pause 3000
    goto play_menu_message
    password_entry_error:
    portc = %01110101
    pause 20
    gosub play 'plays entries do not match
    pause 3000
    goto play_menu_message
    end_call:
    portc = %10010001
    pause 20
    gosub play'play finish message
    goto start
    play:
    ce = 0
    pause 200
    ce = 1
    return
    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 = 0 Then dtmf_wait ' Loop here until DTMF signal stops
    select_dtmf = 0 ' Disable the MT8870 data output
    reset = 0
    reset = 1
    Select case dtmf
    case "1"
    portc = %10010111
    case "2"
    portc = %10011001
    case "3"
    portc = %10011011
    case "4"
    portc = %10011101
    case "5"
    portc = %10011111
    case "6"
    portc = %10100001
    case "7"
    portc = %10100011
    case "8"
    portc = %10100101
    case "9"
    portc = %10100111
    case "0"
    portc = %10101001
    end select
    pause 200
    ce = 0
    pause 200
    ce = 1
    return
    Last edited by Travin77; - 25th May 2006 at 21:30.

  13. #13
    Join Date
    May 2005
    Location
    San Diego, CA
    Posts
    8


    Did you find this post helpful? Yes | No

    Lightbulb A couple of things

    After your program senses the first button push, your isd25120 message plays, but you are not cycling out that button push, you are going straight to another loop (BEGIN).

    loop:
    iF dtmf_ready = 0 Then loop ' Check for DTMF present, if none loop again
    welcome:
    portc = %00000000
    pause 200
    ce = 0
    pause 200
    ce = 1
    begin:
    if dtmf_ready = 0 then begin 'waits for number to be depressed

    Try adding the following just after ( ce = 1 ) and just before ( begin: ) :

    select_dtmf = 1 ' Enable the data output from the MT8870
    Pause 1 ' Pause 1 mS to let data settle
    dtmf_wait2:
    IF dtmf_ready = 1 Then dtmf_wait2 ' Loop here until DTMF signal stops
    select_dtmf = 0 ' Disable the MT8870 data output
    reset = 0
    pause 100
    reset = 1

    Also, lower down in the program you have more than once:

    reset = 0
    reset = 1

    That is a very fast blip to the GT pin. Try giving it a chance to see it!

    Add a PAUSE 100 between the trasistion.

    reset = 0
    pause 100
    reset = 1

    You probably notice I added this pause in the upper portion of the program too!

    I am still trying to figure out how the routines for the password work, that sure is some creative programming! Maybe some comments beside them would help others (and me) understand it. (Or is it just me?) It does compile, but not sure how it works, or even it it does?!

    Hope this helps
    Last edited by Wink; - 26th May 2006 at 06:13.

  14. #14
    Join Date
    May 2005
    Location
    San Diego, CA
    Posts
    8


    Did you find this post helpful? Yes | No

    Lightbulb A couple of things

    After your program senses the first button push, your isd25120 message plays, but you are not cycling out that button push, you are going straight to another loop (BEGIN).

    loop:
    iF dtmf_ready = 0 Then loop ' Check for DTMF present, if none loop again
    welcome:
    portc = %00000000
    pause 200
    ce = 0
    pause 200
    ce = 1
    begin:
    if dtmf_ready = 0 then begin 'waits for number to be depressed

    Try adding the following just after (ce = 1) and just before (begin:

    select_dtmf = 1 ' Enable the data output from the MT8870
    Pause 1 ' Pause 1 mS to let data settle
    dtmf_wait2:
    IF dtmf_ready = 1 Then dtmf_wait1 ' Loop here until DTMF signal stops
    select_dtmf = 0 ' Disable the MT8870 data output
    reset = 0
    pause 100
    reset = 1

    Also, lower down in the program you have a couple of times:

    reset = 0
    reset = 1

    That is a very fast blip to the GT pin. Try giving it a chance to see it!

    Add a PAUSE 100 between the trasistion.

    reset = 0
    pause 100
    reset = 1

    You probably notice I added this pause in the upper portion of the program too!

    I am still trying to figure out how the routines for the password work, that sure is some creative programming! Maybe some comments beside them would help others (and me) understand it. (Or is it just me?) It does compile, but not sure how it works, or even it it does?!

    Hope this helps

  15. #15
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Interesting results

    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

  16. #16
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Thumbs down

    I don't think you are looking for help....

    The code is just unreadable,
    we dont know what your "GetDTMF" or "DTMF1" is...
    What starts after the branch-command ?
    I think the stearing of the mc1..... and the isd..... is wrong or incomplete. There are pause-statements more than needed... the mc1.... isn't resetted after the first keypress....

    Why should I write any further ?

    Be shure, I'm able to write all the code, but I don't know the hardware and wiring.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  17. #17
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default My Fault

    I apologize for patronizing you. I didn't post the extra code because it is the same as before I thought. I mearly did as you had mentioned. I will not ask for your help anymore. Thanks for the help you have given me up to this point. You have pointed me in the right direction. I will continue to post my updates, in an effort maybe to help others. Thanks.

    Travin

  18. #18
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Cool

    Hi Travin,

    dont be shocked by me !

    dont stuck your head into the sand....

    I want to give you help to reach the goal, but you have to learn !!!!
    I think there are some gadgets in your circuits, we don't know...
    You have no problem in the if-then-part, you have a problem in the communication and timing with your mc- and isd-parts !
    You try to write lousy code to talk to them. You have to write subroutines which communicate in the only right way with the chips and you have to use them in your little programm !

    I don't think your little problem need such a lot of postings...
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  19. #19
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Ok

    I guess I am just confused here. The led subroutines are merely a visual aid for the debuggin process. I have about 10 different program written for this contraption. I started with each section of the main program until it worked correctly. Then I moved to the next section and so forth. When I put them all together, they don't work. Like for instance, in the previous post, the branch command didn't work. The led didn't blink on and off for 3 seconds. I know this routine is good. Also, I shouldn't have to push a button twice to go from the if then statements of the password comparison to the menu_message, but it will just sit there until I press two buttons. I know that is no where in the code so I am confused as to why it is like that. Thanks for the help, and I am not uposed to learning. I do a couple of questions for you, in your code you wrote, you have this:

    Lookup dtmf-"0",[%10101001,....... My question is what is -"0" for?

    Also,

    dtmf = 0:dtmf.0=DT0:dtmf.1=DT1:dtmf.2=DT2:dtmf.3=DT3
    LookUp dtmf,["_1234567890*#"],dtmf how does the lookup table know which number has been decoded by using this sequence: dtmf.0=DT0:dtmf.1=DT1:dtmf.2=DT2:dtmf.3=DT3

    Travin
    Last edited by Travin77; - 29th May 2006 at 00:23.

Similar Threads

  1. DTMF on a 12V car system
    By Jumper in forum Schematics
    Replies: 1
    Last Post: - 7th December 2008, 14:41
  2. DTMF output
    By din_kt in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th February 2008, 14:24
  3. DTMF Decoding?
    By muddy0409 in forum General
    Replies: 1
    Last Post: - 19th December 2007, 15:28
  4. Replies: 2
    Last Post: - 31st July 2006, 16:06
  5. Problems with DTMF Generatiom
    By Angus Anderson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2006, 21:12

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts