📄 iar12-1.c
字号:
#include <iom16.h>
#include<intrinsics.h>
#define uchar unsigned char
#define SET_BIT(x,y) (x|=(1<<y))
#define CLR_BIT(x,y) (x&=~(1<<y))
/*******************************/
void port_init(void)
{
PORTB = 0x80;
DDRB = 0x80;
}
/*******************************/
void comparator_init(void)
{
ACSR = 0x40;
}
/*******************************/
void init_devices(void)
{
port_init();
comparator_init();
MCUCR = 0x00;
GICR = 0x00;
TIMSK = 0x00;
}
/*******************************/
void main(void)
{
uchar temp;
init_devices();
while(1)
{
temp=ACSR&0x20;
if(temp==0)
SET_BIT(PORTB,7);
else
CLR_BIT(PORTB,7);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -