|
CT60 and related things BBS
Re: CT60 weirdness |
Posted by: sqward
|
May,09.2014-17:53
|
Thomas: I don't understand how you make your measurement. It seems to me that you have some sort of a loop in which you increase a variable? If so, this is not the best way to time things, because it will be dependent on your CPU speed.
I use the following routine to get time stamp accurate to about 20 microseconds. You can call it before and after the code you want to time and do the math.
uint64_t getMicroseconds( )
{
resync:
uint64_t timer200hz = *((volatile uint32_t*)0x4BA) ;
uint32_t data = *((volatile uint8_t*)0xFFFFFA23);
if ( *((volatile uint32_t*)0x4BA) != timer200hz )
{
goto resync;
}
timer200hz*=5000; // convert to microseconds
timer200hz+=(uint64_t)(((192-data)*6666)>>8); //26; // convert data to microseconds
return timer200hz;
}
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|