#include <iom8v.h>#include <macros.h>/**//*-----------------** PC0 ------ DATA ** PD2 ------ CLOCK ** PB0~7 --- LED1~8 **-----------------*/#define PC0 0#define PC1 1#define PC2 2#define PC3 3#define PC4 4#define PC5 5#define PC6 6#define PC7 7#define CUR_DATA (PINC & BIT(PC0) ? BIT(0) : 0x00) //当前传送的DATA值#define LED_DATA PORTB //LED灯接口void Device_Init(void) //系统初始化...{ Port_Init(); //stop errant interrupts until set up CLI(); //disable all interrupts MCUCR = 0x02; //设置成INT0端口下降沿触发 GICR = 0x40; TIMSK = 0x00; //timer interrupt sources SEI(); //re-enable interrupts //all peripherals are now initialized}void Port_Init(void)...{ DDRB = 0xFF; DDRD = 0x00; DDRC &= ~BIT(PC0); PORTC = 0xFF; PORTB = 0xFF;}#pragma interrupt_handler int0_isr:iv_INT0void int0_isr(void)...{ //external interupt on INT0 static UINT8 s_chData = 0; //用来保存读取的数据 static UINT8 s_chCur_Bit = 0; //用来计数,表示当前获取到第几位 if(s_chCur_Bit > 10) //如果已经获取完整个数据 ...{ s_chCur_Bit = 0x00; //计数器置零 s_chData = 0x00; //数据置零 } else if(s_chCur_Bit >= 1 && s_chCur_Bit <= 8) //当前数据为有用位 ...{ s_chData |= CUR_DATA << (s_chCur_Bit - 1); //因为数据是从最低位开始传输的 } if(s_chCur_Bit == 8) //如果数据获取完整 ...{ LED_DATA = ~s_chData; //用LED灯显示结果 } s_chCur_Bit++; //计数器加一}void main()...{ Device_Init(); while(1) //程序空转,碰到中断执行中断函数 ...{;}}