System Introduction:
The remote measurement and control device is a field programmable controller that can complete data collection and control, and upload the data to the central station or receive the central station through remote communication methods (such as radio, CDMA, dial-up, etc.) Remote control commands. It is often installed in places that are scattered, have harsh environments, have no power supply guarantee (frequent power outages or use solar energy), and are unattended, so the reliability and power consumption of its operation are particularly important. The C8051F microcontroller's industrial-grade operating temperature (-40℃~+84℃), low voltage, low power consumption, built-in watchdog and multiple reset sources meet the requirements of this system.
Based on the positioning of this system, C8051F064 is selected as the main control part and C8051F236 is used as the slave part. The system requires flexible configuration of input/output points, multiple communication ports, and the ability to modify configurations on site.
The system structure is shown in Figure 1. The system uses 220VAC or 24VDC power supply. The main unit consumes 3.3W power and each slave unit consumes 2.2W. It can expand up to 8 slave units.
Figure 1 System structure diagram
Main unit structure
The main unit structure is shown in Figure 2. According to the characteristics of the system, the functions of C8051F064 are configured as follows:
Memory
C8051F064 comes with 4352 bytes of RAM and 128 bytes of Flash. Since the system does not have high real-time requirements for data And using remote communication methods, in order to reduce power consumption, a large amount of data is often cached and sent collectively at a certain time, so a relatively large data storage area is required. The 32KB RAM can be expanded by using external data and address buses. In addition, as a field programmable device, a large number of parameters need to be set, and these parameters need to be retained when power is lost. Therefore, in addition to using the 128-byte non-volatile RAM inside the microcontroller, an 8KB E2PROM is also expanded.
Utilization of address and data buses
The address and data buses adopt a multiplexing method. C8051F064 supports 64KB of external storage space and the extended RAM is 32KB. Therefore, the remaining address line A15 is free. Use A15 and other low-order data lines to use The NAND gate can form a chip select signal to select the device on the bus. There is also an external real-time clock on the bus, which is used as a time mark for the system. Since this chip has a battery-retained RAM, data that needs to be maintained during frequent operations can be stored here, thus avoiding internal non-volatile Complex operations of RAM and E2PROM. In addition, the on-site digital I/O can also be composed of bus and chip select through photoelectric isolation, which can greatly reduce the pins of the microcontroller.
Figure 2 Main unit structure diagram
The serial port
C8051F064 has two UARTs inside. The serial port 0 is converted into an RS-485 signal through photoelectric isolation and is used to connect to other equipment on site. The serial port 1 plus 6 GPIO ports become a full-featured standard after level conversion. RS-232 interface, used to connect with Modem, radio, CDMA, etc. Use the SPI port of C8051F064 to expand into UART through MAX3100, and convert it into RS-232 or RS-485 signals through external optional accessories. The maximum analog input of
the analog
C8051F064 does not exceed 3.6V, so pay attention to its range when connecting the signal. For this system, since most of the on-site signals are 4mA~20mA current, a 100Ω precision resistor is used, coupled with a 2.5V Precision voltage source can adjust the accuracy of analog quantity to 1‰. In addition, activating the window detection function of the internal ADC0 can easily realize the upper and lower limit violation alarm function of the analog quantity. Most of
the digital quantities
are directly hung on the bus. In addition, there are two switching inputs directly connected to the pins of the microcontroller, and these two pins are allocated internally as inputs of the timer/counter. These two channels can be used simultaneously. Pulse amount.
MCU resource allocation
The port function allocation of C8051F064 uses the cross switch method, and it also has priority. This method is very flexible, but requires the designer to prepare the internal function allocation during circuit design, which means circuit board processing Once completed, you cannot modify the crossbar switch at will. In addition to realizing the traditional RESET signal reset,
the reset
C8051F064 also has reset functions such as power on, power off, external signals, software commands, comparator 0, clock loss detection and door open dog, with a total of 7 reset methods. After the microcontroller is reset, you can know what caused the reset by querying the register, which is very useful for data processing and fault analysis. This system uses power-on, software commands, clock loss and watchdog. The reason for adding software command reset is that because these devices are installed in relatively remote locations, when the central station detects an abnormality in the device, it can Restart to resolve some unusual issues.
Figure 3 Some technical issues
from the module structure diagram Data storage
There are multiple memories that can store data in this system, such as 256 bytes of internal RAM, 4KB of internal expansion RAM, 32KB of external expansion RAM, and 128 bytes of Flash , 114 bytes of battery-maintained RAM in the real-time clock and an external 8KB E2PROM. With so many data storage areas, their uses must be carefully allocated in order to give full play to their functions and speed. This system makes the following allocation: 256 bytes of internal RAM has the fastest read and write speed, and it is occupied by the microcontroller core, so its use should be reduced. It is used in places with high speed requirements and frequent use, such as within interrupts. variables, etc.; 4KB internal extended RAM and 32KB external extended RAM have the same status, and are generally used as intermediate variables of the program; 128-byte Flash is modified as a whole, so all data must be read into the buffer before modification. Change the modified bytes, erase the entire chip, and then write the data. Although it is troublesome to write, it is very convenient to read, so it is used to store some data that is not frequently changed and needs to be retained when power is turned off, such as the correction value of analog quantities, etc.; the 114-byte RAM in the real-time clock is faster to read and write, and It is easy to access, so it is used to store intermediate variables that need to be retained after power-off, so that they can be read and written at will. The 8KB E2PROM is limited by the bus logic and is slow to read and write, but the data area is large and is used to store function settings. When the program is initialized, read it out and put it in the intermediate variable area, and do not operate it in the future. Modifying internal data operations should not be performed during an interrupt to prevent prolonging the interrupt time. This article uses a 22.1184MHz crystal oscillator for
the watchdog , so the maximum watchdog monitoring time is only 47.4ms, which does not require high real-time performance.
This article uses the method of interrupting dog feeding. Generally speaking, it is not possible to simply interrupt feeding the dog, because the main loop is responsible for the program, and when the main loop enters an abnormal state, the interruption is often still in progress, so using the interrupt to feed the dog requires the cooperation of the main loop. What is used here is a 5ms interrupt to feed the dog. The variable a is used to accumulate in the interrupt. When a accumulates to 100, the dog will no longer be fed; and a is continuously cleared to 0 in the main loop, so that the watchdog time can be extended. to 500ms. The ADC of
the analog filter
C8051F064 is a successive approximation type. Although the speed is as fast as 1MSPS, the jitter of the data is extremely large. Therefore, when applied in a hybrid system, a filter circuit must be added to the periphery. It does not matter if it is not considered in the hardware design. You can take full advantage of its speed and use software filtering internally. This system does not have high requirements for the acquisition speed of analog quantities, but only requires stability and accuracy. It uses a 20-point median average filter internally, and then uses 20 average values. In this way, even if there are no external filtering measures, Can also get good results.
Slave unit structure
The slave unit adopts the method of adding modules to the base plate, and arranges four module positions on the base plate. The interfaces of these positions must be exactly the same, so that the points can be flexibly configured. According to the system requirements, all I/O points must be electrically isolated. There is no need to choose a microcontroller with ADC and DAC. It only needs to have enough GPIO. According to this principle, this system selected C8051F236, such as As shown in Figure 3. The slave unit retains the LCD and keyboard interfaces when the master unit was designed. Although most parameters are set in the master unit, retaining this interface allows you to see the module’s software version number and other information. If there are parameter settings in the future, you can also Set here to the non-volatile RAM area in the microcontroller.
The communication between master/slave adopts Modbus protocol. There is no need to expand the slave unit. You can use this port to connect to external Modbus protocol devices. The structure of the slave unit is relatively simple, and the microcontroller is only responsible for a small part of the work, which is omitted here.
In practical applications, system networking usually does not use one device, but connects multiple devices into a wired or wireless network. Wired networks generally use RS-485 structure or dial-up method, and are used in systems with close distances. The central station patrols each site; wireless networks generally use radio stations and CDMA. Unlike wired networks, this link is charged, so communication cannot use patrol mode. When communicating with radio stations, the distance is often long and power supply is difficult, so the method of reporting when there is a change should be adopted. The switch value will be sent as long as it changes position, and the analog value will be sent when it exceeds the preset dead zone range. Since radio stations often Frequency division multiplexing is used, so each station must have its own time slice. When there is data that needs to be sent, the data will be cached. When its own time slice is reached, the cached data will be sent, so that no data will appear. It also helps reduce power consumption, which is very beneficial for solar-powered systems. Simply reporting when there is a change is flawed, because when the system has not changed, it does not send data, so it is not known whether the data has not changed or there is a problem with the site, so this system has added an hourly safety reporting function. , that is, at regular intervals, such as 4 hours, all sites will send all their data once, so that the problem can be clearly seen. When using CDMA communication, although there is no problem of frequency division multiplexing, the transmission data must be sent in time division to avoid a large amount of data flooding into the data center at the same time under certain circumstances, causing channel congestion.
System testing and operation
After the system design was completed, strict testing was conducted. The operating speed of the microcontroller achieved the expected results, and the power consumption and overall heat dissipation were better than the original system. Experiments on fast transients, radiation immunity, electrostatic discharge and voltage mutations were conducted in the electromagnetic compatibility laboratory, and the indicators are better than the national requirements for such products. At the same time, the system was subjected to high temperature (60°C) and low temperature tests (-20°C), constant humidity and heat, vibration, collision, insulation strength and other tests, all of which were better than national standards. In various applications such as flood control, water network, heating network, etc., this system is used to form a wireless network with CDMA and radio stations, which can reach up to more than 60 points, and the operation is stable and reliable. In the building control system, the wired network composed of RS-485 has also achieved good results.
References
1. [US] Cygnol Integrated Products, Inc. C8051F microcontroller application analysis. Translated by Pan Zhuojin, Sun Delong, Xia Xiufeng, Beijing: Beihang University Press, 2002
2. Silabs.C8051F06X Data Sheet.http://www.silabs.com.2004
3. Tong Changfei. C8051F series microcontroller development and C language programming, Beijing: Beihang University Press, 2005
Previous article:Simple intelligent robot designed based on AT89C51 microcontroller
Next article:Application of C8051F microcontroller in remote measurement and control devices
Recommended ReadingLatest update time:2024-11-16 16:19
- Popular Resources
- Popular amplifiers
- Research on collaborative energy-saving optimization control method for connected hybrid vehicle fleet
- Research on image recognition for SoC deep learning algorithms_Yang Donghong
- Implementing a perception system for autonomous vehicles using a detection and segmentation network on a SoC FPGA
- Multi-port and shared memory architecture for high-performance ADAS SoCs
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
- Comparison of Autoliv 2nd and 3rd generation night vision cameras
- If I use a battery to power a DCDC circuit, how can I be sure that the battery has enough power?
- Standard USB keyboard data packet
- 【Small home weather station】+ Hardware design, board proofing
- Forever power_A tiny device that turns your universal power bank into an uninterruptible power supply
- 【NUCLEO-WL55JC2 Review 2】Introduction to NUCLEO-WL55JC2 Development Board
- [Full cash back for orders, capped at 300 yuan] MPS Mall Power Design Products Recommendation, Huge Discount Experience Season!
- [CH549 Review] Part 4 Low-Level Driver Software Review - Touch Button Driver
- 【AT32F421 Review】+ DHT22 Temperature and Humidity Detection
- Crazy Shell AI open source drone GPIO (remote control indicator light control)