为了解决普通电源精度不高和无负电压输出的问题,研制了一种由ATmega16单片机控制的高精度数控直流电压源,该单片机片内自带10位快速PWM功能和10位逐次逼近型A/D转换器,产生PWM波和实现A/D转换,使外围电路更简单;采用两路独立的比较放大电路、功率放大电路和采样电路,并分别与单片机组成闭环反馈模式进行稳压,解决了传统数控直流电压源不能输出负电压和控制精度不高的问题;采用PID算法快速调节预置电压和实测电压的计算偏差,克服了传统逐次比较累加方法的缺点,大大提高了运行速度。测试结果表明,该电源实现了输出电压调节范围-12~+12 V,步进电压5 mV,输出电压精度为0.1%,纹波小于0.9 mVp-p,负载调整率为0.032%,电压调整率为0.04%,具有矩阵按键设置预置电压,液晶显示输出电压与预置电压和过流报警等功能。
To solve the problem of lower power precision and non-negative-voltage output,a high-precision and numerical-controlled direct current voltage source based on ATmega 16 was developed.First,the single-chip microcomputer contained a successive approximation 10-bit A/D converter with the 10-bit fast PWM function,which produced PWM wave to realize the A/D conversion and made the peripheral circuits simpler.Second,the closed-loop feedback mode composed by two independent amplifiers,the power amplifier circuit,the sampling circuit and the single chip was used for regulating voltage to solve the problem that the traditional CNC DC voltage source could not output a negative voltage.Last,the PID algorithm was used to adjust the deviation between the preset voltage and the measured voltage,which overcame the shortcomings of traditional successive accumulation method and improved the speed.The test result shows that the output voltage of the power supply with the function of the matrix button to set the preset voltage,the LCD output voltage and preset voltage and over-current alarm can be adjusted with step 5 mV in range of-12~+12 V,its precision is 0.1%,the voltage ripple is less than 0.9 mV,the load-regulating rate is 0.032%,and the voltage-regulating rate is 0.04%.