Shop OBEX P1 Docs P2 Docs Learn Events
need code for MM74C923 Encoder and problem — Parallax Forums

need code for MM74C923 Encoder and problem

WbinHashelWbinHashel Posts: 6
edited 2014-03-04 11:48 in BASIC Stamp
Hi all,

Im senier student, im working in my project with basic stamp BS2. I was looking for code for my encoder but i didn't find. However, when Idid some test to my connection
First way:-
The encoder was connected to the keypad based on the information that given from the data sheet. The output was connected to 4 LED pins in the red board

Second way:-
We use 2 capacitor in Key bounce mask and oscillator to control the bouncing feature which happen when a key is pressed the contact bounce back and forth and settle down only after a small time delay (about 20ms). Even though a key is actuated once, it will appear to have been actuated several times. After connecting the circuit as shown in this schematic (the test was done without Microcontroller I just connect it to 4 LED and 1 pin for data available ).The output was blocked. In other word when the key pressed there is no output change in the LED all LED was OFF.

encoder.png


The result was collected based on four tries for each key. The result shows that the code doesn't equal the same key in the data sheet so there is an error.. The second way shows that the value of the key is blocked.
test.png


Im looking for solution for this problem and for code for the BS2

thanks so much

WbinHashel
577 x 414 - 44K
743 x 414 - 14K

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-02-18 14:20
    My first thought is you have a floating input. This can result in random fluctuations on the pin which can affect the output. I would recommend tying (or pulling) that input low.
  • WbinHashelWbinHashel Posts: 6
    edited 2014-02-24 09:45
    My first thought is you have a floating input. This can result in random fluctuations on the pin which can affect the output. I would recommend tying (or pulling) that input low.

    so can I use 4 resisters ( 1K resister) to pull the input low ?

    other thing .. there is a code that done for encoder? I need to test it by program.

    thanks for replay
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-02-24 11:22
    I realized the one I was using was the 74C922 (4 x 4) and it has been awhile. Looking at the datasheet it seems there are internal pull-up resistors on the device, so perhaps that is not your issue. I have actually been using the EDE1144 and EDE1188 since after 2000.
  • Hal AlbachHal Albach Posts: 747
    edited 2014-02-24 11:28
    The data sheet shows that the Y inputs are internally pulled up. Did you have a capacitor connected to the oscillator pin in the First Way? Should be somewhere around 0.1uF. For the Keybounce Mask the capacitor values are determined by how long you want the debounce, 0.01uF for 0.001 sec, 1.0uF for 0.01 sec, 10uf for 0.1 sec, and 100uF for 1 second. The outputs will source very little current at 5V, about 1.75 mA, and can sink 8 mA. Sample code can be found in the Nuts & Volts Articles.
  • WbinHashelWbinHashel Posts: 6
    edited 2014-03-01 02:17
    I realized the one I was using was the 74C922 (4 x 4) and it has been awhile. Looking at the datasheet it seems there are internal pull-up resistors on the device, so perhaps that is not your issue. I have actually been using the EDE1144 and EDE1188 since after 2000.

    its give me different code now but it different than the data sheet code. I don't know why? I will try to re program the code in this case.

    lets see what will happen
  • WbinHashelWbinHashel Posts: 6
    edited 2014-03-01 02:21
    Hal Albach wrote: »
    The data sheet shows that the Y inputs are internally pulled up. Did you have a capacitor connected to the oscillator pin in the First Way? Should be somewhere around 0.1uF. For the Keybounce Mask the capacitor values are determined by how long you want the debounce, 0.01uF for 0.001 sec, 1.0uF for 0.01 sec, 10uf for 0.1 sec, and 100uF for 1 second. The outputs will source very little current at 5V, about 1.75 mA, and can sink 8 mA. Sample code can be found in the Nuts & Volts Articles.

    its work with this capacitors but it different than the data sheet code I don't know why ?
    I will try to figure out the problem it need to be solved
  • Hal AlbachHal Albach Posts: 747
    edited 2014-03-01 05:35
    I cobbled together your circuit with a suitable driver for the LEDs and the outputs are consistent with each keypress. Pressing the same key many times produces the same output. You do understand that the output is determined by key POSITION and not by what is PRINTED on the keytop?

    My keypad and output is:
    1   2   3   A         0000     0001     0010     0011 
    4   5   6   B         0100     0101     0110     0111
    7   8   9   C         1000     1001     1010     1011
    *   0   #   D         1100     1101     1110     1111
    

    In order for your BS2 to use these outputs you will have to make a lookup table to convert the key position codes to whatever symbol is printed on the keytop. Such as.....
              LOOKUP  Index,["123A456B789C*0#D"], Result
    

    where Index is the value output by the 74C923 and Result will be whatever that key position represents.
  • WbinHashelWbinHashel Posts: 6
    edited 2014-03-01 07:16
    Hal Albach wrote: »
    I cobbled together your circuit with a suitable driver for the LEDs and the outputs are consistent with each keypress. Pressing the same key many times produces the same output. You do understand that the output is determined by key POSITION and not by what is PRINTED on the keytop?

    My keypad and output is:
    1   2   3   A         0000     0001     0010     0011 
    4   5   6   B         0100     0101     0110     0111
    7   8   9   C         1000     1001     1010     1011
    *   0   #   D         1100     1101     1110     1111
    

    In order for your BS2 to use these outputs you will have to make a lookup table to convert the key position codes to whatever symbol is printed on the keytop. Such as.....
              LOOKUP  Index,["123A456B789C*0#D"], Result
    

    where Index is the value output by the 74C923 and Result will be whatever that key position represents.

    can you please attach the code. I will test it in my circuit ..

    thanks
  • Hal AlbachHal Albach Posts: 747
    edited 2014-03-01 08:53
    Nuts & Volts Column #97 May 2003 by Jon Williams will give you all the code help you will need.

    http://www.rambal.com/descargas/libros/Nuts and Volts/4/Keypad Entry Display.pdf
  • WbinHashelWbinHashel Posts: 6
    edited 2014-03-04 06:47
    Hal Albach wrote: »
    Nuts & Volts Column #97 May 2003 by Jon Williams will give you all the code help you will need.

    http://www.rambal.com/descargas/libros/Nuts and Volts/4/Keypad Entry Display.pdf

    I used Parallax 4 x 20 Serial LCD (Backlit) from Parallax Product ID 27979 : http://www.parallax.com/product/27979

    its different than the connection in Nuts & Volts Column #97 May 2003. it used just 1 pin connected to MC. However I have 4 pin connected to MC to indicate the new data and 1 pin connected to show the data available.

    I have problem with the code I don't have any Idea how I will make it. this is my first time I use this Microcontroller.

    please help me
  • Hal AlbachHal Albach Posts: 747
    edited 2014-03-04 11:48
    Can you post what you have so far and what part of the program you are having difficulty with? Also include a wiring diagram of how things are actually hooked up. Even a photo of of your hookup may be helpful.
Sign In or Register to comment.