Case


Closed Thread
Results 1 to 7 of 7

Thread: Case

  1. #1

    Talking Case

    Hello to all,

    Can somebody give me an example of as using the instruction CASE?.

    Thank you

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Code:
    select case Avar
        Case 1 
            ' blah blah blah
        Case 2
            ' ZZZzzzzZZZZ
        Case 3
            ' Swing la baquaisse dans le fond d'la boite a bois
        Case NothingWork
            ' Read PBP manual... everything is explain black on white
        END SELECT
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Leonardo,
    Here is a file that uses the SELECT CASE. It is a templete for decoding and then acting on different buttons from a 16 key pad. I use it as an "INCLUDE" to add the routines to the project. Only a couple of CASEs have any meaningful actions in them at this point. Hope it helps.

    Steve
    Attached Files Attached Files

  4. #4
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Here you go

    Select case dtmf ' dtmf is the variable that I am comparing the cases to
    case "1" 'this says if dtmf = "1" then
    portc = %10010111 'do this
    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 ' gets you out of the case statement like endif

    This is the general gist of it. I too just learned how this thing works.

    Travin

  5. #5


    Did you find this post helpful? Yes | No

    Talking Case

    Hello,

    Thank you to all for their answers, I will make the tests and then I inform them.

    Greetings

    Leonard




    Quote Originally Posted by Travin77
    Select case dtmf ' dtmf is the variable that I am comparing the cases to
    case "1" 'this says if dtmf = "1" then
    portc = %10010111 'do this
    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 ' gets you out of the case statement like endif

    This is the general gist of it. I too just learned how this thing works.

    Travin

  6. #6


    Did you find this post helpful? Yes | No

    Talking Case

    Hello,

    Can you publish the circuit please?

    Leonard



    Quote Originally Posted by SteveB
    Leonardo,
    Here is a file that uses the SELECT CASE. It is a templete for decoding and then acting on different buttons from a 16 key pad. I use it as an "INCLUDE" to add the routines to the project. Only a couple of CASEs have any meaningful actions in them at this point. Hope it helps.

    Steve

  7. #7
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Example with Schematic

    Leonard,
    I am using a basic 16-key keypad, which can be bought surplus on the cheap (BG Micro, All Electronics Corp are a couple places that carry some).

    Here is a link that has info on setting up a keypad matrix. The matrix size can be adjusted as required for your application:
    http://www.rentron.com/serkey16.htm

    Or do a google search (that's how I found the link).

    Steve
    Last edited by SteveB; - 2nd June 2006 at 06:47.

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. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  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