Design of digital controlled current source based on single chip microcomputer PIC16F877A

Publisher:二进制游侠Latest update time:2010-07-12 Keywords:PIC16F877 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

Power supply technology, especially digital control power supply technology, is a very practical engineering technology, involving many disciplines such as electrical, electronic, system integration, control theory, and materials. The development of computer and communication technology has provided a broad development prospect for power electronics technology, and at the same time has put forward higher requirements for power supply. Ordinary power supplies can no longer meet the actual needs due to their shortcomings such as low precision. It was not until the emergence of single-chip microcomputer technology and voltage conversion modules that the development of precise digital control power supplies became possible. The digital control current source designed in this paper uses the PIC16F877A single-chip microcomputer as the core component, and the keyboard, display, D/A, switching power supply and other modules as peripheral circuits.

2 Design requirements and overall design ideas

2.1 Design requirements

The design requirements are: input 220V, maximum output 12V; output current controlled by keyboard, step size 0.01A; output current displayed by LED, accuracy 0.02A; current source steady current range is (0.2-1)A.

2.2 Overall design ideas

This design uses a switching power supply to achieve the output range, accuracy and ripple requirements. According to the system requirements, after D/A conversion, the power amplifier composed of an operational amplifier is used to control the D/A input, thereby controlling the current value. This system is mainly composed of a numerical control part, a power supply part and a keyboard display circuit. The system principle block diagram is shown in Figure 1.

3 Hardware circuit design and software selection

According to the design requirements of digital controlled current source, the system is mainly composed of control module, power module, D/A module and keyboard display module.

3.1 Selection of control module

This design uses the PIC16F877A single-chip microcomputer control. Compared with the AT89C51 single-chip microcomputer, the PIC16F877A adopts the Harvard structure, can realize the single-finger instruction, has a reduced instruction set technology, simple addressing mode, strong I/O port driving ability, and has I2C and SPI serial bus ports. The peripheral circuit is simple, which is not only convenient for development, but also can save users' circuit board space and manufacturing costs. The program has strong confidentiality, low power consumption, wide voltage design, can combine a considerable number of peripheral devices together, is easy to use, and has improved anti-interference performance.

3.2 Selection of power module

The power supply module generally adopts full-bridge rectifier plus capacitor filter circuit, three-terminal voltage regulator integrated circuit external expansion tube and switching power supply circuit. The full-bridge rectifier plus capacitor filter circuit is widely used in some DC current sources with low requirements. Its driving ability is related to the filter capacitor of the later stage. The remarkable feature of this circuit is that it can better meet the transient response of the current. If the load requires continuous large current output, the circuit will be powerless. The three-terminal voltage regulator integrated circuit external expansion tube not only utilizes the good voltage stabilization performance of the voltage regulator integrated block, but also has a certain current output. It is widely used in some high-precision linear voltage regulator power supplies, but the effect is poor. The power device of the switching power supply works in the switching state, with low power loss and high efficiency. The size of the matching heat sink is greatly reduced, and the size of the pulse transformer is much smaller than that of the power frequency transformer. Therefore, the current source using the switching power supply has the advantages of high efficiency, small size and light weight.

Since this design has high requirements on the power supply, especially on the power and ripple voltage of the power supply, a switching power supply circuit is used here.

3.3 Selection of D/A conversion module

TLC5615 is a product launched by Texas Instruments in 1999. It is a digital-to-analog converter with a serial interface. Its output is voltage type, and the maximum output voltage is twice the reference voltage. It has a power-on reset function, which resets the DAC register to all zeros. It is a 10-bit high-precision D/A converter with serial input, so the final output voltage after conversion can reach 0V~10V. 10-bit D/A, with a resolution of 1/2048, the sampling resistor is selected as 15kΩ, and the resolution of the D/A output can achieve a step of 0.01A.

3.4 Software Selection

Protel 99 SE software design system is an EAD circuit integrated design software platform built on IBM PC compatible environment. It has functions such as circuit schematic design, PCB (printed circuit board) design, circuit hierarchical design, report making, circuit simulation and logic device design.

MICROCHIP has equipped the PIC series of microcontrollers with a powerful software integrated development system, Mp lab, which is a full-featured software package that integrates a variety of microcontroller application development tool software.

This paper uses Protel 99 SE software design system to design the PCB board and Mp lab to perform system simulation

4 MCU Program Implementation of Digital Control Current Source

The PIC16F877A microcontroller used in this article is a new product developed by MICROCHIP. It has the function of FLASH programming and can perform operations such as pausing CPU execution and observing register contents directly on the microcontroller. It is currently the most widely used PIC microcontroller.

The functions to be realized by the microcontroller program are: the independent keyboard inputs data to the PIC16F877A microcontroller, the PIC16F877A microcontroller processes the obtained data and sends it to the 10-bit digital-to-analog converter TLC5615 to realize the control of current.

C language programming is used here, which has the advantages of high code writing efficiency, intuitive software debugging, convenient maintenance and upgrading, high code reuse rate, and convenient cross-platform code transplantation. The main program flow chart is shown in Figure 2.

5 System Testing

This design requires the output current range to be 0.2A-1A, and the voltage across the sampling resistor of the constant current source module is 200mV-2000mV. From the voltage value, it can be inferred that the reference voltage |Vref| of the digital-to-analog conversion module is at least 2V (Vref<0). The Vref of this design is -2.15V, and the analog voltage range of the output end is (0-12)V, so the output current is 0.2A-1A. The design requires any preset value within 0.2A-1A. This design inputs the current value through the keyboard and sends it to the microcontroller. The microcontroller converts the analog quantity into a digital quantity and sends it to the digital-to-analog conversion circuit according to the input key value, and then outputs the analog quantity. Some current values ​​and their corresponding theoretical and actual digital quantities are listed in Table 1. The corresponding theoretical code value is the code value required for the digital-to-analog conversion corresponding to the input current, and the actual code value is the code value sent to the digital-to-analog converter by the microcontroller after processing the input current value.

The test results listed in Table 1 show that the maximum error of the output of this design is 33mA when the input current is 32mA, and the error is 1mA. The exercise part of the question requires that the absolute value of the output current change is ≤ 0.1% of the output current + 1mA, that is, 1.032, so the error value measured by this design reaches the error value specified in the design requirements.

6 Conclusion

The digital current source designed in this paper uses PID algorithm to realize the functions of selectable range, adjustable output, precise stepping, and extremely small ripple current, and the preset value and measured value of the output current can be displayed on the LED at the same time. The human-machine interface uses an independent keyboard and LED display, and the control interface is intuitive and concise, with good human-machine interaction performance. It has the advantages of flexible control, convenient system upgrade, improved reliability of the control system, easy standardization, convenient system maintenance, good consistency, low cost, and convenient production and manufacturing.

Keywords:PIC16F877 Reference address:Design of digital controlled current source based on single chip microcomputer PIC16F877A

Previous article:Solar and mains complementary lighting system controller based on PIC
Next article:Design of digital virtual surround sound controller based on PIC microcontroller

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

PIC16F877 Timer 0 Query Mode Debugging
The query mode debugging program of PIC16F877 microcontroller timer 0 is as follows:   #include pic.h #define uchar unsigned char #define uint unsigned int __CONFIG(0x3B31); void init(void); uint intnum; void main(void) {  init();  while(1)  {   if(T0IF)   {    T0IF = 0;    if(++intnum =1
[Microcontroller]
Timer0 of PIC16F877
    Timer0 is an 8-bit timer counter with a programmable 8-bit prescaler. The hardware structure is shown in the figure below:   There are three registers associated with it: If counting mode is required, T0CKI should be set to input mode, that is, the corresponding position in TRISA is set to 1.     TMR
[Microcontroller]
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号