1. Introduction
The signal transmitter used on the ship works continuously, so a controller is needed to monitor the working status of the transmitter. It is common to use a single-chip microcomputer as the core of the controller, but because 32-bit microprocessors have better accuracy and reliability and low cost and low power consumption, they are increasingly used in the field of industrial control. Using the embedded 32-bit microprocessor ARMS3C44B0x as the core of the controller, the designed controller will have more comprehensive functions and better performance than the processor with a single-chip microcomputer as the core.
The main function of the transmitter controller is to collect and process the data of multi-channel analog and switch quantities to monitor the working status of the transmitter; the controller controls the transmitter and is also controlled by the host computer. It must be ready to receive data from the serial port and network port of the host computer at any time. The relative relationship between them is shown in the figure:
Figure 1 Controller system structure diagram [page]
The host computer sends data to the controller to control the controller. First, the host computer sends the machine number and then the command word. The controller also uploads data to the host computer to complete the communication response. It first analyzes whether the machine number is consistent with its own machine number. If it is consistent, it analyzes the command word and sends the uploaded data according to the command word to complete the response. If it is inconsistent, no further data analysis is performed. Their communication methods are serial communication and Ethernet communication. The data transmission between the controller and the transmitter mainly includes the acquisition of analog quantities and the input and output of switch quantities. In addition, the human-machine interface module realizes the real-time display, parameter modification and query of the parameters during the working process of the transmitter. The real-time collected data is obtained by AD sampling. It should be noted that S3c44B0 does not have a sampling and holding circuit, so the switching frequency of the channel cannot exceed 100Hz. A delay is required when the ADC opens the channel. This time is used to filter the previous channel to improve the efficiency of the program. The entire sampling process can be described as opening the current channel and then filtering the channel sampled last time (median average filtering method).
2. Power on/off description and software design
Figure 2 Word of Mouth Communication Flowchart
The development of the project must first complete the programming and debugging of the power on/off function, human-machine interface function module, and communication module. Let's discuss the power on/off programming first; users require that the functions of the keys on the controller can be edited, that is, the function of each key is not fixed and can be modified through a PC; when starting up, a series of actions must be output in descending order of priority, and each action has an editable priority (edited through a PC). After an action is output, it may cause other actions of the same priority level to occur, which is the association of actions. When starting the current priority action, the status of the higher priority action must be detected, and fault handling is required when a fault occurs. The following data structure is designed for the above more complex requirements:
Figure 3 Boot process
typedef struct{
char *pName; //Action name
char FunctionID; //action (function) number
char Priority; //Action priority
short KeepTime1; //Wait for the previous output action to stabilize
short DelayTime1; //Delay before the next action is executed
short DelayTime2; //When the analog quantity or switch quantity is abnormal, it is necessary to repeat the detection delay
short RepeatNum; //Number of re-detection if there is a fault
}OutputAction;
[page]
All functions are numbered in sequence. When this number is assigned to a key, the key has the function. Function editing is achieved by modifying the value of OutputAction. FunctionID. Each key has a maximum of 16 functions and a minimum of no function. All functions of each key are valid in round-robin. A circular linked list is used to store the function numbers. The function corresponding to the number at the head position is always valid. Each function (action) can only belong to one key. At each startup, the defined key function is first sent to the controller by the serial port and burned into the ROM at a fixed position. The action priority is edited by modifying the value of OutputAction. Priority in the structure. These data are read out from the ROM at startup. If the host computer does not edit the key function, it is performed in the default form. It should be pointed out that when shutting down, all output actions are turned off in the opposite order of startup.
When the machine is powered on, the properties of the action are obtained according to the content in the fixed position ROM or the default definition. ① First, search for the action number with the highest priority, and then send these actions in sequence according to different delays; ② Reduce the priority by one level, and check whether the status of all inputs and outputs with higher priority than the current one is normal. If normal, send the action with the current priority, and repeat the process of ②. Otherwise, enter the fault handling program. If the fault is handled successfully, continue to repeat the process of ②. Otherwise, shut down and return the boot failure information. The boot flow chart is shown in Figure 3.
One of the features in software design is to use I/O ports to simulate IIC bus to read key values. The general idea is to use two ports, one to simulate IIC clock signal and the other to simulate IIC data line. It should be noted that when configuring I/O ports, the port corresponding to the clock line is always the output port and the data line port is uncertain. The IIC data transmission protocol is simulated by setting and clearing the port combined with delay. In the debugging process, it is found that this method can well complete the acquisition of key values and access to CPLD devices.
3. Human-machine interface module design
To monitor the working status of the transmitter, a good human-machine interface must be provided. A suitable display device needs to be selected for the controller. In this project, a 7.8-inch 640×480 pixel STN color liquid crystal display (LCD) is selected. It adopts an 8-bit data single scan mode. In practical applications, the display effect is very good. It is not only low-cost but also beautiful. The interface between the STN LCD screen and 44B0x is relatively simple, but it should be noted that the 18th pin (Vcom) is connected to the power supply through a variable resistor. Adjusting the voltage on this pin can adjust the contrast of the LCD screen. The key in software design is the design of the menu and the response and processing of the keys. Since there are many interfaces in this project and there is screen flipping, it is advisable to design a unified processing algorithm. For this reason, each interface is uniformly numbered WndID, and the key is treated as a message processing MessageFun(); each time a key is pressed, MessageFun() is called to find the interface to be displayed and display it on the LCD. The method of LCD screen flipping is to record the offset of the displayed content in the entire menu array each time. If the current line exceeds the offset, the screen needs to be flipped, otherwise it will not be flipped. The menu is designed as follows: a structure is used to completely encapsulate the attributes of a menu, including the menu name, coordinates, parameter flags, and parameters.
typedef struct{
UINT8T Menu_ID; //Menu number
UINT8T *Text; //Menu name
UINT16T xPos; //Menu x coordinate
UINT16T yPos; //Menu y coordinate
UINT8T ParaFlag; //parameter flag
UINT8T pData[7]; //parameters
}Menu;
Figure 4 Menu display
Use the structure to encapsulate the properties of each menu and put them into an array. This way, there is no limit on the number of menus and it is easy to manage. The information of each menu is clear and programming is less prone to errors.
The core work of human-computer interface operation is the switching of interfaces, main menu and submenu operations. The corresponding interface ID number is determined according to the key. There are usually two ways to switch interfaces: changing the content of the video memory and changing the base address of the video memory. Changing the base address of the video memory requires defining a large video memory. The advantage of this is that the hardware resources are used to make the LCD screen refresh very fast and the interface switch fast. The disadvantage is that it wastes a lot of system resources. If the content in the video memory is changed, the software method is needed to update the content in the video memory. The advantage of this method is that it saves system resources, but increases the complexity of software design. This project adopts the method of updating the video memory content. It is found in actual debugging that it can meet the requirements well. A unified scheduling algorithm is designed for the operation of the main menu and submenu. The idea is to determine the ID number of the main menu and the ID number of the submenu according to the key information obtained, and use the focus to mark the ID number of the current menu. The two ID numbers can determine the corresponding main and submenus and enter the corresponding function processing program at the same time.
4. Ethernet communication module design
When designing the hardware, we choose the RTL8019AS network control chip, which can work at 8/16-bit bus width with a transmission speed of 10Mbps and follow the IEEE 802.3 protocol. It has 16KB SRAM inside, which integrates the MAC transceiver buffer and the physical layer functions. It is used to receive and send Ethernet physical transmission data. When the RTL8019AS receives the network data packet, the status of some control registers inside the RTL8019AS is changed. The status of these registers is read by setting interrupts or queries to determine whether the data is received; when sending data, the data is placed in the RTL8019AS internal data buffer, and the network data in the buffer is sent to the network by controlling the internal registers. The chip has three working modes: jumper mode, plug-and-play mode, and jumper-free mode. In the project, the network card chip RTL8019AS works in jumper mode. The driver of the chip mainly includes the following steps: reset, initialization, and sending and receiving data. The reset pin RSTDRV of RTL8019 is high level effective, and the effective holding time should be greater than 800ns, and the chip will be operated 100ms after switching from high to low. Before initializing the chip, it is necessary to pre-allocate the space in the on-chip RAM, that is, the size of the receive and send buffers, and write all the setting parameters into the registers of RTL8019 at the time of initialization to complete the initialization.
5. Conclusion
There are many software and hardware difficulties in the process of project development and debugging, but the problems are finally solved, such as the debugging of the system's serial port, LCD, AD sampling, Flash operation, and the programming of the human-computer interaction function that the controller must have, which needs to be debugged. After adding the Ethernet module to the project, the driver of its physical layer chip needs to be further debugged, and the TCP/IP protocol is added to the module. Referring to the successful case, the system debugging task is completed. At the same time, this article has the following innovations:
(1) Develop and apply the 32-bit microprocessor ARMS3C44B0x as the core of the controller, so that the controller has more comprehensive functions and better performance than the processor with a single-chip microcomputer as the core.
(2) In the design of the menu, a structure is used to completely encapsulate the attributes of a menu, whose attributes include menu name, coordinates, parameter flags, and parameters.
(3) The problem of making the RTL8019AS network card chip work properly was solved. Before initializing the chip, it is necessary to pre-allocate the space in the on-chip RAM, that is, the size of the receive and send buffers. All the setting parameters are written into the registers of RTL8019 together during initialization to complete the initialization.
[References]
[1] Tian Ze. Embedded System Development and Application Experimental Tutorial[M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005.
[2] Jia Zhiping, Zhang Ruihua. Embedded Principles and Interface Technology[M]. Beijing: Tsinghua University Press, 2005.
[3] Wang Tianmiao. Embedded System Design and Case Development[M]. Tsinghua University Press, 2003.
[4] Cui Dengzhi, Dai Xuefeng, Liu Shudong, et al. Using ARM to control CAMD wireless modem to send short messages [J]. Microcomputer Information, 2006, 11-2: 136-138.
[5] Xu Wei, Tan Shuren, Huang Haoliang. Design of image acquisition system based on AT91RM9200[J]. Microcomputer Information, 2006, 11-2: 120-122.
[6] Yang Zhanhua, Yang Yan. Application of data mining in intelligent search engines [J]. Microcomputer Information, 2006 (4) vol. 2: 244-245.
Previous article:Remote Video Monitoring System Based on ARM-Linux and CDMA
Next article:Development of near infrared spectrometer based on ARM
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- How is the buffering function of 74HC04 manifested? What is the difference between buffering and latching?
- From base stations to terminals, end-to-end 5G RF front-end solutions
- The 5G era is here. What challenges will the RF front end face?
- It's quite impressive. This hero made a 60,000 am/h, PD100W power bank
- Without using MCU, how can we make the MOS tube turn off 1000000000 times faster than it turns on?
- [HC32F460 Development Board Review] 02 Build a development environment to implement the LED marquee function
- Qorvo follows the animation to grasp the 5G RF front-end trend
- Microwave Technology and Antennas (4th Edition)
- [AutoChips AC7801x motor demo board review] + unboxing and GPIO lighting
- About the master: zhang2018yi