Also, the individual devices Latch and Load the data independently so this provides further independence. As a side note, the resistor pack may be replaced by individual 10K resistors I just happened to have a resistor pack in stock.Īs can be seen in the schematic above, the clock pin of both devices is tied together and is possible because the 74HC595 is being used as an output device and the 74LS165 as an input device so they do not interfere with each other. I originally had left out the resistor pack but learned a valuable lesson here about floating inputs and it didn't take me long to realize that the resistors were needed to pull the lines to a defined state. As each column is pulled high, the 74LS165 parallel in serial out shift register loads the current row data in and shifts it out to the controller where it is checked to see if any of the lines are at a high positive level indicating that a key has been pressed. The 74HC595 serial in the parallel out shift register is used to pull the column lines to a high logic level one by one. Pinħ4HC595 Latch - data output to parallel pinsħ4LS165 Load - data input from parallel pins Let's take a little closer look at the connector on the left in the schematic above that interfaces with the controller the table that follows defines how each line is used. The connector on the right in the schematic is for the experimenters keypad that I am using. The connector on the left of the schematic is wired to the micro controller and is not shown for brevity, but as stated earlier, may be any controller with 5 available general purpose ports. The current implementation shown in the schematic that follows is suitable for up to an 8X8 matrix, but can be extended by daisy chaining the shift registers together in any configuration desired. I won't go into the specifics of how the shift registers operate, but will instead refer you to an excellent article written by a a fellow CPian, DaveAuld, that can be found. To build the hardware for this project, we just need: one serial to parallel shift register, I am using the 74HC595 one parallel to serial shift register, in this case the 74LS165 and 8 X 10K ohm resisters. The actual keypad is very similar in appearance to that shown in the image. The hardware for this solution is controller independent, and the software can be modified to run on any processor that has general purpose I/O port capability.įor this project, I purchased a very inexpensive keypad from BGMicro that can be purchased for the paltry sum of $5.10 USD and whose schematic representation is shown in the image that follows. HardwareĪ common activity that you will likely run into when doing embedded programming is the need to scan a keypad, keyboard, or some kind of switch matrix, and as you will find the number of ports or lines needed to scan, these can add up very quickly, so what I am presenting in this article is a way to scan any size matrix type device using only 5 general purpose ports on the micro controller and just a few components. As a side note, the AVR Dragon is one heck of a tool get it. The IDE provides one of the best debugging environments of all the IDEs I evaluated, and along with the AVR Dragon I purchased for $50 that does in circuit programming and debugging, I'm in hog heaven. AVR Studio along with the WinAVR tool chain provide the tools necessary to program in the C and ASM languages, and this is the part I really like: they are both free. It was the closest thing I could find that worked for me. I researched and downloaded quite a few IDEs and for one reason or another, most just didn't give me that warm fuzzy until I discovered the AVR Studio IDE available. Once I decided on the hardware platform I was going to use, the next step was to set up the development environment. Many years have passed since, but about a year ago, I started seeing articles on micro controllers and embedded programming here on CodeProject and after corresponding with a couple of the authors, I decided that I would like to try and get back into the field I had abandoned so many years ago. I decided that there would be a better opportunity in other areas and moved to a location that I believed would afford me that chance. Many moons ago I used to do embedded programming for the automotive industry and really enjoyed it, but the time came that I had to make a career decision.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |