A single-chip microcomputer handles USB resistive touch screen to perfectly solve the Flying Point Problem.

Source: Internet
Author: User

This project has been in operation for four months. Two weeks to find the microcontroller internal ad touch screen information, two weeks to select both with USB and with AD appropriate microcontroller. Two weeks of testing and demonstration, draw a schematic diagram. Then make the PCB and debug the engineering code. The successful experiment function is only the first step. debugging the Flying Point and filtering the AD data are the difficulties of subsequent work.

1. Implementation principle: Use the c8051f series single-chip microcomputer with AD and USB interfaces:

Taking the 4-wire touch screen as an example, there are four lines to be taken out. They areY +, Y-, x +, and X-

The X and Y coordinates of the contact are calculated in the following two steps:

A. Calculate Y coordinates,Apply the driving voltage vdrive, Y-electrode grounding on the Y + electrode, and x + as the lead end to measure the voltage of the contact point.Because the ITO layer is uniformly conductive, the ratio of the contact voltage to the vdrive voltage is equal to the ratio of the contact y coordinate to the screen height.
B. Calculate the X coordinate and apply the driving voltage vdrive, X-electrode grounding, and Y + on the X + Electrode to obtain the contact point voltage.
Uniformly conductive. The ratio of the contact voltage to the vdrive voltage is equal to the ratio of the contact X coordinate to the screen width.

Baidu can refer to the "single-chip microcomputer internal ad for touch screen", but the information on the Internet ignores a core issue. Comparing the two lines above, the three lines are used for calculating the Y coordinate, and the X-is not mentioned -. After the experiment, X-should be disconnected. However, when calculating the X coordinate, the X-must be grounded. It is difficult to achieve simulated disconnection in this simulated/Digital hybrid power supply.

After countless headaches, I finally chose the FET as the switch. Because the internal resistance of the touch screen is M Euro, the switch must be M Euro-level.

2. Code implementation:

The main difference is that the four lines in the above two steps are constantly switched, and the voltage is measured using AD, and then the voltage is converted into coordinates, and then encapsulated into USB data and sent out.

3. Coordinates are unstable and points are resolved.

When the coordinates are unstable, the number of AD samples for each measurement coordinate is increased. I used 1000 times of sampling to calculate the average value, which is stable. The Flying Point Problem is very troublesome. When we press and lift it up, there is still an intermediate state, and the point will float, So we design an algorithm to filter out the fluctuation in a group of coordinates that exceeds the threshold value, the point is removed, but occasionally there will be a point.

 

4. For some minor issues, I followed the c8051 specifications to make an interface for the demo board download program, but found that I could not work. In desperation, find a downloadable board and connect n flying lines to the demo board. Debugging is also implemented. If you have time, I will show you.

Summary: I keep learning, but I learn by myself. A certain field cannot become a bull, so we have to seek multi-field development. In fact, the potential of people is unlimited. The key is whether there is passion and fighting spirit. I switched from a network to database system development, where I wrote software for the company's various programming languages and databases, petabytes, Delphi, C #, C ++ build, and Java are all done. Finally, they are good at C #. Later, they developed a Java Web development platform and started Java. During the period, C # was used to write some software for electronic engineers to the company, such as gamma automatic calibration, filker automatic debugging, burning OTP, maximum utilization rate of partial Film Cutting, etc. This gave the opportunity to contact electronic engineers, learn something about electronic development and buy your own Development Board. The company made LCD and touch screen, and found that everyone in the company knew USB. To improve their salary, they learned about USB and successfully implemented the USB Touch Screen project, switch internally to the Embedded Development Department. However, this project is not developed during the work period, nor is it the work content after becoming an electronic engineer, and does not belong to the company's resources. You can also share it.

 

------------------- Final solution for solving the Flying Point -----------------------

When the touch is lifted for an instant, the ideal state is a valid touch point + a touch-free state. In the process of actually raising the image, the Active Directory still samples the image. This point is invalid.

Since it is not a hardware expert, it cannot be solved physically and can only be solved from software.

After I put down this project for a few days, I suddenly got inspiration on the bus. Why don't I delay sending coordinates? The electronic delay is a short period of 50 ms, and almost no delay is felt for people (in fact, from the touch instant, to the AD sampling 512 times, to the average calculation and then from the USB upload, the latency has reached more than 100 ms, which indicates that a maximum of coordinates can be sent within one second. Open the drawing tool, and quickly touch the gibberish to see that the circle has become a line ).

It is as simple as doing it. In this way, the invalid coordinate points before being lifted are removed directly because the sampling time of an ad is delayed:

If (not the lift action)

{

Send the last coordinate via USB

}

Else

{

Send lift action

}

 

It is not easy to make a real product. This project is used for the same batch of touch screens. In a non-touch state, the voltage value sampled by the ad has a fluctuation interval. It is also impossible to manually calibrate each screen. However, purely software algorithms are not a problem, as long as it is not an inexplicable analog circuit problem, you are confident to solve it.

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.