Total Phosphorus Online Automatic Analyzer Based on CIP-51 Core Microcontroller

Publisher:科技徜徉Latest update time:2011-08-29 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Internal functional block diagram of C8051F020 chip www.elecfans.com

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.

Design of online automatic analyzer for total phosphorus www.elecfans.com

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.

Reference address:Total Phosphorus Online Automatic Analyzer Based on CIP-51 Core Microcontroller

Previous article:Design of GPS positioning data acquisition system based on MSP430F149
Next article:Design of power-off protection circuit for single-chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号