Human-computer interaction design of intelligent power distribution monitoring system

Publisher:心满意足Latest update time:2011-08-28 Source: 山西电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: With STC12C5A60S2 single-chip microcomputer processor of Hongjing Company as controller, matrix keyboard as input device, RS485 communication interface chip as data update mode, LCD3202401 produced by Beijing Qingyun Company as display output device, the corresponding hardware circuit and display driver are studied and designed, and the design of human-computer interaction system is completed on this basis. Make full use of low-cost and low-resource single-chip microcomputer system to realize perfect human-computer interaction function.
Keywords: human-computer interaction; LCD; single-chip microcomputer

1 System design scheme
The following situations are encountered when designing buttons of this system: (1) There are many peripherals of the product, and the I/O ports of the single-chip microcomputer are relatively few. It is necessary to consider saving I/O ports during design. (2) Due to the limitation of the on-site situation, there should be a distance between the keyboard and the motherboard. (3) The keyboard needs 15 buttons, and a reset button is extended at the same time, for a total of 16 buttons. According to the above situation, the A/D keyboard is the most suitable.
Considering that the system display requires both graphic display and character display function, the single-chip microcomputer is used to control the LCD to maximize the use of LCD drawing, character display and other functions.
The effect of this system design is shown in Figure 1.

l.jpg



2 System structure and principle
The human-computer interaction system is responsible for data display and input, exchanges information with the main control module through the RS485 interface, displays the power parameter information transmitted by the main control module through the industrial LCD, and sets the system working mode, parameter threshold, and communication protocol through keyboard input. Correct the various electrical parameters of the analog channel and use graphics to intuitively represent the working status of the primary diagram and voltage parameters, and sound an alarm when overcurrent and overvoltage alarm information occurs. The system can complete these multiple functions well under limited cost conditions.
The display system consists of hardware and software, as shown in Figures 2 and 3.

a.jpg

b.jpg


The hardware part is based on the STC12C5A60S2 microcontroller. The crystal oscillator and reset circuit are necessary devices for the system to work. It receives input commands from the 3×5 matrix keyboard and communicates with the main control module in real time through RS485. The keyboard directly collects voltage judgment through the A/D function of the microcontroller.
The software part can be divided into two parts: the bottom driver and the upper control. The bottom driver includes setting the system clock and system mode, configuring the I/O port, initializing the serial port to turn on the ADC conversion function, initializing the LCD controller, interrupt controller, etc. The upper control program constantly queries whether there is a key pressed. If a key is pressed, the corresponding task is executed and the LCD displays the corresponding content; at the same time, if necessary, it sends control or request data and other information to the main control module through RS485.

3 System Hardware Circuit Design
3.1 Keyboard Circuit
In the human-computer interaction system, the keyboard must be used to input control commands, set values, query electrical parameters, historical data, alarm information, etc. The system is designed to use a 3×5 keyboard, plus a reset button to form a 4×4 format installation. In addition to the 10 numbers 0 to 9, there are also the confirmation key "Enter", the menu key "Menu", the up key "Up", the down key "Down", the "Mute" key and the reset key. Pull-up resistors are connected to the output lines of ports KEY0, KEY1, and KEY2 so that the ports can be accurately set high or low. The other end of the pull-up resistor is connected together to a 5 V power supply. The circuit diagram is shown in Figure 4.

c.jpg


The figure shows the circuit design of 3x5 keyboard. KEY0, KEY1, and KEY2 are connected to the I/O port with A/D function of the microcontroller. At this time, the A/D scan can be used to read, and the A/D value can be used to determine whether a key is pressed or which key is pressed. According to the resistance value in the figure above, it can be calculated that if no key is pressed, the A/D value is 5 V; SW1 is pressed, and the A/D value is VCC×R1/(R1+R20)=0.16 V by calculation; SW4 is pressed, and the A/D value is VCC×R1/(R1+R20+R24)=0.733 V; similarly, SW7=1.559 V; SW10=2.287 V; S5=2.875 V; according to the comparison of A/D acquisition values, the key value range closest to it is the key.
When using this method, it is necessary to pay attention to the selection of keys with good contact. After a long time of use, the key difference is easy to generate contact resistance, and more keys are prone to misdetection.
3.2 LCD display
circuit The system uses the LCD3202401 liquid crystal controller produced by Beijing Qingyun Company. The LCD3202401 uses the powerful RA8835 as the controller. This LCD has 4 display data lines and transmits data quickly; it has powerful drawing functions; it supports text display, graphic display, and mixed display of graphics and text; it has a simple MPU interface and a full-featured control instruction set. The interface circuit between the microcontroller and the LCD is shown in Figure 5.

d.jpg


In the figure, a 1 kΩ current limiting resistor is added at the connection between the LCD and the microcontroller pins to effectively prevent the microcontroller pins from being damaged by excessive current. Since the frequency of the microcontroller is 22 MHz, the data cannot be seen to be transmitted one bit at a time by the naked eye. From the perspective of human vision, it is as if all characters or pictures are displayed at the same time.

4 Software Design
In this system, there are more than 30 main menus and submenus, and they need to be displayed synchronously in real time, which increases the difficulty of application layer design. Therefore, the program adopts a modular structure, which mainly includes the main menu page switching module, key scanning module, option management control module and data input module.
4.1 Main menu page switching module
In order to switch the operation interface according to user requirements, a page_index image register is defined, and its value varies between 1 and P, where P is the number of operation interfaces. The value of P in this system is 9. The main menu interface is shown in Figure 6.

e.jpg


If page_index=1, the LCD displays page 1; the primary image page is shown in Figure 7. To maximize the use of the system's Flash, the lines and boxes are directly implemented using its drawing function.

f.jpg


If page_index=2, the second page will be displayed on the LCD display. The user can press the numeric keys to control the value of page_index to select the corresponding page to achieve human-computer interaction. The electrical parameter page is shown in Figure 8.

g.jpg

4.2 Key Scan Module
Scan the 15 operation keys and save the results in the key image register. This register has a status flag keyState. If its value is True, it means that the corresponding key is pressed; otherwise, it is released. When the program is running, the key is read and the flag is cleared. Figure 9 is the program flow chart of the keyboard module.

h.jpg


4.3 Option Management Control Module
If the current operation interface belongs to the "option interface", due to the large number of setting parameters, the option page is divided into several pages. Press the "Up" and "Down" keys or directly press the number keys to select the corresponding page. Figure 10 is the flow chart of the option management control module.

i.jpg


For the convenience of analysis, the setting page is taken as an example. The setting page is divided into 5 pages, including the system parameter setting page, the threshold parameter setting page, the Modbus setting page, the Ethernet setting page and the CAN setting page. After selecting the setting from the main menu to enter the setting page, you can press the numeric keys or the up and down keys to select the page. For example, press the 2 key to enter the threshold setting in the setting page, as shown in Figure 11.

j.jpg


At this time, press Enter to enter the input setting for the value. 2/5 in the figure is the current page prompt, 2 is the second page, and 5 is the total number of pages.
4.4 Data input module
If the current operation page belongs to the "setting interface", use the numeric keys to enter any value that meets the user's requirements, such as the value input in the threshold setting in Figure 11. The program flow chart of the data input module is shown in Figure 12.

k.jpg


By using the above modules, only a small amount of program code is needed to flexibly realize functions such as options, data modification and switching operation interfaces.

5 Conclusion
This design uses C language programming, and the selected microcontroller is STC12CSA60S2. Although its program memory is only 60kB, it realizes the display and switching of more than 30 pages of operation interfaces, as well as human-computer interaction functions such as data setting and query, and also realizes monitoring, control and communication functions.

Reference address:Human-computer interaction design of intelligent power distribution monitoring system

Previous article:Design of strong magnetic water treatment instrument
Next article:Single chip microcomputer and embedded system application

Latest Industrial Control 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号