exp2.c

来自「the practice of proteus and avr」· C语言 代码 · 共 20 行

C
20
字号
#include <io8535.h>
#include <intrinsics.h>

#pragma vector=0x02
__interrupt void ext_int0_isr(void)

{
  PORTA=PORTA^0x1;                //toggle the LSB of port A
}

void  main(void)
{
  DDRA=0x01;                      //port A LSB set for output
  GIMSK=0x40;                     //set the INT0 bit to enable external interrupt 0
  MCUCR=0x02;                     //set the ISC01 to activate on a falling edge
  __enable_interrupt();           //enable the global interrupt enable bit
  while(1)
  ;                               //do nothing - the interrupt does it all
}

⌨️ 快捷键说明

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