Rslogix keypad code

Discussion in 'The Projects Forum' started by collyd21, Jul 20, 2012.

  1. collyd21

    Thread Starter New Member

    Jul 2, 2012
    14
    2
    hi i have a 12 button keypad (numbers 0-9, a # key and * key). i want to be able to input a code for example 001 and then press the # key as an enter button and this will turn on output 1. i understand how to recognise each key to turn on a bit of memory. but i'm stuck on how to do a code sequence. anyone any ides thanks
     
  2. BSomer

    Member

    Dec 28, 2011
    433
    106
    Is the keypad a matrix type or is there one common pin and a pin for each key? One way to do it if you have the common pin type is to set a bit in memory for each key then use the math and/or compare functions to evaluate what was pressed to do something.
     
  3. collyd21

    Thread Starter New Member

    Jul 2, 2012
    14
    2
    hi this is the keypad
    http://www.sparkfun.com/products/8653

    its set up in matrix format. i can't figure out how to write the ladder diagram for a sequence of keys pressed. ideally i want to be able to pressed a 3 digit code and the use the # key as an enter key, and the * key as a clear key if wrong code inputed, to turn on differnet outputs.
     
    Last edited: Jul 20, 2012
  4. BSomer

    Member

    Dec 28, 2011
    433
    106
    Sorry for the long delay in a response. I have been pretty busy lately and technically do not have much time to put into this. I am going to bring this thread to the attention of another member who is pretty knowledgeable with PLCs so maybe he can help you out.

    I did have another question or two for you though. How are you connecting the keypad to the PLC and how are you recognizing each key press to turn on a bit in memory?
     
  5. collyd21

    Thread Starter New Member

    Jul 2, 2012
    14
    2
    my keypad has 7 pins one for each row and each column (3 columns, 4 rows) i'll be connecting each pin as an input to plc. a key pressed is recongised by a cicuit between two pins.

    KEY------------ PINS COMBINATION
    1: 3+2
    2: 1+2
    3: 5+2
    4: 3+7
    5: 1+7
    6: 5+7
    7: 3+6
    8: 1+6
    9: 5+6
    *: 3+4
    0: 1+4

    #: 5+4
    SO TO SEE KEY NUMBER 1 PRESSED I'LL WRITE

    [
    pin3]-----[pin2]---------------------------------------------------------(m:1)
    [m1]----------------------------------------------------------------------------(o:1)
    but iwant to be able recongise a code sequence off key press and then maybe a #key as enter but to enter code so that different codes turn on different outputs
     
  6. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    I still don't have a handle on what your question is. Is it in scanning the keypad, or the routine for storing/deciphering the input?

    Scanning the pad typically would consist of sequentially outputting on a column (or row), while sequentially reading the row (or column). Throw in some debounce, compares for backspace, enter, clear, or whatever, loop for your digit count feeding an array, then a final compare. You haven't told us what RSLogix your using, which will make a difference. Personally, I'd embed that keypad and send your data chunks over on some serial comm.
     
    Last edited: Jul 31, 2012
  7. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    In your previous thread, you said you were using a Mitsubishi PLC with GX developer. Have you changed over to an Allen Bradley?

    I'm sorry but I don't know the proper way to do what you want. The only thing I can come up with is an incredibly long, over complicated, kludge of ladder.
     
  8. BSomer

    Member

    Dec 28, 2011
    433
    106
    I have given this some thought. I foresee a few issues with using the keypad you have. The first and foremost is that most input modules for PLCs are like an input on a microcontroller or any other logic device, they require a change in state from high to low or low to high. The way you are describing your set up is basically connecting two inputs together when a button is pressed. This does not change its state.

    I agree with GetDeviceInfo that to embed this keypad and use a serial communications would make the project easier. Another option would be to use, or make, a keypad that has one common pin to all the switches. This would not require figuring out how to do the communications.

    However, if you get the PLC to recognize your inputs and can set a bit in the B3:XX file you should be able to compare the result with a stored N7:XX word. The compare instruction "EQU" would be triggered by the # key. If a mistake is made when pressing the keys the * key can be used to trigger the instruction "CLR" to clear the B3:XX file and you can then start over.

    This all hinges on using the proper type of input to the PLC, which I do not think you currently have. Though I have been proven wrong before.
     
Loading...