Esempio n. 1
0
void setup()
{
    DDRA = 0x00;
    DDRB = 0x0F;
    
    /* enable internal pull-ups on PORTA */
    PORTA = 0xFF;
    
    enable_INT();
    
	dir = RIGHT_DIR;

    SETBIT(PORTB, SHIFT_LATCH);
    sei();
}
 // Se mettre en etat d'attente du front descenfdant du RW1 
 // Waiting for the falling edge of RW1
 void do_idle(void) 
 { 
   inwaitingstate = 1; 
   waitforstart = 0; 
   initreception(); 
   disable_T0();     // Pas besoin de timer; 
                     // We do not need the timer
   #ifdef avecnpn 
      RWOUT = 0;      // Ligne RW = 1 
	                  // Set RW = 1
   #else 
      TRISC = TRISC | 0b00000001; // RWout en entr?e 
	                              // RWout as input
      RWOUT = 1;      // Ligne RW = 1 
	                  // Set RW = 1
   #endif 
   SSPIE = 0;     // pas d'irq en reception 
                  // Disable interupt on reception
   enable_INT();  // Irq sur descente du RW 
                  // Interrupt on falling edge  of RW1
 }