Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing Memkey 4*4 Keypad and BS2 — Parallax Forums

Interfacing Memkey 4*4 Keypad and BS2

redaleoredaleo Posts: 8
edited 2008-11-27 04:07 in BASIC Stamp
I need help sending a High Voltage to pin 12 when Button 1 is pressed on the Keypad.
Connections
Memkey························· BS2
VDD··Connected·with······· VDD
GND··Connected·with······· GND
TM····Connected·with······· P15
·FM···Connected·with········ P14
KEY··Connected·with·········P13




K0
K1
K2
K3
K4
K5
K6
K7
Row0
Row1
Row2
Row3
Col0
Col1
Col2
Col3

Comments

  • Lab RatLab Rat Posts: 289
    edited 2008-10-15 23:58
    i also would like to know how to interface a matrix keypad with the stamp so i will definately be watching

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax posesses power beyond belief.

    Believe in it.
  • redaleoredaleo Posts: 8
    edited 2008-10-16 00:24
    Do u know where can I get a sample code that's related with this topic?
  • Lab RatLab Rat Posts: 289
    edited 2008-10-16 00:30
    it still confuses me

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax posesses power beyond belief.

    Believe in it.
  • Lab RatLab Rat Posts: 289
    edited 2008-10-16 00:32
    from what i seen it only states that a button has been pushed not which one now how do i get in to light Different leds with the keypad

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax posesses power beyond belief.

    Believe in it.
  • $WMc%$WMc% Posts: 1,884
    edited 2008-10-16 00:42
    ·redaleo and labrat

    ··· I have used the MEMKey w/ great succ.s w/ the BS2...Checkout the super short progarm I attch.

    ·································································· $WMc%________out
  • redaleoredaleo Posts: 8
    edited 2008-10-16 01:23
    1) The code is short a and perfect.Thank you.
    2) can you help me send a High voltge to any pin I want.
  • $WMc%$WMc% Posts: 1,884
    edited 2008-10-16 02:01
    redaleo

    ···· Here's the MOD. I still don't know for sure what Matrix Your useing But I think this will work if the other program worked.
    ··· ALL BALLED UP,·I sent the wrong·file;I have attch. the rite one

    ······························· _____________$WMc%______out__


    ·································

    Post Edited ($WMc%) : 10/16/2008 2:40:14 AM GMT
  • redaleoredaleo Posts: 8
    edited 2008-10-16 02:38
    Code 2 is working as well. Thank you for your help. I will get back to you if I need more help.
  • redaleoredaleo Posts: 8
    edited 2008-11-20 06:00
    I'm trying to display an error message ever time one of these pins receive a high voltage. The LCD Keep dispaying "Warning Container A is empty" wether pin 3,4,5,6,7 is High or Low. Can you please explain what's wrong with my code.
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2008-11-20 08:43
    · You need to·reorganize your program.· You can see that nothing is stopping your program from flowing into the FLOW_SWITCH1 subroutine.· It doesen't matter what condition IN3 is.· If IN3=0 it will still go there.· You need a main program loop which contains basic functions and loops by itself without any subroutines contained within it.· Inside this loop you can get user input and check flow valves (or you can make calls to routines that will accept user input and check the flow valves).· The idea here is to have a main program that loops without "leaking" down into the subroutines.·You also don't have subroutines for buttons 6 and 7.·

    '
    MAIN
    · Main:
    ··· 'call appropriate routines in the proper sequence
    ··GOTO Main
    '
    SUBROUTINES
    ·FLOW_SWITCH1 :
    ·· SEROUT 1, 32, [noparse][[/noparse]"WARNING!! Container A is empty" ]
    ·· RETURN

    ·FLOW_SWITCH2 :
    ··· SEROUT 1, 32, [noparse][[/noparse]"WARNING!!Container B is empty" ]
    ··· RETURN·

    Post Edited (Mikerocontroller) : 11/20/2008 8:50:10 AM GMT
  • redaleoredaleo Posts: 8
    edited 2008-11-27 02:08
    If in=1 the lcd displays "warning container a is empty" and also displays "drink is processing" and then "drink is complete". I only want the LCd to display "Warning container A is empty "and then go back to MAIN_MENU1 subroutin. Can anyone help. Thanks
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2008-11-27 03:53
    · You need to take advantage of the RETURN statement when you use GOSUB.· Your subroutines end with GOTO's and this can lead to confusion.·· If you use RETURN istead of GOTO your program will return to the next instruction after GOSUB and keep your program under control.· If you think of the main program as the supervisor and the subroutines as workers you will see how its important to keep control of the program in the main routine.· If you send a worker out to do a task and he does not return to you when he's done ( instead he tells the next worker what to do ) you will quickly loose control of the situation.·
  • redaleoredaleo Posts: 8
    edited 2008-11-27 04:07
    I just fixed the problem by adding an Else to my If statement and the RETURN Statement. The program is working just fine. Thanks
Sign In or Register to comment.