“The characteristic of this design is to ensure low power consumption and lower cost while ensuring the measurement. In the signal measurement part, the 16-bit ADC guarantees the measurement; in the signal output part, the voltage signal and current signal are generated by PWM.
This paper introduces the principle of industrial signal generation and measurement, and mainly studies the design of industrial signal generation and measurement instruments based on TI’s MSP430F42x.
Industrial signal generation and measurement instruments are very important detection instruments in the production process system. They can simulate and output various detection signals required in the measurement and control of industrial control processes. At the same time, they can also measure the signals generated in these industrial control processes. Used for on-site adjustment of industrial instruments.
The characteristic of this design is to ensure low power consumption and lower cost while ensuring the measurement. In the signal measurement part, the 16-bit ADC guarantees the measurement; in the signal output part, the voltage signal and current signal are generated by PWM.
This design consists of two MSP430F series MCUs. MSP430F425 realizes the measurement of voltage and current signals, while MSP430F449 realizes the output of voltage and current signals and the measurement and output of frequency signals.
1 Collection of industry standard signals
The signal measurement part in this instrument is realized by MSP430F425. The power consumption of this one-chip computer is very low, the power supply current is 400μA; the power supply current of standby mode is 1.6μA. The single-chip microcomputer adopts a 16-bit reduced instruction structure (RSIC) with a 125ns instruction cycle; it can install a low-frequency 32k or 8M high-frequency crystal. It has 3 channels of 16-bit Sigma-Delta ADC, a drive module that directly drives a 128-segment liquid crystal Display, 1 RS232C/SPI communication port, 1 16-bit timer with capture/comparison function, and 16k program flash memory and 2k random access memory.
(1) Measuring part
The measuring part of this instrument is shown as in Fig. 1. The three ADCs measure current, voltage, and the current and voltage signals fed back from the output terminal respectively.
The instrument uses a 16-bit ADC to measure a current signal of 4-24mA. The current signal is first converted into a voltage signal less than VREF=1. 2V, and then connected to the differential input of the ADC. A 50Ω resistor is used to generate 1.2V at 24mA. The differential voltage.
The instrument uses a 16-bit ADC to measure a voltage signal of 0-10V. In order to make the input impedance greater than 10MΩ, an OP27 operational amplifier is used to form the input structure of the instrumentation amplifier. At the same time, the operational amplifier THS4130 with a differential output structure is also used to connect to the differential of the ADC. Input terminal. In this way, the THS4130 output signal is VOD=(RF/RG)*(1+2R2/R1)*VI, when the full scale is 10V, select R1=R2=1kΩ RC=30kΩ, RF=1k, then VOD=1. 0V ; When the full scale is 1.0V, select R1=R2=1kΩ, RG=30kΩ, RF=10k, then VOD=1. 0V, and the range is selected by switch S1. In order to meet the demand of ADC, connect VCM end and VREF, make the output voltage offset +1.2V.
The instrument uses a 16-bit ADC to measure the output voltage or current of the instrument, and correct the output signal to make the error of the output voltage and current smaller.
ADC clock chooses MCLK, adopts the phase-locked loop to make the frequency stable to 1.048MHz, the sampling rate is 4096, timing 3 way continuous conversion, 32 conversion results are added together to get the average value.
The one-chip computer in the measurement part uses the SPI interface to sequentially output 3 channels of ADC data to the data processing and display part.
(2) Data processing and display part
The data processing and display functions are realized by MSP430F449, and its schematic diagram is shown in Figure 2.
As shown in Figure 2, there are 4×4 keyboards and 7-digit liquid crystal displays in the data processing and display circuit. The SPI0 pins P3.3 and P3.1 of its F449 are connected to the P1.6 and P2.1 pins of the F425 one-chip computer in the measurement part. F425 acts as the master and sends data to the slave F449 regularly. The data processing and display part multiplies the measured data by the scale factor input by the keys, converts it into a decimal number, and outputs it to the liquid crystal display. Under the control of the buttons, the LCD can display the input voltage or current separately, or the output voltage and current, or display them sequentially and regularly. This part processes the measured frequency and the displayed output frequency in the same way.
2 Generate voltage and current signals
This instrument produces the industry standard 4-20mA electric current and 0-10V voltage signal, its principle picture is shown as in Fig. 3.
It can be seen from Figure 3 that both the voltage signal and the current signal are realized by PWM. In order to make the output voltage and current value accurate, the feedback control principle is adopted, which is to make the F425 single-chip microcomputer measure the output voltage or current, and then compare the measured data with the set value of the voltage or current, and then correct the output with the error value.
PWM is realized by the timer B output mode 7 of the F449 single-chip microcomputer. For the full-scale current of 20 mA, in order to reach 0.1%, the current represented by the count number of each timer B is 22 μA. Take 5μA here and set CCRO=4000. If the clock frequency is 8MHz, the PWM frequency is 2000Hz. For a 10V voltage signal, in order to reach 0.1%, the voltage represented by the count number of each timer B needs to be 10mV, here 2.5mV, set CCR0=4000, and the clock frequency is 8MHz, then the PWM frequency is also 2000Hz.
Since the output is DC voltage and current signals, simple RC filtering can meet the requirements.
F449 realizes the voltage output process: After the keyboard input the voltage value that needs to be output, the corresponding CCR1 value is calculated, and the output TB1 outputs a pulse with a frequency of 2000 Hz according to the duty ratio given by CCR1, and outputs a stable DC voltage after filtering; 1/10 of the voltage is fed back to the input of the 16-bit ADC to generate the numerical data of the current output voltage. After the data is accumulated and averaged for 32 times, it is compared with the set value, and the error value is added to the value of CCR1 to generate a new CCR1 Value, also adjust the output voltage. Since a number in the CCR1 value represents a voltage value that is much smaller than the 10mV error, there must be a CCR1 value to make the output voltage meet the requirements.
The process of F449 to achieve accurate current output is basically the same as that of voltage output, except that the output current is sampled.
3 Measuring and generating frequency signals
(1) Measurement of frequency signal
The frequency measurement is realized by timer B in F449. The frequency signal of 1～1000Hz is input from the input pin of CCP module. The TBR value of the timer is captured at the rising edge of the measured pulse, and the TBR value is captured again at the rising edge of the second pulse. Value, the difference between the two TBR values is the pulse period under test.
(2) Frequency signal output
The TB6 pin of F449 outputs a frequency signal with a range of 1～1000Hz, which makes Timer B work in the comparison mode of continuous counting. According to the output frequency, the value of CCR6 is continuously set, and when the value of TBR is the same as the value of CCR6, the output The terminal TB6 generates set and reset, and outputs a frequency signal.
The input frequency signal and the output frequency signal must pass through the signal processing circuit to make it meet the logic level of the interface circuit.
This article designs the working principle of the industrial voltage, current and frequency signal measurement and generation instrument, and gives the main part of the electrical schematic diagram. The design uses 16-bit ADC to measure current and voltage signals, so that the instrument can measure the output signal of the transmitter in the industrial field; and the voltage and current signals output by the feedback error elimination method can check the accuracy of the data acquisition instrument. After verification, the measurement and signal generation instrument implemented by MSP430 series MCU is successful and practical.
In addition, it should be noted that in the design and actual debugging of the circuit board, the analog signal should be effectively shielded and reliably grounded. Only in this way can the normal use and measurement of the device be guaranteed.