| 数据搜索系统,热门电子元器件搜索 |
|
AN1809 数据表(PDF) 5 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1809 数据表(HTML) 5 Page - STMicroelectronics |
|
5 / 8 page ![]() 5/8 STR71x ADC Driving an Analog Keyboard 2 SOFTWARE CONFIGURATION This software example manages the STR71x ADC configuration, and the key recognition using the ADC software library. After configuring the analog input as a high impedance analog input, the STR71x ADC has to be enabled by setting the ADC_EN bit in the PCU_BOOTCR register. This action is followed by selecting the Single Channel conversion mode and the Channel to be converted by setting the AXT bit and writing the channel number in the A[1:0] bits in the Control Status Register (ADC_CSR). Next, the prescaler has to be configured. Waiting for the availability of data in the corresponding DATA register is done by looping on the Data Available flag (DAn) in ADC_CSR register. After that, we can get the conversion result which will be calibrated. The next step is the key recognition. This part of the software consists of testing if the conver- sion result belongs to the range of the value of each key voltage. This range is defined by the lower voltage (min [key]) and the higher voltage (max [key]) that are considered as corre- sponding to the typical voltage of the key (Val [key]). This range is due to the resistor toler- ance. Once the pressed key is recognized, its number is shown on four leds connected to GPIO port 0 pins. The main program is given by the next flowchart. |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |