Abstract: This article introduces the working principle of the static display chip MAX7219, proposes a simple and practical static display system suitable for PLC, and discusses the hardware connection and software programming using SIEMENS' S7-200PLC as an example.
Keywords: MAX7219 PLC static display system
The latest small and highly integrated PLCs, such as the SIEMENS S7-200 series, have multiple switching input/output points on the main module, and have a 485 serial communication port that complies with industry standards, making it easy for users to configure stand-alone equipment. Independently controlled or connected into a fully distributed computer monitoring network, connected to remote control rooms. However, in actual applications, some stand-alone controllers or some equipment far away from the control room often need to be displayed locally to facilitate operator operation or inspection. SIEMENS PT200 monitor is developed for this purpose. However, its display screen is small and mostly liquid crystal display, which is not suitable for situations with strong light or extremely weak light. It also takes up serial port resources, is inconvenient to install, and is expensive. The usual solution is to make full use of the PLC switching output points and drive the LED display in parallel. Parallel display takes up a lot of resources, and there are not many switching output points on the general small PLC main module (S7212 has 6 output points, S7-214 has 10 output points), which makes it difficult to meet the needs of multi-digit display and multi-point control. Require. This article proposes a method of using the MAX7219 chip to cooperate with the PLC output point. Through simple hardware connection and the powerful programming ability of the PLC, it can be flexibly programmed according to the actual situation to realize LED display and function control.
1 Introduction to MAX7219
MAX7219 is a new type of serial interface 8-bit digital static display chip. It is a newly launched 24-pin dual in-line chip by MAXIM Company. Its pin diagram is shown in Figure 1.
SEGA~SEGG and SEGDP are LED seven-segment driver lines and decimal point lines, supplying display source current; DIGO~DIG7 are 8-bit digital drive lines, outputting bit selection signals, and sinking current from the common cathode of each LED.
Figure 2 is the working timing diagram of MAX7219. As can be seen from Figure 2, DIN is the serial data input terminal. On the rising edge of CLK, one bit of data is loaded into the internal 16-bit shift register. The maximum input frequency of the CLK terminal can reach 10MHz. On each rising edge of the input clock signal On the rising edge of LOAD, 1-bit data is moved from DIN into the internal register. LOAD is used to load data. On the rising edge of LOAD, 16-bit serial input data is latched into the digital or control register. LOAD must go high at the same time or after the rising edge of the 16th clock and before the rising edge of the next clock, otherwise the data will be lost.
A set of data is specified as a 16-bit binary data packet with the following format:
The bits are not used and are the addresses of the 5 internal control registers and 8 LED display data registers. The address codes are shown in Table 1. It is the data to be displayed by 5 control register command words or 8 LED digital tubes. Because the control registers and display data registers are independently addressed, each register can be operated independently through the program. Under normal circumstances, the program sends control commands first, and then sends data to the display register. However, it must be noted that each 16-bit group is sent starting from the highest bit of the high-order address byte until the last bit of the low-order data word.
2 Hardware connection between MAX7219 and PLC
Now we will take the small PLC S7-214 of SIEMENS Company as an example to discuss the hardware connection and software programming of PLC and MAX7219. S7-214 has few output points (Q0.0~Q1.1, ten digits in total) and only one RS-485 communication port. The hardware connection between S7-214 and MAX7219 is shown in Figure 3 . Q0.0 of S7-214 is used for serial data output and is connected to the DIN pin of MAX7219. Q0.1 and Q0.2 simulate the clock pulse CLK and data loading LOAD signal of MAX7219 respectively through the program. The SEGA ~ SEGFGF and SEGDP terminals of MAX7219 are connected to the a ~ f and db terminals corresponding to each LED digital tube. DIG0 ~ 7 are respectively connected to the common cathode of the 8-bit LED digital tube to achieve bit selection.
In fact, the number of digits of the digital tube can be selected arbitrarily between 1 and 8, which can be determined by the command word written to the scan boundary register. NOTE: A 9.6kΩ resistor between pins 18 and 19 is required, and to minimize the ripple caused by the peak digital driver current, an external 10μF electrolytic resistor needs to be connected between V+ and GND as close to the chip as possible capacitor and a 0.1μF ceramic capacitor. The MAX7219 should be placed close to the LED display and the connections should be as short as possible. Both GND pins must be connected to ground.
3 Software programming
Open a two-byte storage unit VW0 in the V storage area of S7-214, which is specially used to store 16-bit binary data packets. The high-order byte VB1 specifies the high-order address byte, and the low-order byte VB0 specifies the low-order command word or The number to be displayed.
Since the control registers and display registers of the MAX7219 are independently addressed, the display program is actually S7-214 continuously sending signals to the MAX7219 through Q0.0 (DIN) with the cooperation of Q0.1 (CLK) and Q0.2 (LOAD) timing. The process of writing a 16-bit binary data packet to the corresponding control register and data display register. So the key to the problem is to write a general write subroutine to move the contents of VW0 from high to low into the shift register under the action of Q0.1 (CLK), and finally by the rising edge of Q0.2 (LOAD signal) Latch into the corresponding internal control register and data display register. The program flow chart of writing subroutine is shown in Figure 4.
Whether initializing the control register of the MAX7219 or displaying numbers on the corresponding digital tube, it can be completed by calling the above-mentioned general write subroutine. Note that before calling the subroutine, the correct 16-bit binary data must be moved into VW0 using the MOVW instruction.
The MAX7219 automatically scans and displays the numbers to be displayed in the manner specified by the five control registers, so the five control registers must be initialized before the display program. The functions of each control register are described as follows:
(1) The decoding mode register sets BCD code B (0~9, E, H, L, P and -) or non-code operation for each number. Each bit in the register corresponds to a number. A logic high selects Code B decoding, while a low selects the bypass decoder.
(2) The bit position of the display brightness register can be arbitrary, and 0000~1111 can be selected. The larger the value of D3~D0, the brighter the LED display.
(3) Scan range register The scan range register sets the number of displayed data, which can be from 1 to 8. They are generally displayed with a scan rate of 1300Hz, 8-bit data, and multiplexing.
(4) Close the registerThe position is optional. , turn off all displays; D0=1, allow display.
(5) The D7~D1 bits in the display test register are optional; Do=0, LED is in normal working condition; Do=1, display is allowed. The LED is in display test status.
After sending the control word, the display subroutine can be called according to actual needs to change the contents of 1 to 8 data registers to complete the display function.
MAX7219 only needs a set of +5V power supply and three output ports of PLC, and no additional circuits. It can drive 1 to 8 LED displays, with adjustable display brightness and reliable operation.
Previous article:Design of monitoring circuit and display software composed of PLC and dot matrix liquid crystal display module
Next article:Application of computer and PLC integrated control system in petrochemical industry
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 【Smart Sports Watch】3. Build Development Environment 2
- Ginkgo USB-SPI host mode four data transmission mode timing diagram
- History of the Development of Microwave Circuits
- 6657Statically configure serial port general interrupt in sys/bios
- Understanding Nginx Architecture in One Article
- Highly recommended! ADI's latest Chinese information is here
- Urgently looking for expert advice AD15 can not open the PCB after cracking
- Difference between LPS22HH and LPS22HB
- How to collect multiple sensor signals through one RS485 interface of industrial computer?
- Altera SoC Architecture Excerpt - What is a SoC FPGA