Design and implementation of interface between 8096 series single chip microcomputer and touch screen chip

Publisher:等放假的LwjLatest update time:2012-04-26 Source: OFweek Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the rapid development of science and technology, the progress of human demand for civilized life has brought about an increasing demand for electric energy , and also brought about higher requirements for power system equipment. Therefore, the functions and detection equipment of power system distribution transformers have received close attention from all parties. Various power detection equipment are constantly being refurbished in the market, and their functions are also developing in the direction of practicality and high technology. However, there are few reports on distribution transformers with human-machine friendly interface functions and detection equipment with touch mode. For this reason, after many aspects of research, we propose the task of developing distribution transformer intelligent detection equipment using touch mode and GPRS wireless communication function. On the premise of meeting the requirements of power distribution function, the equipment adopts touch display mode to improve the operability of the detection equipment, and uses GPRS wireless communication to improve the advancement of the equipment and meet the management needs of the modern information society, so that it has certain unique advantages and can occupy a certain market field.

1 System Design

The core of the system is the advanced INTEL96 series 16-bit single-chip microcomputer 80196, equipped with LCD display touch screen, large-scale gate array logic integrated circuit xilinx95144, and external GPRS module through serial port driver circuit MAX232, etc. It has a simple structure, complete functions, strong expandability, reasonable layout, few chips, small size, and high reliability and confidentiality. The schematic diagram is shown in Figure 1.

Figure 1 System Schematic Diagram

1.1 Main functions of each functional module

(1) CPU80196 is mainly responsible for the control center and the arithmetic and logical operations of 16-bit data in the system. This single-chip microcomputer has rich software and hardware resources and a fast-running instruction system, which is very suitable for the instrument design of the power system.

(2) The large-scale logic circuit chip Xilinx95144 mainly completes: address latching, data bus drive, control signal bus drive and logic level conversion, chip select signal generation, etc. It has 144 macro units, 3200 logic gates, 100 pins, 81 data input and output pins, 4 online programming pins, and can complete 10,000 times of online programming.

(3) MAX232 serial port driver: Completes the serial port level TTL to RS232 conversion function.

(4) GPRS module: It is a new type of mobile data communication service, which provides a connection between mobile users and data networks , and provides high-speed wireless IP services to mobile users. It adopts completely transparent data transmission, is always online, and charges according to traffic. It overcomes the shortcomings of short communication distance and unstable performance, and truly achieves seamless coverage across the country, especially suitable for unattended areas.

(5) 27512EPROM program memory, providing 64KByte of program storage space, mainly for storing system programs.

(6) 62256 static RAM data storage, providing 64KB data storage space, mainly for storing collected data, with built-in battery to ensure that data is not lost in the event of power failure.

(7) The DS1302 calendar chip can automatically calculate the year, month, day, hour, minute, and second according to the settings, and can also realize an alarm clock. It mainly enables the system to collect data at regular intervals.

(8) CAN is a bus-type serial communication network with strong error correction capability and support for differential transmission and reception, which makes it suitable for high-noise environments and has a relatively long transmission distance. In the system, we use the SJA1000 chip. Through correct connection and setting, all functions of the CAN bus physical layer and data link layer can be automatically completed.

(9) Switch drive circuit: It mainly provides voltage and current to various switching power supplies and AC and DC motor speed control systems. In the system, we use a combination of digital circuits and analog circuits.

(10) LCD display and touch screen: To provide a friendly human-computer interaction interface, we chose the DG-32240-27-SNCW-HCDTC LCD display touch screen produced by Taiwan AM PIRE Company, which has 320 × 240 display pixels and a touch size of 160 × 110 mm. The display part control chip is SED1335, and the touch part control chip is ADS7843.

1.2 System Debugging

During the debugging of the system, all functions and electrical indicators met the pre-design requirements, but there were several problems such as the instructions between the touch screen and the microcontroller were not executed, and even the chip ADS7843 in the touch screen was burned out.

2 Hardware Design Analysis

According to the hardware connection, the P3 and P4 ports of the microcontroller are connected to the LCD display through Xilinx95144, and the touch screen is directly connected to the P1 port of the microcontroller. The operating voltage of the three is the typical value of 5V recommended by the manufacturer.

2.1 80196KB MCU Structure

80196KB is one of the 16-bit single-chip microcomputer MCS_96 series products launched by INTEL after the 8-bit single-chip microcomputer. Compared with the 8-bit single-chip microcomputer, it improves the real-time performance of the control system. Compared with the current 32-bit single-chip microcomputer, it is a real single-chip microcomputer, especially suitable for various automatic control systems. Its internal structure adopts the Princeton architecture, also known as the Von Neumann structure. It has the characteristics of combining program memory and data memory into one. Its P0 port can only be used for input, P1 port is a quasi-bidirectional port, P2 port is a multi-function port, and P3 and P4 ports are bidirectional ports that can be used as system buses.

In the circuit of this system, the P1 port is used to interface with the touch screen. The internal pin structure of the P1 port is shown in Figure 2. The P1 port is a quasi-bidirectional I/O port, which consists of an output buffer, an internal port latch, an internal port register and an output buffer. It is the same as the quasi-bidirectional port of MCS51 and has an internal pull-up resistor structure. As shown in Figure 2, the pull-up effect is generated by three FET tubes, among which p1 is a strong pull-up, p3 is a weak pull-up due to the high resistance, p2 is an even weaker pull-up, and n is a low-resistance pull-down FET.

Figure 2 Internal structure of quasi-bidirectional port P1

When reset, the P1 port is weakly pulled up. When used as input and output functions, the principle is: "Input": When the P1 port inputs data, it is actually input into the P1 port register, and the register drives the pin. In Figure 2, /Q is the output of the register. When the CPU reads data, it reads the pin directly. Therefore, when reading data, it is necessary to ensure that the P1 port is in the input state. The P1 port register SFR should be set first, and n is cut off at this time. Remember that when the port is used as an input port, never write data "0" to the port. "Output": In this state, when the instruction inputs "0" to the I/O port register of port P1.x, the /Q output of the internal register will turn on the pull-down FET, i.e. n, and turn off all the pull-up FETs, i.e. p1, p2, and p3. At this time, the corresponding output pin level PORT PIN is "0"; when the instruction inputs "1" to a certain I/O port register of port P1, the /Q output of the internal register will turn off n and turn on p1, p2, and p3. At this time, the corresponding output pin level PORT PIN is "1", that is, the output is a process of direct "writing" by programming.

2. 2 X ilinx95144

It is a high-quality Complex Programmable Logic Device ( CPLD ), with a typical operating voltage of 3.3-5V, supporting ISP, i.e. online programming, and can be programmed up to tens of thousands of times. The pin-to-pin signal delay is 7.5ns, and the operating frequency can reach 111MHz. There are 144 macro units inside, all of which are ROM structures. The internal logic data will not be lost after power failure. Each I/O pin is in the output state: the typical value is -4mA when the high level is high, and the typical value is 24mA when the low level is low; each I/O pin is in the input state: both the high and low levels are in the uA level. Therefore, the output electrical characteristics: In the usual TTL level chip circuit, when there are not many external drivers, the pull-up resistor can be used; Input electrical characteristics:

General integrated chips can be directly connected to it without the problem of insufficient driving force or damage.

2. 3 Touch Display

The control chip of the display part is SED1335, which is a special controller for LCD screen produced by EPSON Company of Japan . It has the strongest function compared with similar products. Its main features are: I/O buffer with strong functions; rich instruction functions; 4-bit data parallel transmission; mixed display of graphics and text. The control chip of the touch part is analog data converter ADS7843, which is an 8-bit, 12-bit data output and four-wire resistive touch screen analog-to-digital conversion interface chip produced by Ti Company of the United States with synchronous serial interface. It communicates with CPU through standard SPI protocol; high precision, when using 12 bits, the precision reaches 0. 04mm, and can reach 1/256, 1/4096 precision in X and Y directions; maximum acceptable current? 50mA, typical value is several uA; working voltage is -0.3-+6V; working clock typical value is 2MH z, which is on the order of uS; when the touch screen is pressed (i.e. a touch event occurs), ADS7843 will issue an interrupt request.

After several problems occurred, we found that the display part was normal, but the touch part was not normal, that is, there was a problem with the use of ADS7843. Its internal structure schematic is shown in Figure 3. From the figure, we can see that it mainly consists of four-channel signal converter, successive approximation register (SAR), capacitive data/converter (C DAC ), comparator, serial interface and controller functional modules. Among them, the programming-related signals are DCLK, /CS, DIN, DOUT, BUSY, /PENIRQ, and the data flow is shown in Figure 4.

Figure 3 AD7843 internal principle structure

Figure 4 ADS7843 interface diagram

For ADS7843, in addition to the power supply and ground wire, the input analog signals are X+, X-, Y+, Y-, IN3, IN4, the input digital signals are DCLK, /CS, DIN; the output digital signals are BUSY, DOUT, /PEN IRQ. All the programming-related signals are digital signals. The data input, output, and clock input are all serial. The maximum conversion rate is 1/125KH z. The circuit design structure is relatively convenient. Only 6 port lines are needed for the microcontroller to establish complete data interaction.

2.4 Phenomenon Analysis

It is completely possible to use the 6 ports of the P1 port of 80196 to deal with it from the hardware point of view. However, in programming, some ports of the P1 port are used as inputs and some ports need to be used as outputs. The 80196 does not have instructions for direct bit operations. To perform output operations on a certain port of P1, 196 usually reads the 8 pins of the P1 port first, and then performs the "write!" operation. According to the structure of the P1 port, if the pin used as the input port is low, the input state of the pin will be changed to the output state after executing the "write!" instruction. At this time, the two lines of DOUT and /PEN IRQ of 80196 and ADS7843 will have two output signals on the same line, competing for signals, which is absolutely not allowed in digital circuits. Its appearance may damage the chip.

According to the information, in programming operations, when some pins in the P1 port are used as inputs and some pins are used as outputs, special attention should be paid to the write instruction operation of the P1 port. It is a read and write process, and it is best to use some units.

3 Software Design Analysis

For key processing, the system adopts interrupt method, and the process is shown in Figure 5.

Figure 5 Key flow chart

The main relevant procedures are as follows:

/* Touch screen write control instructions, read data subroutine* /

LDB R6, # 08H; write 8-bit control instruction code

CLRC; LDB AL, COM; Command code ready to send

ADS7843_W: SHLB AL, #1; Data serial transmission

JC S_DI_1; JMP S_DI_0

S_DI_1: LDB BL, IOPORT1; save the status of port P1 in the BL register

ORB BL, # 03H; Set the data output DOUT high, and the data input DIN is the signal input state

LDB IOPORT1, BL ; Send the modified status to port P1

JMP SKCLK

S_DI_0: LDB BL, IOPORT1; save the P1 port status in the BL register

ANDB BL, # 0FEH; Set data output DOUT low

ORB BL, # 02H; Data into D IN is signal input status

LDB IOPORT1, BL; Send the modified status to port P1

SKCLK: LDB BL, IOPORT1; Save the P1 port status in the BL register

ANDB BL, # 0F7H; Clock signal DCLK is low

ORB BL, # 01H; Set data output DOUT high

LDB IOPORT1, BL ; Send the modified status to port P1

LDB BL, IOPORT1; Save the P1 port status in the BL register

ORB BL, # 09H; Clock signal DCLK is high, set data output DOUT high

LDB IOPORT1, BL ; Send the modified status to port P1

DJNZ R6, ADS7843_W; 8-bit instruction sent

LDB BL, IOPORT1; Save the P1 port status in the BL register

ANDB BL, # 0F7H; Clock signal DCLK is low

ORB BL, # 01H; Set data output DOUT high

LDB IOPORT1, BL ; Send the modified status to port P1

/* Prepare to receive 14-bit data from the touch screen key, first receive the lower 8-bit data* /

LDB R6, # 08H; Key value setting direction read lower 8-bit data program

DATA_OUT: LDB BL, IOPORT1; Save the P1 port status in the BL register

ORB BL, # 09H; Clock signal DCLK is high, set data output DOUT high

LDB IOPORT1, BL ; Send the modified status to port P1

LDB BL, IOPORT1; Save the P1 port status in the BL register

ANDB BL, # 0F7H; Clock signal DCLK is low

ORB BL, # 01H; Set data output DOUT high

LDB IOPORT1, BL ; Send the modified status to port P1

SHLB AL, # 1; data shift left one bit

JBS IOPORT1, 0, DI_O_1; judge whether data input to DIN is high?

ANDB AL, # 0FEH; data into DIN low, input 0

JMP DATA_OUT1

DI_O_1: ORB AL, # 01H; data into DIN high, input 1

DATA_OUT1: DJNZ R6, DATA_OUT; 8-bit data read

STB AL, FIRST; The lower 8 bits of data are saved to the FIRST unit and the upper 4 bits of data are also processed.

…… …… ; After reading 4 bits of data, the data is saved. After reading 14 bits of data, the program returns

After debugging the program on the machine, there is no problem of failure to execute instructions between the touch screen and the single-chip computer, and burning the touch chip. You may find that in the program programming, we use the BL register as the transition protection unit of the P1 port, and use the bitwise OR and AND method to output the output signal to achieve the output "1" and "0" levels. Ensure that the input port of P1 will not change its state due to the operation of other P1 ports, and there will be two outputs on the signal line, competing for the signal. This is the main reason for the problem of the touch screen.

4 Conclusion

During the project appraisal, the experts gave the conclusion that the system has a novel design, reasonable structure, relatively complete functions, strong scalability, and a certain market space. They especially mentioned that each touch key is reasonably designed and reflects the correct conclusion.

At the end of this project, there was still a legacy issue about the buttons: because it was working in single-ended mode, and after the CPU received the request, in order to eliminate jitter and prevent false triggering, it responded to the request after a delay, resulting in slow button response. This is a problem that needs to be improved in both hardware and software. The hardware needs to be replaced with an analog data conversion chip, and the delay in the software can be shorter.

Keywords:MCU Reference address:Design and implementation of interface between 8096 series single chip microcomputer and touch screen chip

Previous article:Design of VGA Display System Based on Embedded CPU S3C2440
Next article:Design and implementation of low-cost photoelectric tracking intelligent vehicle

Recommended ReadingLatest update time:2024-11-16 15:23

STC15F104W MCU four-way button cycle switch program
Use one button to control four relays to conduct in a cycle. The program is changed from the 51 single-chip program to the STC15F104W. The first button is pressed, the first relay is energized, the second button is pressed, the second relay is energized, the first relay is released, and so on. The original idea is to
[Microcontroller]
STMicroelectronics launches STM32WBA5 series of microcontrollers: strengthening IoT connectivity and security
STMicroelectronics (ST) recently announced the launch of the new STM32WBA5 series of microcontrollers. This series not only inherits the STM32 family’s fine traditions in performance, energy efficiency and ease of use, but also significantly improves wireless connectivity and security. to meet the growing demand for I
[Internet of Things]
STMicroelectronics launches STM32WBA5 series of microcontrollers: strengthening IoT connectivity and security
51 MCU PID algorithm program (III) Incremental PID control algorithm
When the actuator requires not the absolute value of the control quantity but the increment of the control quantity (for example, to drive a stepper motor), the PID "incremental algorithm" is needed.           The incremental PID control algorithm can be derived from equation (2-4). From (2-4), the output value
[Microcontroller]
51 MCU PID algorithm program (III) Incremental PID control algorithm
Pebble smartwatch uses STM32F205RE MCU
The STM32F20x series is based on the high-performance ARM®Cortex™-M3 32-bit RISC core with an operating frequency of up to 120MHz. The series integrates high-speed embedded memory, Flash memory and system SRAM with capacities of up to 1M bytes and 128K bytes respectively, up to 4K bytes of backup SRAM, and a large num
[Power Management]
Pebble smartwatch uses STM32F205RE MCU
Design of ultrasonic cleaning machine based on STC single chip microcomputer
  With the continuous development of ultrasonic technology, ultrasound is widely used in detection, cleaning, welding, medical and other fields, and even in the fields of textiles and aviation. At present, the research and application of ultrasound can be divided into two major fields: power ultrasound and detection u
[Microcontroller]
Design of ultrasonic cleaning machine based on STC single chip microcomputer
Design of smart home audio signal analyzer based on DSPIC30F6014A microcontroller
At present, most audio signal processors are not only large in size but also expensive, and are difficult to be popularized in some special aspects. Embedded system analyzers are small and reliable, so the development of audio analysis instruments based on special function microcontrollers is the basis of spee
[Microcontroller]
Design of smart home audio signal analyzer based on DSPIC30F6014A microcontroller
Analysis of PTZ controller based on single chip microcomputer
    Preface     The pan/tilt controller designed with a single-chip microcomputer as the core can control the camera to move over a large range and at a wide angle in monitoring situations, so that the camera can achieve nearly 360° panoramic shooting, and it has unique advantages in terms of economy, flexibility, sca
[Microcontroller]
Analysis of PTZ controller based on single chip microcomputer
A Practical and Fast Method for Reducing Floating Point Numbers in Single Chip Microcomputers
In a more complex single-chip microcomputer system, in order to expand the value range and realize complex calculations and controls, floating-point operations are generally involved. However, general single-chip microcomputers do not have floating-point operation instructions, and corresponding software must be com
[Microcontroller]
A Practical and Fast Method for Reducing Floating Point Numbers in Single Chip Microcomputers
Latest Power Management Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号