1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

16 to 4 line encoder

Discussion in 'Datasheets, Manuals or Parts' started by danuke, Nov 8, 2007.

  1. hysteresis

    hysteresis New Member

    Jul 27, 2007
    Liverpool, UK
    A simple solution, which you might consider, would be to use an EPROM to perform the encoding. A 4096 x 8bit device (such as a 2732A) has 12 address lines - one for each pushbutton, with only four of its data lines required for your binary encoded output.

    The binary output code would have to be programmed into just 12 memory locations - those accessed when a single address line is asserted, e.g.

    address 0000 0000 0001 would hold 0000 0001
    address 0000 0000 0010 would hold 0000 0010
    address 0000 0000 0100 would hold 0000 0011
    address 0000 0000 1000 would hold 0000 0100
    address 0000 0001 0000 would hold 0000 0101

    and so on, up to

    address 1000 0000 0000 would hold 0000 1100

    All other locations could be filled with zeros, so that if two (or more) buttons were pressed simultaneously, the output would be zero.

    2732 type EPROM's are now obsolete (superseded by much higher capacity devices), though they can still be regularly found on a certain auction web site. Alternatively, a higher capacity device could be used, with the unwanted extra address lines tied to ground.
  2. danuke

    danuke New Member

    May 14, 2006
    I like the EPROM chip approach and got a few from my neighbor who had some spares from where he used to work. Will definitely try my hand at EPROM programming to see what it has to offer.

    Is there a good dumbed down tutorial site that can help me learn how to use the software to program the PIC using the inchworm? I find that I usually learn better by seeing the code that does a function and see comments with what certain lines do with it. Sorry if I should have started a new thread for the preceding questions about PICs.

    Thanks again for all the help.
    Last edited: Nov 17, 2007

Share This Page