extint_chris.c

来自「实现功能ATmega单片机上处理GSM模块的数据」· C语言 代码 · 共 42 行

C
42
字号
//***********extint.c
void extintInit_IO_M16( u08 INTx )
{
	//INT0
	if( INTx==INT0 )
	{
		//set input
		cbi(DDRD,PD2);
		//set the pull-up resistance 
		sbi(PORTD,PD2);
	}
	//INT1
	if( INTx==INT1 )
	{
		//set input
		cbi(DDRD,PD3);
		//set the pull-up resistance 
		sbi(PORTD,PD3);
	}
	//INT2
	if( INTx==INT2 )
	{
		//set input
		cbi(DDRB,PB2);
		//set the pull-up resistance 
		sbi(PORTB,PB2);
	}
}
//*************************
//enable the extint interrupt
void extintEnable_M16(u08 INTx)
{

	sbi(GICR,INTx);
}
//disable the extint interrupt
void extintDisable_M16(u08 INTx)
{

	cbi(GICR,INTx);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?