Kanda specialises in providing a wide range of programming utensils for clients. This includes Atmel ICE devices as well as many others. We help people all across the globe. The goal here is to set you up with something that suits your specifications. At the same time, we want you to have equipment that will last for years to come.
The topic we wish to discuss in this post is saving microcontroller input output pins. It is the design engineer’s responsibility to get the most capability and performance out of their available resources. They must do this in line with the budget and specific application requirement scenarios.
We will be using the Atmel 89S52 microcontroller as an example to discuss the subject. However, you will also be able to use this information with every other kind of microcontroller. This is without any configurations or changes too.
Interfacing keys
Normally, in order to interface 3×2 keys (or 6 keys), we will require six IO pins of microcontroller to take inputs. In standard practice though, it is typically best to use matrix scanning methods. This is to interface more keys where they are set out in row-column formats, which you can then scan individually. In such instances, you will require three rows and two columns in order to interface 3×2 keys. Thus, you shall still require 5 IO pins for interfacing.
There is also another technique you can use to further reduce the necessary IO pins. For this approach, you will require some extra, but less costly, hardware. The keys are going to be linked in a set of three keys each. Every set comes with a compact signal switching diode linked in series. The direction of diodes in every set will be reversed in one set as against another. Contact our team if you require first rate Atmel ICE products.
Determining which keys you have pressed
To figure out which key has been pressed, you have to deploy a certain algorithm. Firstly, you should set pin P0 to logic HIGH. As for P1 and P2, they need to be at logic LOW. Following this, after fractional delay, you need to read the input status at P1 and P2.
If you find P1 at HIGH, then the path P0-B2-D2-P1 is complete. You have pushed button B2. However, if you find P2 at HIGH, then P0-D5-B5-P2 is complete. You will have pushed button B5. Likewise, when you set P1 to HIGH, and keep P0 and P2 LOW, you can identify B1 and B4. As for buttons B3 and B6, you can detect them by setting P2 to HIGH. You then read the status of P0 and P1 respectively.
Shop with us for quality Atmel ICE goods
At Kanda, we have a full range of programming and development products available for purchase. This includes an AVR trainer with ICE, a starter kit, and cables for the device. Each one is affordable. In addition, the kit will assist you with getting to grips with microcontroller programming. As a result, you will learn everything you need to know.
So, if there is anything we can do for you, please get in touch. You can view the Atmel ICE products on our website too. There is lots of info, including overviews and guides.