Continue to Site

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.

  • 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.

16 to 4 line encoder

Status
Not open for further replies.
danuke said:
I'm using it to encode 12 pushbuttons into a 4 bit code. It's not for a keypad per say but something similar. It's just going to take the 12 pushbuttons and make it into a 4 bit binary value so that it can be used with less traces to be run, etc on a pcb.
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.
 
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:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top