Design of digital controlled DC current source scheme using SPCE061A single chip microcomputer

Publisher:LuckyDaisyLatest update time:2012-05-29 Source: 21ic Keywords:SPCE061A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The digitally controlled DC current source designed in this paper can effectively reduce the output error caused by component aging, temperature drift, etc. The output current is adjustable from 20mA to 2000mA, the output current can be preset, and has "+" and "-" step adjustment. The output current signal can be directly displayed and voice prompts can be given.

The hardware circuit uses the Lingyang single-chip SPCE061A as the control core, and uses the closed-loop control principle and the feedback circuit to make the entire circuit a closed loop. In terms of software, the PID algorithm is mainly used to achieve precise control of the output current. The system has high reliability, small size, simple and convenient operation, and a friendly human-machine interface.

System hardware implementation solution

This design uses a single-chip microcomputer as the main control component, presets the output current value through the keyboard and uses a liquid crystal module for real-time display. The entire system hardware consists of a microcontroller, voltage-current conversion, keyboard, display, DC regulated power supply, and voice prompt modules. The system block diagram is shown in Figure 1.

Figure 1 Basic module block diagram of digital controlled DC current source

The microcontroller is the core of the whole system and is responsible for the operation of the whole system. In order to simplify the hardware circuit, ensure the system performance is stable and reliable, and facilitate the coordination of functions such as voice broadcast, keyboard setting and real-time display of information, after multiple schemes were demonstrated, the microcontroller selected was SPCE061A from Lingyang Company. The microcontroller integrates ADC, DAC, PLL, AGC, DTMF, LCD-Driver and other circuits (related to the IC model). It uses a reduced instruction set (RISC), and the instruction cycle is in units of CPU clocks. In addition, it also has DSP functions, built-in 16-bit hardware multipliers and adders, and is equipped with special instructions owned by DSP, which greatly accelerates the running speed of various algorithms. At the same time, Lingyang microcontroller application development tools can be used in the Windows environment. The tool supports standard C language and Lingyang microcontroller assembly language, integrates assembly, programming, simulation and other functions, and greatly accelerates the software development process. It is more appropriate to use this microcontroller as a controller. Under the premise of simple hardware circuits, it is easy to realize A/D and D/A conversion, voice prompts, PID operations and other functions.

The main function of the display module is to display the set current output value and other human-computer interaction information. This part can use a seven-segment digital LED display to display information such as numbers, simple letters and decimal points, but because its display information is single and the human-computer interaction is not friendly, this article uses the character LCD display LCDSMC1602A module. This module has the advantages of being light, thin, short, low-voltage, low-power, small size, no radiation, flat right-angle display, and stable image without flickering. It also has a large visible area, good surface effect, high resolution, and strong anti-interference ability. It is suitable for displaying letters, numbers, symbols and other information, and does not require the expansion of too many peripheral circuits. It can be directly controlled by the single-chip microcomputer for output display.

The voltage-current conversion module is composed of a Darlington circuit composed of a precision op amp and three transistors. The conversion circuit uses the flat output characteristics of the transistor and the deep negative feedback circuit to stabilize the output current. As shown in Figure 2, this V/I conversion circuit has a strong load capacity and a current output range of 0"3A. The output current Io obtains a feedback voltage Vf through the feedback resistor RF, Vf= V11-V12, which is added to the two input terminals of the operational amplifier through R5 and R6. Assume that the voltages at both ends of the op amp are V1 and V2, and Vi is output by the microcontroller DAC. Because the input current of the ideal op amp is approximately zero, and V1=V2, then:

V12[1-R6/(R2+R6)]+ViR6/(R2+R6)=V11R1(R1+R6)

Since V12 = V11-Vf, then:

V11R2/(R2+R6)+(ViR6-VfR2)/(R2+R6)=V11R1/(R1+R5)

Let R1=R2=10kW, R5=R6=1kW, then Vf=ViR6/R2=Vi/10[page]

If feedback is not considered for the time being, Io=Vi/(10Rf). It can be seen that the calibration of the output current is determined by the output voltage Vi obtained by D/A conversion and the resistance value of Rf, which is a linear transformation. Rf is made of large-diameter copper wire, and its temperature coefficient is very small (5ppm/℃). The large wire diameter can minimize its temperature influence. The three transistors should use high-power tubes TIP122, and use heat sinks to ensure that the tubes work in the linear area.

Figure 2 V/I conversion circuit diagram

There is another solution for the voltage-current conversion module, which is to use three operational amplifiers to form a current source with variable output current, as shown in Figure 3. The output current I=Vi/R1. In order to keep the voltage across R1 constant, the differential amplifier IC1b monitors the potential across R1 through the emitter follower IC1c. This potential is added to the inverting input of the comparator ICa through the 7th pin of IC1b and compared with Vref. According to the comparison result, the output of the comparator changes until it is balanced, that is, Vr1=Vi. The capacitor in the circuit is used to compensate the frequency of ICa and reduce the delay of the control loop. As long as R1=R2=R3=R4=R5, the performance of this circuit is good, but the load capacity is not strong, and the loop delay compensation has a greater impact on the stability of the circuit.

Figure 3 Three op amp V/I conversion circuit

The system keyboard module can be connected in an independent or row-column (matrix) manner. This module mainly completes the setting of output current and other information. The DC regulated power supply module supplies power to the entire system. The voice module implements voice prompts, making the system design more user-friendly and the system has a friendly working interface. The Lingyang microcontroller integrates ADC, DAC, PLL, AGC, DTMF and other modules. The voice function can be implemented by software programming without any external circuit, which effectively utilizes system resources.

System operation and software process


Through the above analysis of each module, the system will convert the preset current by SPCE061A MCU through D/A conversion during operation, drive the V/I conversion circuit with output voltage, and input the voltage corresponding to the current into the MCU system after A/D conversion through the closed loop and A/D conversion by the signal processing circuit, and adjust the current output through the PID algorithm. The whole system workflow is shown in Figure 4.

System workflow diagram

Figure 4 System workflow diagram

The system software design is carried out in the Lingyang 16-chip microcomputer application development tool unSPIDE1.16.1. Lingyang MCU assembly language and standard C language are used to program the MCU to realize various functions. It mainly includes: (1) system initialization, including the initialization of various peripheral interface devices; (2) keyboard input; (3) D/A, A/D conversion; (4) PID algorithm for current adjustment; (5) voice prompt and current display. The main program flow is shown in Figure 5. [page]

Main program flow chart

Figure 5 Main program flow chart

The A/D conversion part of the program is mainly used to convert the analog voltage signal collected by the sampling resistor into a digital signal. The sampling signal is input by IoA6 and directly sent to the buffer P_ADC_MUX_Data. After the ADC automatic mode is enabled, a start signal will be generated. At this time, RDY=0, and the voltage analog quantity of DAC0 is compared with the external sampling analog quantity to find out the digital quantity of the external signal analog quantity as soon as possible. The result of A/D conversion is saved in SAR. When the 10-bit A/D conversion is completed, RDY=1. At this time, by reading the P_ADC_MUX_Data unit, the 10-bit A/D conversion data can be obtained. The flow of its IRQ1 interrupt service program is shown in Figure 6.

Flowchart of IRQ1 interrupt service routine

Figure 6 Flowchart of IRQ1 interrupt service routine

PID algorithm is mainly used to correct the deviation between the actual output current value and the set value, adjust the next output value, make the output closer to the set value, and improve the accuracy. The specific control process is: the single-chip microcomputer reads the actual current Ik through the A/D conversion chip, and then compares it with the set current Is to obtain the deviation value Ek=Is-Ik. The single-chip microcomputer calls the PID formula according to the size of Ek, calculates the increment ΔIk of this current regulation, and then calculates the output current Iq this time according to the previous D/A conversion output current Iq-1.

The calculation formula of discrete incremental PID is:

ΔI=Kp[(I-I-1)+K1I+KD(I-2I-1+I-2)]

=Kp(I-I-1)+K1'I+KD'(I-2I-1+I-2)

Where: K1'= Kp*K1, KD'=Kp * KD, Ek is the current error of this sampling, Ek-1 is the current error of the last sampling, and Ek-2 is the current error value of the next sampling.

Conclusion

In order to test the accuracy and reliability of the system operation, the set value and feedback value can be tested, and the error is within 0.01%. The operation is stable, achieving the expected purpose, and adding a unique audio playback design. Lingyang SPCE061A microcontroller is used in this system, making the system fully functional, the peripheral circuit simple, and the output accurate. The software programming is implemented by C and assembly mixed programming, which combines the two advantages, enriches the programming idea, and reflects great superiority.

Keywords:SPCE061A Reference address:Design of digital controlled DC current source scheme using SPCE061A single chip microcomputer

Previous article:Single chip solar lawn lamp LED lighting design
Next article:Application of SPMC65P2102A microcontroller as the main control chip of soybean milk machine

Recommended ReadingLatest update time:2024-11-16 22:20

Application and design of SPCE061A in sensor test system
introduction In recent years, the research on gas sensors has developed rapidly, and the testing of gas sensors has become more and more common. Sensor testing is mainly to detect the indicators of the sensor to determine whether the sensor is a qualified product. The performance indicators of the sensor gene
[Microcontroller]
Application and design of SPCE061A in sensor test system
A two-stage inverted pendulum control system using the SPCE061A single-chip microcomputer
The inverted pendulum system is an ideal experimental device in the study of control theory. The inverted pendulum system can be controlled stably using a variety of theories and methods, such as PID, adaptive control, state feedback, intelligent control, fuzzy control, and artificial neural network. These theories
[Microcontroller]
A two-stage inverted pendulum control system using the SPCE061A single-chip microcomputer
Design of storage function expansion of universal oscilloscope based on SPCE061A
  1 Introduction   At present, general-purpose two-trace oscilloscopes such as HH4310A/HH4311A, RS8, etc. do not have storage functions. They can meet the requirements of signal measurement in student experiments, but if they are used to measure some non-periodic single pulse signals, due to the suddenness of the sign
[Test Measurement]
Design of storage function expansion of universal oscilloscope based on SPCE061A
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号