With the improvement of social automation, the ability of human-computer interaction urgently needs to change, and develops towards a more convenient and intuitive direction. Laser therapeutic machine mainly uses the physical characteristics of laser to act on the human body to produce chemical reaction, so as to achieve the purpose of treating diseases. As a kind of precision instrument, laser therapy machine needs precise control and strict requirements of dust prevention, anti-static and moisture-proof. The input equipment of laser therapy machine adopts touch screen control, which is not only based on the above requirements, but also from the perspective of convenient user operation and intuitive interface. The application of touch screen makes the data display and data input integrated, which simplifies the whole equipment.
1 touch screen principle
The touch screen is attached to the surface of the display and used with the display. The analog electrical signal is generated by touch, converted into digital signal, and the coordinates of the touch point are calculated by the microprocessor, so as to obtain the intention of the operator and execute it. According to its technical principle, touch screen can be divided into five categories: vector pressure sensing type, resistance type, capacitance type, infrared type and surface acoustic wave type, among which resistance touch screen is more used in practical application. The resistive touch screen is composed of four layers of transparent thin, the bottom is the base layer composed of glass or plexiglass, and the top is a smooth scratch resistant plastic layer with hardened outer surface. The two layers attached to the inner surfaces of the upper and lower layers are metal conductive layers (OTI, indium oxide), which are insulated by small transparent isolation points. When the finger touches the screen, the two conductive layers contact at the touch point.
The two metal conductive layers of the touch screen are used to measure the coordinates in the x-axis and Y-axis directions respectively. The conductive layer for x-coordinate measurement leads out two electrodes from the left and right ends, which are recorded as x + and X -. The conductive layer used for y coordinate measurement leads out two electrodes from the upper and lower ends, which are recorded as y + and Y -. This is the lead composition of the four wire resistance touch screen. When a voltage is applied to a pair of electrodes, a uniform and continuous voltage distribution will be formed on the conductive layer. If a certain voltage is applied to the electrode pair in the X direction and no voltage is applied to the electrode pair in the Y direction, the voltage value at the contact can be reflected on the y + (or Y -) electrode in the X parallel voltage field. The X coordinate value of the contact can be obtained by measuring the voltage of the y + electrode to the ground. Similarly, when a voltage is applied to the Y electrode pair and no voltage is applied to the X electrode pair, the Y coordinate of the contact can be obtained by measuring the voltage of the X + electrode. The measurement principle is shown in Figure 1.
Fig. 1 measurement principle of four wire touch screen
The five wire touch screen is different from the four wire touch screen. The main difference is that the five wire touch screen leads out the four ends of one conductive layer as four electrodes, and the other conductive layer only outputs the voltage in X direction and Y direction as the measured conductor. During measurement, the voltage should be applied alternately in X direction and Y direction.
2 working principle of touch screen controller
The touch screen controller has a variety of functions. Its main functions are to apply voltage to the two directions of the touch screen time-sharing under the control of the microprocessor, transmit the corresponding voltage signal to its own a / D converter, and read the digital signal into the microprocessor under the action of the synchronous clock provided by the microprocessor SPI port. The basic structure of the controller ADS7846 is shown in Figure 2.
Figure 2 basic structure of ADS7846
Figure 1 the measurement results at touch point P are calculated as follows:
ADS7846 can set the resolution of a / D converter to 8 bits or 12 bits through the setting of register. In this system, the resolution of a / D converter is 12 bits. Then the binary output code of point P is:
Where: is the reference voltage applied to the internal A / D converter of ADS7846.
The operation of the touch screen controller is controlled by inputting control commands through the serial data input port din. The basic format of the control command is as follows:
Bit7 indicates the start of sending command, and the high level is valid. A2: A0 is used to select data input channel, 101 is used to select X coordinate measurement, and 001 is used to select y coordinate measurement. Mode defines the resolution of the internal analog-to-digital converter as 8 bits (mode = 1) or 12 bits (mode = 0). Ser / DFR is the single ended / double ended reference voltage selection bit.
PD1: pd0 is selected and set according to the needs of power saving mode. The setting of these command control bits will be applied in the program code section.
3 system hardware design
The input system of laser therapy machine consists of three parts: touch screen, touch screen controller and microcontroller. The microcontroller adopts PIC16F876, a new chip of microchip company. The internal bus adopts Harvard dual bus structure. When the internal frequency is the same, the data transmission speed is accelerated and the bottleneck phenomenon is avoided. This chip adopts reduced instruction set (RISC), which is easy to use and speeds up the development speed. It contains 8KB program memory (paging operation), 256 byte EEPROM, 368 byte ram, 8-way analog-to-digital converter, 1 universal serial port (SCI), 1 I2C interface, 1 serial peripheral interface (SPI), 3 timers, watchdog circuit (wathcdog) and many other important resources. The reuse of many peripheral interfaces makes the whole microcontroller simple and powerful.
According to the interface characteristics of data exchange between ADS7846 and microcontroller, the SPI port of PIC16F876 is selected. SPI port includes three signals: SDO (serial data output), SDI (serial data input) and SCK (serial synchronization clock). The hardware connection relationship is shown in Figure 3.
Fig. 3 hardware interface diagram of input system
This paper focuses on the design of laser therapeutic instrument input system, and the design of other hardware only gives the meaning of interface. Due to the high internal integration of PIC16F876, the peripheral interface is quite simple, but the internal register must be set to complete complex control functions.
The application software is designed according to the above design idea. Fig. 4 is the program flow chart of the main program and touch screen input detection part. Among them, the coordinate data processing usually adopts the method of looking up the table, forms the coordinates of the user’s command into a data table, and uses the obtained coordinate information to transform and quickly look up the table, so as to improve the running speed of the software.
Fig. 4 program flow chart
The following is part of the program code for the interface between PIC16F876 and ADS7846.
The design of the system makes the input extremely convenient, and the peripheral equipment is simplified. In practical application, it improves the ability of human-computer interaction and receives good social benefits. The idea of system design can be applied not only in the medical industry, but also in industrial production automation, handheld devices and other industries.