View Full Version : Case
Leonardo
- 31st May 2006, 03:07
Hello to all,
Can somebody give me an example of as using the instruction CASE?.
Thank you
mister_e
- 31st May 2006, 03:13
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
SteveB
- 31st May 2006, 03:18
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
Travin77
- 31st May 2006, 16:20
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
Leonardo
- 2nd June 2006, 03:23
Hello,
Thank you to all for their answers, I will make the tests and then I inform them.
Greetings
Leonard
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
Leonardo
- 2nd June 2006, 03:26
Hello,
Can you publish the circuit please?
Leonard
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
SteveB
- 2nd June 2006, 06:25
Leonard,
I am using a basic 16-key keypad, which can be bought surplus on the cheap (BG Micro (http://www.bgmicro.com/prodinfo.asp?sid=098989583333333368206192238&prodid=SWT1067&page=1&cri=keypad&stype=3), All Electronics Corp (www.allelectronics.com) 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
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.