![Atmel STK511 User Manual Download Page 12](http://html.mh-extra.com/html/atmel/stk511/stk511_user-manual_3003507012.webp)
STK511 Receiver Board
3-4
STK511 User Guide
4842B–AVR–10/09
timeOut = 0;
// Look for D_CLK to end pulse.
if(flag1)
{
while(!flag2 && timeOut < timeOutVal)
{
// Check D_CLK. Exit when high
if(PINB.2 == 1){flag2 = 1;}
// Increment timeout
else if(PINB.2 == 0){+;}
}
}
// If D_CLK pulse was found continue to decode the incoming data
if(flag2)
{
// Loop until all three bytes have been read in
for(j = 0; j < 3; j++)
{
// Loop until eight bits of each byte have been read in.
for(i = 8; i > 0; i--)
{
flag1 = 0; // Clear the flag
timeOut = 0;// Clear timeout count
// Look for D_CLK to begin pulse.
while(!flag1 && timeOut < timeOutVal)
{
// Check D_CLK. Exit when low
if(PINB.2 == 0)
{
flag1 = 1;
//PORTD = 0x00;//For debug
}
// Increment timeout
else if(PINB.2 ==1){+;}
}
flag2 = 0;// Clear the flag
timeOut = 0;// Clear timeout count
// Look for D_CLK to end pulse.
if(flag1)
{
while(!flag2 && timeOut < timeOutVal)