A little DTMF help


Closed Thread
Results 1 to 40 of 49

Hybrid View

  1. #1
    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

  2. #2
    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

  3. #3
    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

  4. #4
    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

  5. #5
    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

  6. #6
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Don't understand

    ...and smoother:

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

    or better:

    password[c]=dtmf

    this maybe will work as you expect....

    I am not quite sure what you are saying. Why did you put [c]? Are you just using c in place of numbers for the array? Thanks for the help

    Travin

  7. #7
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Back with issues

    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

Similar Threads

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