1 Overview
The C8051F0XX series of microcontrollers is a new type of mixed signal system-level microcontroller launched by Cygnal. This series of microcontrollers contains the CPU core of CIP-51, and its instruction system is fully compatible with MCS-51. The C8051F020 microcontroller contains 64kB on-chip Flash program memory, 4352B of RAM, 8 I/O ports with a total of 64 I/O lines, a 12-bit A/D converter and an 8-bit A/D converter, a dual 12-bit D/A converter, 2 comparators, 5 16-bit general-purpose timers, a programmable counter/timer array of 5 capture/compare modules, a watchdog timer, a VDD monitor and a temperature sensor. The C8051F020 microcontroller supports dual clocks and has an operating voltage range of 2.7 to 3.6V (the voltage resistance of the port I/O, RST and JTAG pins is 5V). Compared with the previous 51 series microcontrollers, C8051F020 has added many functions, and its reliability and speed have also been greatly improved.
2. Features of C8051F020
The internal functional block diagram of the C8051F020 chip is shown in Figure 1.
The core CIP-51 of the C8051F020 microcontroller implements pipeline operation on the basis of maintaining the CISC structure and instruction system. The device abolishes the concept of machine cycle, and its instructions are run in clock cycles, thus greatly improving the running speed of instructions. When the crystal oscillator is 25MHz, the peak execution speed of C8051F020 can reach 25MIPS. The memory structure of the CIP-51 microcontroller is similar to that of the standard 8051. The program and data memory share the same address space, but can be accessed by different instruction types.
C8051F020 has 8 I/O ports (64 I/O lines), including four lower ports P0~P3 (bit addressable) and four upper ports P4~P7 (not bit addressable). In C8051F020, the I/O ports can be flexibly configured in hardware through network switches (as shown in Figure 1), or the I/O ports can be configured as the selected special function ports by setting the corresponding registers to control the cross switch.
C8051F020 has 5 timers/counters: T0, T1, T2, T3, T4. T0, T1 and T2 are consistent with the standard 8051 usage. T3 is a counter with auto-reload function, which can be used to start ADC data conversion, SMBus timing and general counter. T4 can be used as a 16-bit timer/counter with auto-reload function, a 16-bit timer/counter with capture function and a baud rate generator for UART1. The working mode of its timer/counter can be set by configuring the corresponding special function register.
The SPI can access the 4-wire (MOSI, MISO, SCK, NSS) full-duplex serial bus. It can work in master and slave modes. When the SPI of C8051F020 works in master mode, NSS is connected to the digital power supply; when it works in slave mode, NSS is used to select the device. SPI has two operating modes: full-duplex and half-duplex. When C8051F020 works in master mode of full-duplex mode, a data transfer can be started by writing a byte to the data register SPI0DAT. At this time, C8051F020 will immediately shift out the data serially on MOSI and provide a serial clock on SCK. At the same time, the slave device can also serially shift out the contents of the register to C8051F020 on the MISO line. At the end of the transfer, the SPI0CN.7 bit is set to "1". The SPI of C8051F020 can shift in/out 1 to 8 bits of data in one transfer operation to accommodate slave devices of different lengths. When the SPI is not configured as a master, it will operate as a slave.
SMBus (System Management Bus) is a two-wire bidirectional serial interface that complies with SMBus 1.1 version and is completely consistent with the I2C serial bus. The SMBus of C8051F020 can also work in master and slave modes. When they exchange data, they are all started by the master device.
This new C8051F020 microcontroller chip has a 9-channel, 12-bit A/D converter ADC0 and an 8-channel, 8-bit A/D converter ADC1. When in use, the channel number and number of channels can be selected through register configuration, as well as one of the following four A/D conversion modes to start.
(1) Write "1" to the AD0BUSY bit of register ADC0CN;
(2) Timer 3 overflows;
(3) Timer 2 overflows;
(4) CNVSTR has a rising edge.
C8051F020 has two 12-bit D/A converters DAC0 and DAC1, which can also be selected through register configuration. There are also four ways to start D/A conversion:
(1) Data is written to the high byte register of the DAC;
(2) Timer 2 overflows;
(3) Timer 3 overflows;
(4) Timer 4 overflows.
The first method is generally selected during design. When a square wave needs to be output, one of the second, third, or fourth methods can be selected. In the first method, the low byte of the DAC can also be written first, and then the high byte is written to start a D/A conversion.
The new C8051F020 MCU develops a single pin reset into a multi-source reset, including power-on reset, power-off reset, external pin reset, software reset, clock loss detection reset, comparator 0 reset, WDT reset and external CNVSTR pin reset. The numerous reset sources bring great benefits to the system security, operation flexibility and zero power design. The perfect clock system of C8051F020 can make the average clock frequency the lowest under the premise of meeting the corresponding speed, and the multiple reset sources can wake up the system at will in the power-off mode.
The C8051F020 is equipped with a standard JTAG interface (IEEE1149.1) on the chip. With the support of the host computer software, the serial JTAG interface can be used to debug the microcontroller installed in the final application system in a non-intrusive, non-resource-consuming, full-speed online system. The debugging system supports observing and modifying memory and registers, as well as breakpoints, observation points, single-step operation and stop commands. When using the JTAG interface for debugging, all analog and digital peripherals can operate with full functionality. In addition, the JTAG logic of the C8051F020 can also provide boundary scan functions for in-system testing. Through the programming control of the boundary register, the weak pull-up function of all device pins, SFR buses and I/O ports can be observed and controlled.
In summary, C8051F020 is a highly integrated and powerful single-chip microcomputer chip, which is very suitable for application systems that require fast speed, high reliability, strong expansion functions and power saving.
3 Design of online automatic analyzer for total phosphorus
Phosphorus-based agents (agents based on organic phosphates) are widely used in industrial water treatment due to their good corrosion and scale inhibition performance and low pollution emissions. Since there are many types of phosphorus-based agents and organic phosphorus components are difficult to measure directly, the development of a total phosphorus online analyzer can save energy and water, reduce pollution, and improve efficiency, with obvious economic and social benefits. The system structure of using UV-photocatalysis and oxidation to improve the decomposition of organic phosphorus in water and monitor its decomposed water samples to achieve quantitative analysis is shown in Figure 2.
This instrument takes C8051F020 as the core, and is expanded with data storage AT45DB081, clock chip DS1687, digital temperature sensor DS18B20, intelligent LCD and keyboard, etc. They are mainly used to complete signal collection, key scanning, LCD display and alarm, temperature detection, industrial standard signal output, control valve switching and various light source indication functions.
The data storage device AT45DB081 (SPI serial interface) has a storage capacity of 8MBit and can store one year's measurement data. The clock chip DS1687 (8-bit parallel interface) can automatically update the year, month, day, hour, minute and second to complete the automatic calibration function of the instrument. The digital temperature sensor DS18B20 (single bus interface) is used to monitor the temperature of the solution to ensure constant temperature of the liquid, speed up the chemical reaction, reduce the measurement cycle, and improve the reproducibility and stability of the instrument measurement. The intelligent LCD (UART serial port communication) and buttons are used to complete the human-computer dialogue function and form a good human-computer interface.
The instrument uses more than 40 I/O ports, which can be used to control the switches of various valves and light sources, keyboard input and expansion of DS1687, etc., and C8051F020 has 64 I/O port lines, so it can fully meet the needs.
The hardware circuit with perfect software design can realize: keyboard operation, LCD display, data collection and detection, data output, alarm light source control and agitator control. Figure 3 is the main flow chart of the instrument system. When the instrument is turned on, the program first performs initialization self-test and sets the interrupt entry address, then refreshes the LCD screen, reads the clock signal of DS1687 and sends the initial concentration value "0.000mg/L" to the display screen. Open the control valve, inject the measured water sample to pre-clean the decomposition measuring cup for 1 minute, and then judge whether there is a key pressed through the interrupt response. If no key is pressed, the analysis subroutine is called to complete the operation within a cycle, and the calculation result is sent to the LCD display for display, and it is also sent to the D/A port of C8051F020 as a field standard signal. Finally, the measurement result is stored in AT45DB081 as a historical record. After a cycle of measurement is completed, the program returns to the next measurement cycle.
4 Conclusion
Since the total phosphorus online automatic analyzer utilizes the enhanced functions of C8051F020 such as D/A conversion, A/D conversion, UART and SPI serial communication, the instrument has a compact structure and a simplified design. At the same time, since the total phosphorus online automatic analyzer integrates constant temperature, decomposition, measurement and control, it greatly simplifies the chemical analysis process, improves the detection speed and stability of online analysis, and achieves good application results.
Previous article:Design of GPS positioning data acquisition system based on MSP430F149
Next article:Design of power-off protection circuit for single-chip microcomputer
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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- [Share] I am leaving for my future father-in-law’s house, please bless me
- [Tuya Sandwich Wi-Fi & BLE SoC NANO main control board trial] Development environment construction based on docker
- Arrow Electronics Online Seminar: Intel FPGA Deep Learning Acceleration Technology Live Data Collection
- Principles of Component Screening in Circuits
- Development Language Community Rankings
- DSP2833x adds code jump file
- TI Points Mall Points abnormality
- FAQ: Anti-counterfeiting protection for disposable products | Microchip Security Solutions Seminar Series 13
- A must-read for beginners: ARM basic system explanation
- When users use 433MHz wireless modules from other manufacturers, they may occasionally fail to send or receive after purchasing samples, but may experience problems with small batches of 100...