Tony Papadimitriou

Variable graph 'glitch'

Discussion created by Tony Papadimitriou on Feb 10, 2020
Latest reply on Feb 19, 2020 by Michal Hanak

I'm using FreeMaster v3.0.1.3 [Jan 20 2020 14:46:31].

 

In graphing a variable (specifically the number of msec remaining for a second), I noticed some glitch which shouldn't be there.  My code simply decrements this 2-byte variable by 1 in one place in the whole app with the following (9S08) instruction sequence:

 

LDHX clock_msec_remain

AIX #-1

STHX clock_msec_remain

 

and reloads it when it becomes zero, again with STHX.

 

So the writes are guaranteed to be atomic.  But, looking at the graph, I see those small spikes (3rd and last slopes) which do not make sense.  They appear randomly, not in fixed distances.

 

I have checked my code and cannot find any issue with it.  Plus, the date/time clock (which depends on this variable) does not seem to go either too fast or too slow over a long period (many days).

 

So, before I assume this is a bug in my code somewhere, I have to check with you in case it's an issue with FreeMaster.

 

So, is it possible that FreeMaster somehow messes it up?

 

For example, could it be it does not read the 2-byte value atomically with respect to the CPU writes?  (Perhaps a limitation of BDM, I don't know.)

 

The graph below is set to the fastest possible reads/updates.  (I have tried with slower ones, with no difference.)

 

Apparent 2-byte variable graph glitch

 

P.S. I forgot to mention I use P&E Micro's Cyclone PRO with Ethernet connection.

Outcomes