Measurement and control technology has been an important part of human life and production since ancient times. With the development of science and technology, measurement and control technology has entered a new era. in recent years. With the rapid development of electronic technology, computers are widely used in automatic detection and control systems, so that the monitoring of voltage, current and temperature becomes more and more important. Now there are more and more cases of using digital systems to process analog signals, but the signals processed by digital systems are discontinuous digital signals, and the voltage, current and temperature to be measured are analog quantities, This requires the monitoring of analog signals into digital signals, and ultimately processed by the system. Actel’s new FPGA fusion series solves a series of problems such as digital to analog conversion and power on non operation. Actel announced the launch of a new fusion technology, which will bring real programmable functions to the solution of mixed signal. The fusion technology is the first to integrate the analog function of mixed signal, flash memory and FPGA structure into a single programmable system chip. The integration technology brings the advantages of programmable logic into the application fields, which can only use discrete analog components and devices provided by mixed signal ASIC suppliers until now. At the same time, when the fusion technology is shared with Actel’s ARM7 and 8051 based soft MCU core, it can be used as the ultimate soft processor platform. This new technology can give full play to Actel’s unique advantages of flash based FPGA, including high insulation, three well structure and the ability to support high voltage transistors, to meet the stringent requirements of mixed signal system design.
1. Scheme selection
The system can be implemented in many ways.
Scheme one is a traditional one bit analog control scheme. Select analog circuit, set the given value with potentiometer, when the feedback temperature value is compared with the set value, decide whether to heat or not. But it makes the system greatly affected by the environment, can not achieve complex control algorithm, can not use digital display, can not use keyboard settings.
The second scheme is a traditional two position analog control scheme. The basic idea is the same as scheme one, but the control precision is improved because of the upper and lower limit comparison circuit. This method is still analog control mode, so it can’t realize complex control algorithm and make the control precision higher. In addition, it can’t be set with digital display and keyboard.
The third scheme is implemented by cortex M1 FPGA system. The hardware of the system uses a single chip to complete various functions. The software programming is flexible and has a large degree of freedom. Various control algorithms and logic control can be realized by software programming, and various functions such as digital display and keyboard setting can also be realized. The circuit diagram of the system is shown in figure 1.
Scheme 1 and scheme 2 are the traditional analog control methods, but it is difficult for the analog control system to realize the complex control law, and the modification of the control scheme is also troublesome. The third scheme is to use the control system with cortex M1 as the control core, especially for the temperature control, which can achieve the control effect that the analog control can not achieve, and can realize the display, keyboard setting and other functions, and is easy to expand, which greatly improves the intelligence of the system, and also greatly improves the accuracy of the measured results of the system. Therefore, option 3 is selected.
2. Device introduction
The processor core of the system is 32-bit arm cortex M1, which is the first arm processor specially designed for FPGA application. The running speed of cortex M1 processor is up to 68MHz, which can be realized by 4353 tiles. Cortex M1 processor adopts three-level pipeline structure, and its instruction set uses a subset of the classic thumb-2 instruction set, so it can use the existing thumb code without changing. The configured cortex M1 processor can be connected to advanced high performance bus (AHB), which enables design engineers to build their own subsystems and easily add peripheral functions.
2.1 data acquisition
The sensor part can use either thermistor or integrated temperature sensor. Due to the poor accuracy, repeatability and reliability of thermistor, in order to meet the needs of the development board, the transistor is used as the temperature sensor. The principle of system temperature detection data acquisition is shown in Figure 2.
Here, the temperature sensor uses the transistor 2N3904, which is a bipolar transistor. In use, the collector and base should be connected according to figure 2. The temperature of the transistor will affect the relationship between the current and voltage on the PN junction, which is the theoretical basis for the temperature monitoring of fusion devices. The voltage vadc to the A / D converter can be obtained from the following formula:
Where n is the ideal coefficient of the transistor. In the design, the n of 2N3904 is 1.008, approximately 1. C is the amplification factor of ADC in the module, C = 12.5; I, I are the two current sources used in the module, I = 100 μ a, I = 10 μ a; K is Boltzmann constant, k = 1.3806 × 10-23j / K; q is the charge of proton, q = 1.602 × 10-19c; because of the adopted Q, the temperature value measured by ADC is Kelvin; t is the temperature to be measured by the system, here is the temperature measured by the sensor.
2.2 keyboard control and control circuit
Because the system can communicate with PC when it is running, it can directly use PC to set the upper and lower temperature values without additional keyboard circuit design. However, due to the limited conditions, the heating and cooling system can be realized in a simple analog way. The relay circuit is driven by the given signal of the system to complete the heating and cooling effect, and give an alarm when it is out of range.
2.3 digital display
The system uses more advanced LCD to display the results, which is visual. Organic light emitting device is used here. OLED）SSD1303T6。 Compared with liquid crystal display (LCD), OLED has the advantages of low driving voltage, low power consumption, active light-emitting, ultra-thin flat panel, fast response and relatively simple process. Ssd1303 is a monochrome OLED module packaged with tab by crystal gate company. The driver IC based on CMOS technology integrates row and column drivers, controller and SRAM. It can support a maximum resolution of 132 × 64, display 4-color region colors, and programmatically realize 256 gray levels. It can realize horizontal scrolling display. Ssd1303 provides 68008080, SPI and other display interface modes for communication with MCU. SPI interface is used in the design. Because the OLED control chip does not contain a word library, we design a word library and use 8 × 8 dot matrix display. An example of font design is shown in Figure 3, which is the font model of character “C”.
The characters needed in the design are relatively simple, and the characters “O ~ 9”, “.”, “:”, “t” are designed according to the needs. Because the font library is small, the data is stored in array. The following procedure is shown.
3 system design
The temperature measurement and control system designed here adopts the SOPC solution of Actel company, which is based on the embedded soft core cortex M1 core. In terms of performance, cortex M1 can meet the design of most of the current embedded products. The main circuit of the system adopts fusion series FPGA provided by Actel company to realize temperature control. Due to the limitation of heating and cooling conditions, only analog mode is adopted. The circuit can display the temperature, set the upper and lower limit temperature, alarm out of range and communicate with PC. The measurement accuracy and control accuracy of the system are good.
3.1 hardware design principle
The hardware platform of the system can be roughly divided into the following functional modules: analog input module, microprocessor and its peripheral module, UART module, clock generation module, PWM module. These function modules are composed of IP core provided by Actel company. In coreconsole, each module is configured and interconnected with AHB and APB through the bus interface of the module. The final result is shown in Figure 4. The signal in the upper right corner is connected to the top module.
As shown in Figure 4, the cortex M1 is the microprocessor core, which is responsible for processing the collected data and generating the corresponding control signal to the peripheral control circuit; the coreahbnvm is the soft core to control the flash, so that the system can run when it is powered on without losing power; the coreai is the analog input module, which is responsible for converting the peripheral collected analog signal data into digital signal. Coreu artapb is the core of serial port, which is responsible for sending the processed data to PC through serial port, so that it can interact and control in real time; core GPIO and coregplo_ The two cores are general I / O cores, which are responsible for data communication and peripheral control signal output of OLED respectively.
The circuit of alarm and heating simulation when the peripheral temperature of the system exceeds the upper limit is shown in Figure 5.
3.2 software design
The main function of the system is to convert the analog signal collected by the system into digital signal through hardware, and send the monitored data to the super terminal of PC through UART for display; at the initial stage of system operation, the upper and lower limits of temperature can be set, and when the temperature exceeds the range, the alarm will be given, and the corresponding control signal will be generated for heating or cooling. The operation of each module is coordinated by the microprocessor cortex M1. The system continuously monitors the analog input, if the analog input changes, it performs a / D conversion, and sends the converted results to cortex M1; cortex M1 then sends the received results to the super terminal of PC through UART within the specified time for display and color display on the OLED screen of the system.
The design of system application software is completed on Actel’s softconsole development platform. Due to the complexity of the program, it can be divided into several subroutines, including the initialization configuration of coreuart, coreai, LED screen, and the completion of the main program of cortex M1. C. The system flow chart is shown in Figure 6.
After the actual debugging and operation, the super terminal can get the monitored temperature value, and can realize the alarm when the temperature exceeds the range and realize the effect of heating and cooling under normal control. The design can measure and display the temperature value in real time with high precision and fast response, and achieves the expected design goal.
Editor in charge: GT