>from the help line
It does wrap around, but it is NOT a problem as we are using signed integers.
You can verify this with a simple program (run on the PC emulator)
print hex($90000000 - $70000000)
print hex($10000000 - $f0000000)
***DEMO MODE*** loading PC...
ARMbasic[7.41] on the PC Copyright 2008, Coridium Corp.
... Finished in 0 ms
So you can do
start = TIMER
while TIMER-start < 100
will wait 100 microseconds even through both wrap arounds
>Does TIMER overflow and wrap
> I use a similar function in my HC11 code - reads a 16 bit
> counter -
> prescaled from the CPU clock. It counts from 0 to 2^16-1,
> then wraps back to
> The problem:
> Say I want a 712 Tick delay (I do)
> I do a "start = TIMER" type assigment
> Later I check if TIMER - start > 712 and do
> However if TIMER was greater than (2^16-1) -
> 712 at the time of the
> "start" assignment the test will either never be true, and
> it'll hang (It
> did!!), or may be true immediately after the 'wrap around'
> depending on how
> the "-" and ">" operators are implemented.
> Would TIMER have a similar problem? I guess it would only
> happen every 4000+ secs with a 32 bit counter, but Murphy
Questions about the BASICtools and MakeItC
1 post • Page 1 of 1