First a great thanks to all members of this forum. Your posts helped a lot, especially doing my first steps with the RM48.
Currently i'm working with the TMDSRM48USB. I played around with some features of the kit, when i got stuck with a very strange behavior of this cheap looking piece of code:
_Bool delayRTI(uint16 ms)
{
volatile uint16 tmp_ms = ms;
rtiInit();
rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
_enable_IRQ();
rtiStartCounter(rtiCOUNTER_BLOCK0);
rtiCounter2 = 0;
while(1)
{
if(rtiCounter2 == ms) // will never be true
{
break;
}
else
{
ledIndicator(1);
}
}
rtiStopCounter(rtiCOUNTER_BLOCK0);
rtiDisableNotification((rtiNOTIFICATION_COMPARE0));
//_disableIRQ();
//printf("RTI DONE\n");
return true;
}
The problem is the break condition, where ms and the rtiCounter are compared. The rtiCounter (extern - global) is incremented in the IRS of rtiNotification(uint32 notification). But the condition is never true and the loop is never terminating. But when i use...
rtiCounter == 2 (or any other numeric value)
...it works as expected.
I have checked the variables with the debugger and the values of the parameters are returned properly.
This is driving me nuts....
Thanks
Jan