QST108 touch sensor interface design with PIC microcontroller
QST108 yes STMicroelectronics for the man-machine interface touch buttons control the capacitive touch sensor released. The working principle of the United States using Quantum's patented charge-transfer capacitance (QProx), supports 8 separate keys, and the option key state outputs or I2C bus control testing two kinds of work methods; the same time, through a software command enables their access to low-power mode, when there may be awakened when the button is pressed. QST108 unique AKS makes a release button is not pressed, other buttons are inactive; self-calibration and auto drift compensation function so that no manual calibration, thereby further reducing the QST108 application difficulty. Pin configuration shown in Figure 1, the pin functions as listed in Table 1.
2 QST108 way of working
2.1 key state detection output mode
QST108 with key state detection output and the I2C bus control two kinds of normal work. The high-low pins OPT1 decision QST108 specific modus operandi: high, work in the key state detection output modes; low, for the I2C bus control mode. When working in the key state detection output mode, the eight keys of the state from the pin OPT6 level decisions, directly or BCD code adopted KOUT1 ~ KOUT8 output pins. One, BCD code should be used only to use pins KOUT1 ~ KOUT4. Since the mode of operation is relatively simple, this article only discussed in detail QST108 work in the I2C bus control mode, with the PIC microcontroller interface design and precautions.
2.2 I2C Bus Control
The mode, QST108 through the I2C bus and micro-controllers. QST108 as a slave, pin OPT4, OPT3, OPT2 the input level determines the QST108 as I2C bus slave address low 3 and high 4-bit address is fixed at 0101. QST108 software configurations that provide maximum flexibility for use. Available five pins as general-purpose output port.
3 QST108 major operation commands
When the QST108 the I2C bus control mode work, primarily through the I2C bus protocol to the QST108 to send various control commands, including the initialization command, QST108 read out the status of key orders. Operation commands according to their length of the command frame is divided into short-and extended command frame. Taking into account the former has to be completed by QST108 the normal operation, this article describes only the short command frame. Its data formats, such as listed in Table 2, common commands, such as listed in table 3. Note that when QST108 receive a different order, will give a different response frame structure.
When the command for short frame structure, the command frame of the first byte of the highest bit is 1, in order to distinguish and extension commands. Command ID is a command number, from 5 data used to distinguish between different order; argument is only a bit, when the position 1 on behalf of the order parameter with a byte, if it is 0 then the command without parameters and no checksum byte; parity bit is used to generate odd parity, pay attention to the parity bit is only the first byte for the command frame (ie, the command frame in the first 1 byte, "1" the number of odd); 8-bit checksum is the command frame the first two bytes of accumulation and the low 8 bits.
If the QST108 not correctly receive command or receive an illegal order, it will give a unified response frame containing an error code (only contains one byte), as in table 4. Right QST108, the touch button and read the state command corresponding to the response data frame structures, such as listed in Table 5.
We can see from Table 4, the error frame is only one byte of data, parity bit provides the right to receive to determine whether the simple basis of the data. Error code of 6 bits, is used to distinguish between different errors. For example, the error code is 0x01, that QST108 receive an illegal order; error code is 0x11, that receives commands checksum and error and so on.
Table 5 we can see that the response from the frame length of 4 bytes, SCK1 ~ SCK8 respectively represent the state of touch buttons for one that the corresponding button is pressed, in order to 0 that the corresponding keys not pressed; the last one byte checksum, the response frame before the 3 bytes of accumulation and the low 8 bits. Needs to be emphasized is that only a low-key error code 3 valid: bit 0 indicates that QST108 ongoing calibration state; bit 1 indicates whether the current cumulative number of times the keys to the device to provide the maximum number of keys, in order to express a maximum number; bit 2 indicates whether to reach a minimum number of times according to health. Meanwhile, the need to distinguish between attention issued QST108 response frame is an error frame, or the right to receive a normal response to the command given frame structure. The solution is simple, when the software reads the response frame after the first one byte to determine the highest bit: is 0, indicating normal response; it is one that received the error frame, this time the host simply generate stop bits, and for error handling or stop operating.
4 QST108 interface circuit with the PIC
Figure 2 shows the PIC microcontroller based QST108 touch with the key test and practical circuit design. QST108 with the PIC through the I2C bus communication, the interface simple, key input section with reference to its data sheet gives a typical application circuit design approach. mcu selection PIC16F877A, its on-chip is rich in resources, MSSP module supports I2C bus protocol, the control QST108 very convenient. QST108 the IRQ pin PIC16F877A external interrupt input pin RB0 connected, as IRQ pin is open-drain output pull-up resistor must be connected. When a button is pressed, IRQ pin changes from high to low trigger PIC16F877A generate external interrupt, microcontroller reads the key state of the command issued in order to determine which key is pressed, then according to different keys for different treatment.
5 Software Design
Software components, including PIC16F877A and QST108 initialization, touch keys detection subroutine, microcontroller interrupt procedures, as well as the key test results according to various handling procedures. Due to space limitations, this article gives only read the button state PIC16F877A subroutine. Suppose QST108 device address is 0, the program is as follows:
This article focuses on the capacitive touch sensor QST108 ways of working, the major operational commands and QST108 with the PIC microcontroller interface design. QST108 allows the user to use conventional or flexible printed circuit board design capacitive touch pad 8 keys, it can be conductive ink printed on the circuit board as a sensing electrode; QST108-based applications need very few external components, each channel only a sampling capacitor and a resistor. Because of these characteristics, QST108 well suited for applications in the user can touch to respond to intelligent control interface.
Micro Controller Unit Articles
- P89C51RD2 customizable interface design, human-computer interaction
- QST108 touch sensor interface design with PIC microcontroller
- Based on single chip car super capacitor test system design and implementation
- A simple microcontroller suitable for classroom teaching experiment DEVELOPER
- MCU for electric bicycles to provide an effective drive (Figure)
- Real-time kernel μC / OS-II under the Network Monitoring System
- Based on AT89C52 Microcontroller Design SD card reader
- Based on low-power MCU Intelligent Integrated Instrument Design
- A small, highly integrated intelligent design and realization of test device
- Freescale Flexis JM family of flexible controller to start the development of USB connections
- Intelligent design dumbbell
- Automotive Burglar Alarm Monitoring System
- A STC12C2052AD improved single-chip voltage regulator control circuit
- Embedded design using C8051F020 Tester
- Based on single-chip low-power active RFID tag design
- Based on OSEK / VDX the electric power system design
- Flexible framework for the realization of MCU products easily upgrade
- Wireless Remote Control LED Clock Screen Design
- ISP-based image processing system of the PLD hardware design
- A single-chip multi-machine communication system design
Can't Find What You're Looking For?
Rating: Not yet rated