<----- Header section -------------> #include <avr/io.h> #include <avr/interrupt.h> #include<stdlib.h> #include<compat/deprecated.h> #include <util/delay.

h> #define datapin 0x01 #define dataport PINB // Value of data port when the data pin is high // Enter the data port here

<--------Global Declarations--------------> static unsigned int count=0; static unsigned char data=0x00; <-------Main Code -------------------------> int main(void) { DDRB=0xfa; // Port initialisations PORTB=0x00; DDRA=0xff; PORTA=0xaa; DDRC=0xff; PORTC=0x00; DDRD=0xff; PORTD=0x00; cbi(GICR,5); interrupt) cbi(MCUCSR,6); cbi(MCUCSR,6); sbi(GIFR,5); sbi(GICR,5); sei(); while(1) code when integrating { } } ISR(INT2_vect) // Interrupt Service Routine to detect and act on the { // interrupts received count++; if (count > 1 && count < 10) // Read the data bits,neglecting the start bit and the stop and parity bits { data = (data >> 1); // LSB first if(dataport & datapin) {data = data | 0x80; } // Store a '1'. Here, the Pin0 of PORTB is used as input } PORTA=data; // Display received data on Port A. } // Setting up INT2 (edge triggered // to be triggered on the falling edge

// Enable global interrupts // Do nothing. Can be used to run other // other functionality