Help needed with Select Case?


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default Thanks

    Happy New Year everyone!

    Thanks so much tenaja, Jerson & Darrel

    Hi Darrel,

    Your code sure looks good, I can't wait to try it out. I'm at a friends place visiting for a while so I can't try it out until I get home but it'll be the first thing on my to do list.....

    Thanks Again
    jessey


    Code:
    combocount VAR BYTE
    
    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
    
        IF (combocount = 0) AND (dtmf_digit = 2) THEN GoodKey
        IF (combocount = 1) AND (dtmf_digit = 4) THEN GoodKey
        IF (combocount = 2) AND (dtmf_digit = 5) THEN GoodKey
        IF (combocount = 3) AND (dtmf_digit = 7) THEN GoodKey
        IF (combocount = 4) AND (dtmf_digit = 3) THEN GoodKey
        IF (combocount = 5) AND (dtmf_digit = 1) THEN GoodKey
        IF (combocount = 6) AND (dtmf_digit = 6) THEN GoodKey
        combocount = 0     'invalid keypress
    IF k = 0 THEN listen
    
    GoodKey:
        combocount = combocount + 1
     IF combocount = 6 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
    IF k = 0 THEN listen

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Thumbs up

    There ya go.
    With no PIC or compiler in front of you .... Pretty good!

    Just a couple comments for when you get home.

    Make sure the program can't accidently "Fall" into the GoodKey routine.
    If it does fall-in, it was a bad key, so you definately don't want to run the GoodKey routine.

    And the example has seven digits.

    IF combocount = 7 THEN have a

    Happy New Year!
    DT

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  3. Write Onewire data toa I2C memory / read ASCI
    By Eugeniu in forum mel PIC BASIC Pro
    Replies: 67
    Last Post: - 16th November 2008, 19:19
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  5. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 22:05

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