CapSense Summary of PSOC4

Source: Internet
Author: User

Psoc4 CapSense is a more practical thing, touch the button, appear a bit tall on, hehe. Today, a trial, a comparison of the data sheet, now summed up.

1, first said the principle, the official document should be the principle of speaking, do not come up to say how to use, how to configure, if you do not know the principle that can only divert, the general principle is that the sensor to obtain the size of the external capacitance and then subtract the internal reference to get a difference, the difference between the threshold value and set, If the value is greater than the threshold is considered to have a finger pressed, otherwise judged to be not pressed, it is so simple. The internal benchmark PSOC a name called a baseline. The baseline is obtained by a certain algorithm.

2, the module is capsense_csd2.1, about the configuration of the module because of the use of cheap cy8ckit-049-42xx kit, there is no so-called slider, but the film's IO through the lead out of the board, the edge is through the hole, this is enough. However, it is necessary to be aware of the need to adjust the sensitive point, otherwise undetectable.

3, here are some of the details of things.

1), the baseline official gave the following definition

The baseline value calculation is calculated at the noise threshold, for example, if I set a noise threshold of 10, and now there is noise in the environment, which causes the sensor's reading is not 0, even if there is no click button, but more than 0 is less than 10 value, assuming 5, then the baseline will become 5, However, if the noise threshold is still 10, but the noise is large, it is 20, then the baseline value will not change, still 0, and this time will be judged to have a push button.

2) hysteresis

Hysteresis is the fact that when the external capacitance increases the difference between the baseline is also increased, increasing to the threshold value is not immediately considered a touch, but need greater than the threshold value plus hysteresis value. When the external capacitance is reduced to a threshold, it is not immediately considered to be no touch, but rather less than the threshold value minus the hysteresis value before it is considered to be no touch.

3) The official recommended values for each setting

My Settings

The finger threshold is 10, the noise threshold is 5, the hysteresis is 2, the anti-jitter is 1, that is, non-shaking, using a 8-bit count.

4) for the capsense of the specific hardware part of the working principle is not very clear, only know the use of IDAC, and an external capacitor cmod, as to how it works, can not find the information.

5) Some functions are used in the software, but some data structures need to be understood first.

A few of the functions used

About Capsense_checkiswidgetactive () in fact, the comparison of two objects is the threshold and capsence_sensorsignal[], and unofficially said capsense_signal[]. The official story is unintelligible, Specially found in the English document is so written, it does not appear to be a translation problem.

So the whole process of software can actually be summed up with the change of data, first is to get the original data, get the baseline value, then the difference is obtained, then the difference and the threshold to get results, so each time to get the result requires three function 1, Updateenabledbaselines () Obtains the value of baseline and the value of sensorsignal by subtracting the value of baseline with the value of Sensorraw. 2,scanenabledwidgets () Gets the value of Sensorraw. The 3,checkiswidgetactive compares the value of the sensorsignal with the threshold value to get the result.

CapSense Summary of PSOC4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.