文件名称:AD
介绍说明--下载内容均来自于网络,请自行研究使用
/*软件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 (about 1KHz), but only one capacitor and a resistor of temptation, I think you will accept my gift of prawns. Is useful for certain occasions. Principle is to use 470K resistor to the 1uF capacitor, using P0.0 port as the test voltage, when the voltage is less than 1/3 VCC when, P0.0 read into the I/O level to 0, when the charging voltage over 1/3 VCC time, P0.0 read the I/O level to 1. By measuring the time spent in this process, we can determine the input voltage (with translation). The preparation process to achieve with Timer 0
而且速度低(约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 (about 1KHz), but only one capacitor and a resistor of temptation, I think you will accept my gift of prawns. Is useful for certain occasions. Principle is to use 470K resistor to the 1uF capacitor, using P0.0 port as the test voltage, when the voltage is less than 1/3 VCC when, P0.0 read into the I/O level to 0, when the charging voltage over 1/3 VCC time, P0.0 read the I/O level to 1. By measuring the time spent in this process, we can determine the input voltage (with translation). The preparation process to achieve with Timer 0
(系统自动生成,下载前可以参看下载内容)
下载文件列表
AD.c