中科因仑“3+1”工程特种兵精英论坛
标题:
016、模拟比较器的设计应用
[打印本页]
作者:
张衍波
时间:
2015-4-29 20:46
标题:
016、模拟比较器的设计应用
/********************************************************************
汇诚科技
网址:
http://www.ourhc.cn
产品有售淘宝店:
http://shop36330473.taobao.com
*********************************************************************/
#include <iom16v.h>
/********************************************************************
数据类型定义
*********************************************************************/
#define uchar unsigned char
#define uint unsigned int
/**********************************************************************
主函数
**********************************************************************/
void main(void)
{uchar i;
DDRB=0xf0; //设置PB7输出,PB3~PB2输入
PORTB=0x00;
ACSR=0x00; //模拟比较器使能
while(1)
{if((ACSR&0x20)==0x20)
PORTB=PORTB|0xf0;
else PORTB=PORTB&0x0f;}
}
/**********************************************************************
结束
**********************************************************************/
[attach]2579[/attach]
欢迎光临 中科因仑“3+1”工程特种兵精英论坛 (http://bbs.enlern.com/)
Powered by Discuz! X3.4