Code: Select all
unsigned int Cnt1 = 0; // 16 bits (kind of system clock)unsigned int Cnt2 = 0; // 16 bits (observer)signed char Timer_Secs = 0; // 8 bits with signsigned char FutureTimeout_1Minute = 60; // 8 bits with signwhile (Cnt1 < 602) { // ## if ((Timer_Secs - FutureTimeout_1Minute) == 0) { FutureTimeout_1Minute += 60; // Overflow/underflow allowed, // so wraps and changes sign Cnt2++; } else {} // No code Timer_Secs++; Cnt1++;} // ## // Cnt2 is 35 if > 0 above #define AFTER_F(a,b) ((a-b)>0)// Cnt2 is 35 if >= 0 above #define AFTER_EQ_F(a,b) ((a-b)>=0)// Cnt2 is 10 if == 0 above #define AFTER_ON_F(a,b) ((a-b)==0) // 10 is expected
Is the XMOS GCC-based?
It works as expected in Go, see my blog note or http://play.golang.org/p/lH2SzZQEHG