
STK511 Receiver Board
STK511 User Guide
3-5
4842B–AVR–10/09
{
// Check D_CLK. Exit when high
if(PINB.2 == 1)
{
flag2 = 1;
//PORTD = 0xFF; //For Debug
}
// Increment timeout
else if(PINB.2 == 0){+;}
}
}
// Check level of DATA line. Load value into register
if(PINB.4 == 1 && flag2)
{
// If DATA line high load a
0
// This will reverse the data and
// Turn on the LED when a
1
was sent
ReceiveData[j] &=(~(1<<(i-1)));
}
// Check level of DATA line. Load value into register
if(PINB.4 == 0 && flag2)
{
// If DATA line low load a
1
// This will reverse the data and
// Turn off the LED when a
0
was sent
ReceiveData[j] |=(1<<(i-1));
}
}
}
// Check for two of the three bytes received to match before displaying
if(ReceiveData[0] == ReceiveData[1] || ReceiveData[0] ==
ReceiveData[2])
{
DisplayData = ReceiveData[0];// Load data to be displayed
delay_ms(40);
// Wait
DisplayLED();
// Write to LEDs
}
// Check for two of the three bytes received to match before displaying
else if(ReceiveData[1] == ReceiveData[2])
{