Design and implementation of two-wire keyboard (AD key) circuit

Publisher:沈阳阿荣Latest update time:2011-09-30 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

When developing a single-chip microcomputer project, keyboards are often needed, and most of the time, keyboards use single-button or matrix keyboards. Matrix keyboards have many advantages, and I won't go into details here, but one thing is that a few more buttons will waste the port line, especially when the keyboard needs to be led out, the long and long lines are very annoying. Next, I will talk about the design and implementation of a two-wire multi-button circuit. The keyboard only needs two wires, provided that your single-chip microcomputer system has an extra AD port line. At this point, someone will ask, my system does not use analog acquisition, and I have to add an AD chip to get this keyboard. Isn't this a loss of the greater for the less? What I want to say is that there are quite a lot of single-chip microcomputers with AD functions now, and the price is not much more expensive than those without. Of course, if you choose one without AD, it's another matter.

I encountered several situations when I was working on a project key: 1. The product has many peripherals, and the microcontroller I/O port has only one I/O port except the keyboard, and there is no extra one; 2. Due to the limitations of the site, the keyboard and the motherboard must be a certain distance away; 3. The keyboard needs 9 keys. According to the above situation, a two-wire keyboard is the most suitable. The circuit is shown in the figure.

Some buttons are omitted in the figure, and you can configure the buttons according to your actual needs. At this time, you can scan and read through AD, and judge whether a button is pressed or which button is pressed according to the AD value. According to the resistance value in the above figure (for the convenience of example, all values ​​are 1K, you can choose other resistance values, and the voltage is evenly distributed as much as possible), you can calculate: if no button is pressed, the AD value is VCC; S1 is pressed, the AD value is 0; S2 is pressed, the AD value is 1/2VCC; similarly, S3=2/3VCC; S4=3/4VCC; S5=4/5VCC; according to the AD acquisition value, the key value that is closest to it is the key.

There are a few points to note when using this method: 1. Do not have too many buttons, which is related to the AD resolution, otherwise the detection will be inaccurate. For example, with an 8-bit resolution, there are 256 points in total, and it is best if each button has more than 25 points. That is, 256/25=10, a maximum of 10 buttons. You can experiment on your own.

2. Choose buttons with good contact. Poorly-made buttons will easily generate contact resistance after a long period of use, and multiple buttons are prone to misdetection.

Reference address:Design and implementation of two-wire keyboard (AD key) circuit

Previous article:Realization of radio simulation training system based on single chip microcomputer
Next article:Improved float type liquid level meter based on MSP430F133 single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号