我是 ARM 实验的新手,我对这个处理器中的数据概念有疑问。我遇到了麻烦。有代码检查定时器间隔:
// get the current timer 0 count
unsigned long Timer0_GetTimestamp(void)
{
return T0TC;
}
// check to see if a timestamp is in the past
// returns 1 if in the past, 0 if not
int Timer0_TimestampExpiredCk(unsigned long timestamp)
{
unsigned long now = T0TC;
if (now > timestamp)
{
if ((now - timestamp) < 0x80000000)
return 1;
else
return 0;
}
else
{
if ((timestamp - now) >= 0x80000000)
return 1;
else
return 0;
}
}
// pause for a specific number of milliseconds
void Timer0_Delay(unsigned long milliseconds) {
unsigned long timestamp = Timer0_GetTimestamp() + milliseconds;
while (!Timer0_TimestampExpiredCk(timestamp));
}
我对数字“0x80000000”有疑问。我们应该将此数字视为 2 的补码还是二进制?假设,当两个变量之间的差异为零时,我们改变我们的标志。如果我错了,请纠正我。
谢谢