Jump to content
OMRON Forums

Rollover behavior in User Data


DaveBarnett

Recommended Posts

It would be useful to be able to use 2’s complement math in Script.

But, I noticed the following oddity:

Sys.Udata[0]++      // doesn’t rollover… it saturates instead

but,

Sys.Idata[0]++      // does rollover
and
Sys.CData[0]++        //does rollover

 To wrap my head around this… I created the following watch window:

image.png.52786a5d776ffe2d2746f7166b0a86df.png

 

I would have expected the unsigned data to be the one that rolls over.  'Curious.

Can we rely on this rollover behavior not to change in future firmware ??   I haven't tried it yet..but I wonder if this behaviour is the same when using C routines instead of script.

If you want to try out for yourself, I’ve attached the watch window XML file.

-Dave

 

 

 

 

UdataRollover.wtb

Edited by DaveBarnett
  • Like 1
Link to comment
Share on other sites

Not much related, but it might be interesting to add for discussion.
Recently I have faced some differences on Sys.Cdata[i] structure between different firmware versions.
I can't say if the difference is due to firmware version, or is something more intrinsic to the cpu (since the PowerPC endianess diverge from the ARM).

While in fw 2.5.0.4 the Sys.Udata[0] points to the same region of Sys.Cdata[3], in fw 2.7.1.0 Sys.Udata[0] points to the same location of Sys.Cdata[0].

image.png.be6db6d9640c37005d35937e08603e50.png

image.png.5961dd1a647b7cca0d102c94cd4567ff.png

 

About the roll over, I have tested and both of the versions presented the same behaviour that Dave described.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...