Design and application of precision programmable current source

Publisher:和谐共融Latest update time:2006-11-21 Source: 国外电子元器件Keywords:Temperature 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 forming automatic test systems and calibration systems. 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. middle. 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, USB interface unit, temperature measurement unit, output current calibration unit, signal output unit and 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 at the same time analyzes the host computer commands to control the signal output signal and 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 over-current detection, system self-test, relay isolation output and other units, which further improves the intelligence and reliability of the system.

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-swappable, high-speed and plug-and-play characteristics 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 Show.

In the figure, FT232AM completes the conversion of the USB bus to the MCU serial port signal line, so that the host computer can virtualize the USB into a traditional serial port, thus simplifying the driver and facilitating communication between the USB bus and the MCU. In order to avoid interference between the USB signal and the signal source, an optocoupler device (U29 in the picture) is used to isolate it from the MCU and improve the system's anti-interference ability.

2.2 MCU and its external units

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

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.

Figure 2

   Taking into account the changes in the 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 different set current values ​​in each temperature range and The error between the actual output values, which is obtained by actual measurement, is called the correction coefficient. When the system is working, the current operating temperature can be obtained through the temperature measurement unit. By multiplying the set current value corresponding to the operating temperature by the correction coefficient, the nonlinear temperature compensation of the output current can be completed, greatly improving the output accuracy of the current.

The core device of the temperature measurement unit is the high-precision digital temperature measurement circuit AD7416 (U19 in the figure). It uses an IC bus to interface with AT89C51. The measured ambient temperature range is -10℃ ~ +50℃. The designed MCU is in hexadecimal The measured temperature is output in the form of a system.

The output current calibration unit is composed of M24C64 64k Bit EEPROM, which is used to store the current source correction system values. The MCU can easily read and write it through the I2C bus, and write and read the correction coefficient in the form of an 8-bit decimal number 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 instructions, and then writes specific data to the DAC conversion circuit to control the analog voltage value it outputs. The post-stage conversion circuit receives the analog voltage value output by the DAC conversion circuit to complete the conversion from voltage to current, and then outputs the current set by the host computer. The signal output unit circuit is shown in Figure 4. In

Figure 3

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

The analog voltage signal DA_OUT output by the DAC is connected to the post-stage conversion circuit XTR110. It first provides the input scaling ratio and current offset through its on-chip metal film resistor network to complete the conversion from voltage to current, and then outputs it through the IRF7104 field effect transistor. current. XTR110 has 14-bit conversion accuracy and 0.005% non-linearity, ensuring conversion accuracy. Potentiometers W3 and W4 are used to fine-tune the output current zero bias and full bias respectively to further improve accuracy.

3 Microcontroller control program design

A complete communication protocol is designed in the current source system software, which stipulates the control command words and corresponding return data values ​​that the current source obtains from the host computer. The system control program uses the AT89C51 microcontroller 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. After the system in

Figure 4

  is powered on, the MCU starts execution from address 0000H, and the entry address of the main program is 0050H. System initialization includes initialization stack, initialization DAC, initialization serial port, initialization register, initialization 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 the serial port wave rate to 19200

SETB MODE; Set system self-test

SETB R_EN ;Initialize self-test relay

MOV TX_PNT,#40H; Initialize the serial port sending buffer pointer

MOV RX_PNT,#30H; Initialize the serial port receive buffer pointer

CPL WDI; initialize watchdog

SETB TR1; turn on timer 1

SETB REN

SETB ES; open serial port interrupt

SETA EA; enable microcontroller interrupt

MOV STATUS, #01H; enter the running state

3.2 Serial port interrupt handler

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

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 multiplied by 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 and control the final current output. The main code in the microcontroller serial port interrupt handler is 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; the highest bit stores R2

MOV A,38H

ANL A,#0F0H

CJNE A,#30H,PACK3……

PACK3: MOV A, 38H

CLR C

SUBB A, #37H

PACK4: MOV R1, A; the middle bit is stored in R1

MOV A, 39H

ANL A,#0F0H

CJNE A, #30H, PACK5…

PACK5: MOV A, 39H

CLR C

SUBB A, #37H

MOV R0, A; the lowest bit is stored 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 for the microcontroller to read the current temperature value and correction coefficient through the I2C bus is similar to this. Here, only the program for reading the temperature value is given:

;Read A Byte From AD7416 E2RPOM

ACALL RDBYTE; Read the high bit of the 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 the 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 remains high

MOV C,TMSDA

RLC A

CLR TMSCL; SCL remains low and SDA level changes

NOP…

DJNZ R0, RDBIT; end of reading

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 used in an automated calibration system for an airborne signal conditioner. This automated calibration system can simulate various input signals required by the signal conditioner, and use the conditioning 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 reduction of personnel workload.

Keywords:Temperature Reference address:Design and application of precision programmable current source

Previous article:Bipolar current source maintains high output impedance at high frequencies
Next article:DS1922/DS1923 battery fuel gauge

Latest Power Management 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号