Jump to content
OMRON Forums

Rollover behavior in User Data


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


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

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



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.







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 the Sys.Udata[0] points to the same region of Sys.Cdata[3], in fw Sys.Udata[0] points to the same location of Sys.Cdata[0].




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.

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...