Design and application of precision programmable current source

Publisher:asd123yuiLatest update time:2013-05-16 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 System Overview

The programmable current source has the characteristics of wide output current range, high accuracy and high power. It is an essential instrument for automatic test system and calibration system. It is widely used in measuring instruments, automatic calibration and other equipment in industrial and mining enterprises, scientific research and national defense and other military units. In addition to the above characteristics, the precision programmable current source introduced in this article also has USB bus communication, temperature measurement and output current nonlinear temperature compensation functions. The

overall structure of the system is shown in Figure 1. The precision programmable current source consists of a microcontroller (MCU) unit, a USB interface unit, a temperature measurement unit, an output current calibration unit, a signal output unit and a power supply unit. The MCU unit communicates with the host computer through the USB interface unit, obtains control commands from the host computer and returns corresponding data, and parses the host computer commands to control the signal output signal to complete the final current output. The temperature measurement unit and the output current calibration unit jointly complete the nonlinear temperature compensation of the output current. The power supply unit provides the required power to other units. The precision programmable current source also includes overcurrent detection, system self-test, relay isolation output and other units, which further improves the intelligence and reliability of the system.

Jiagong Machinery Power Grid

2 System Circuit Design

2.1 USB Interface Unit

The precision programmable current source interfaces with the host computer through the USB bus. The hot-swap, high-speed and plug-and-play features of the USB interface greatly simplify the system design and facilitate the communication between the current source and the host computer. The USB interface unit circuit is shown in Figure 2.

Jiagong Machinery Power Grid

In the figure, FT232AM completes the conversion of USB bus to MCU serial port signal line, so that the host computer can virtualize USB into a traditional serial port, thereby simplifying the driver and facilitating the communication between USB bus and MCU. In order to avoid interference between USB signal and signal source, optocoupler device (U29 in the figure) is selected to achieve isolation between it and MCU, improving the anti-interference ability of the system.

2.2 MCU and its external units

The microcontroller MCU is the core control unit of the precision programmable current source. Its interface circuit with temperature measurement unit and output current calibration unit is shown in Figure 3.

Jiagong Machinery Power Grid

The MCU unit uses the AT89C51 microcontroller to build the operating environment and complete the control of the current source system, including external expansion ROM, external expansion RAM, hardware watchdog, hardware address decoder, etc. [page]

Considering the change of device output characteristics with temperature, the MCU is connected to an external temperature measurement unit and an output current calibration unit to complete the nonlinear temperature compensation of the output current. The principle is that the output current calibration unit saves the error between different set current values ​​and actual output values ​​in each temperature range. This error is obtained through actual measurement and is called the correction coefficient. When the system is working, the current operating temperature can be obtained through the temperature measurement unit. The set current value corresponding to this operating temperature is multiplied by the correction coefficient to complete the nonlinear temperature compensation of the output current, greatly improving the output accuracy of the current. The

core component of the temperature measurement unit is the high-precision digital temperature measurement circuit AD7416 (U19 in the figure), which uses the IC bus to interface with the AT89C51. The measured ambient temperature range is -10℃~+50℃. The designed MCU outputs the measured temperature in hexadecimal form.

The output current calibration unit is composed of M24C64 64k Bit EEPROM, which is used to store the current source correction system value. The MCU can easily read and write it through the I2C bus, and write and read the correction coefficient in 8-bit decimal form according to the communication protocol of the variable current source, thereby ensuring accurate nonlinear temperature compensation of the output current.

2.3 Signal output unit

The signal output unit completes the current generation and output of the precision programmable current source, including a DAC conversion circuit with a 12-bit high-precision DAC-HK12BGC DAC as the core and a post-stage conversion circuit composed of TI's precision voltage/current converter. The MCU first decodes the host computer instruction, and then writes specific data to the DAC conversion circuit to control its output analog voltage value. The post-stage conversion circuit receives the analog voltage value output by the DAC conversion circuit to complete the voltage-to-current conversion, and then outputs the current set by the host computer. The signal output unit circuit is shown in Figure 4.

Jiagong Machinery Power Grid

In the figure, the data lines D0-B7 of AT89C51 control its analog output through two 74HC573 and DAC-HK12BGC interface. The control process is as follows: AT89C51 starts DAC through CS_DA and 51_WR signals. When the combinational logic composed of DAC low byte selection signal line CS_DAL and microcontroller write enable line 51_WR is valid, the low 8-bit data is written to DAC, and then the high 4-bit data is written in the same way. To further improve the accuracy, potentiometers W1 and W2 are connected to the output of DAC, which are used to fine-tune full bias and zero bias respectively. The

analog voltage signal DA_OUT output by DAC is connected to the post-stage conversion circuit XTR110, which first provides the input scaling ratio and current offset through the metal film resistor network inside the chip, completes the voltage to current conversion, and then outputs the current through the IRF7104 field effect tube. XTR110 has 14-bit conversion accuracy and 0.005% nonlinearity, ensuring the conversion accuracy. Potentiometers W3 and W4 are used to fine-tune the zero and full deviation of the output current, respectively, to further improve the accuracy.

3. Single-chip microcomputer control program design

A complete communication protocol is designed in the current source system software, which stipulates the control command word and corresponding return data value obtained by the current source from the host computer. The system control program uses the AT89C51 single-chip microcomputer as the control core and is written in assembly language. It is divided into two parts: the main program and the serial port interrupt handler.

3.1 Main program design

The main program mainly completes system parameter initialization, system self-test, serial port interrupt configuration, etc. The process is shown in Figure 5.

Jiagong Machinery Power Grid

After the system is powered on, the MCU starts to execute from address 0000H, and the entry address of the main program is 0050H. System initialization includes initializing the stack, initializing the DAC, initializing the serial port, initializing the register, initializing the watchdog, etc. Part of the main program is as follows.

MOV SP, #58H ; Initialize stack pointer
MOV A, #00H
MOVX @DPTR, A ; Initialize DAC
NOP
MOV A, #20H ; Initialize timer 1, mode 2
MOV A, PCON
ORL A, #80H
MOV PCON, A ; Set serial port wave rate to 19200
SETB MODE ; Set system self-test
SETB R_EN ; Initialize self-test relay
MOV TX_PNT, #40H ; Initialize serial port send buffer pointer MOV
RX_PNT, #30H ; Initialize serial port receive buffer pointer
CPL WDI ; Initialize watchdog
SETB TR1 ; Open timer 1
SETB REN
SETB ES ; Open serial port interrupt
SETA EA ; Open microcontroller interrupt
MOV STATUS, #01H ; Enter running state [page]

3.2 Serial port interrupt

handler is the core part of the microcontroller control program. The serial port receives the command word from the host computer and parses the command to control the operation of the hardware circuit. The process is shown in Figure 6.

Jiagong Machinery Power Grid

Taking the most important command of setting current output as an example, the serial port interrupt handler first receives the set current value (expressed as a 3-digit hexadecimal number), and then the microcontroller reads the current temperature value and correction coefficient through the I2C bus. The system software then controls the set current value to multiply the correction coefficient to obtain the actual value, thereby completing nonlinear temperature compensation. The microcontroller can set the DAC output voltage according to the actual value to control the final current output. The main codes in the microcontroller serial port interrupt handler are as follows:

; **************************;
SET_V:MOV A,37H ;Get the highest bit of the set current value
ANL A, #0F0H
CJNE A, #30H, PACK1……
PACK1:MOV A,37H
CLR C
SUBB A, #37H
PACK2:MOV R2,A ;Store the highest bit in R2
MOV A,38H
ANL A, #0F0H
CJNE A, #30H, PACK3……
PACK3:MOV A, 38H
CLR C
SUBB A, #37H
PACK4: MOV R1, A ; Store the middle bit in R1
MOV A, 39H
ANL A, #0F0H
CJNE A, #30H, PACK5……
PACK5: MOV A, 39H
CLR C
SUBB A, #37H
MOV R0, A ; Store the lowest bit in R0
MOV A, R1
SWAP A
ORL A, R0
MOV R0, A ; Combine the lowest bit with the middle bit
MOV DPTR, #CS_DAH
MOV A, R2
MOVX @DPTR, A
MOV DPTR, #CS_DAL
MOV A, R0
MOVX @DPTR, A
MOV DPTR, #CS_DA ; Set DAC output
MOV A, #00H
MOVX @DPTR, A ; Update DAC
RET
;****************************************************;

The program that the microcontroller reads the current temperature value and correction coefficient through the I2C bus corresponds to it. Here is only the program for reading the temperature value:

;Read A Byte From AD7416 E2RPOM
ACALL RDBYTE ;Read the high bit of temperature value
MOV R1, A ;Store in R1
CLR TMSDA ;ACK
NOP…… ;NOP instruction
SETB TMSCL
NOP……
CLR TMSCL
NOP……
SETB TMSDA
ACALL RDBYTE ;Read the low bit of temperature value
MOV R0, A ;Store in R0
SETB TMSDA ;N0 ACK
NOP……
SETB TMSCL
NOP……
CLR TMSCL
NOP……
CLR TMSDA
NOP……
SETB TMSCL
SETB TMSDA ;Stop
;Read A Byte From AD7416 E2PROM
RDBYTE:MOV R0,#08H
RDBIT:SETB TMSCL ;SCL keeps high level
MOV C, TMSDA
RLC A
CLR TMSCL; SCL keeps low level, SDA level changes
NOP...
DJNZ R0, RDBIT; Read and end
RET

4 Conclusion The

precision programmable current source introduced above has an output current of 0-20mA, a programmed step current of 100μA, and a current error of less than 50μA. It has been well applied in the automatic calibration system of a certain airborne signal conditioner. The automatic calibration system can simulate various input signals required by the signal conditioner, and use the conditioned signal output by the signal conditioner of the acquisition device, and then analyze and complete the automatic detection and calibration of the airborne signal conditioner, which can greatly improve the detection accuracy, detection efficiency and reduce the workload of personnel. (end)
Reference address:Design and application of precision programmable current source

Previous article:A new milestone in the industrial development of oscilloscopes: real-time data analysis software becomes the future development direction
Next article:Miniaturized digital frequency measurement receiver

Latest Test Measurement Articles
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号