资 源 简 介
软件A/D所能实现的精度有限,测量电压范围是2-15V,
而且速度低(约1KHz),但仅用一个电容和一个电阻的诱惑
力,我想大虾您会笑纳的。用于某些场合是有用的。
原理是利用470K电阻对1uF电容充电,利用P0.0口作为检测电压,
当电压低于1/3 VCC时,P0.0读入的I/O电平为0,当充电电压超过
1/3 VCC时,P0.0读入的I/O电平为1。通过测量此过程所用的时间,
就能判断输入电压(需要换算)。
程序的编写用定时器0实现-Software A/D can achieve the accuracy is limited, measuring voltage range is 2-15V, and low-speed (approximately 1 KHz), but only a capacitance and resistance of a temptation, I think you will prawns to the heart. For certain occasions is useful. The principle is the use of 470 K resistor pairs .1 uF capacitor charging, as I use P0.0 detection voltage, When the voltage is lower than 1/3 VCC, P0.0 read into the I/O level to 0, When the charging voltage over 1/3 VCC, P0.0 read into the I/O level to 1. By measuring this process, the time spent, we will be able to judge the input voltage (need conversion). The preparation procedures used to achieve timer 0