//A Sample code for switching a port pin PA0 high for 0.5 seconds and low //for 0.5 seconds #include //This includes appropriate header file for the //device as selected #include //Library header file to use __delay_cycles() //Macro definition for reversing a bit #define REVERSEBIT(ADDRESS, BIT) (ADDRESS ^= (1 << BIT)) //Assuming Default Internal clock of 16.0 MHz __C_task void main(void) //Main function { DDRA = 0x01; //Set Data Direction Register for PA0 as output while(1) //An infinite looping begins { REVERSEBIT(PORTA, PA0); __delay_cycles(8000000); //Reverse bit after 0.5 seconds } }