Integer math the easy way?
Perhaps this is well-known to many Visual Basic programmers, but today I learned about a quirky way of using the division symbol. Specifically, if you need to perform integer math in a ROCLINK 800 custom user display expression, this might be handy. See below…
Notice how I used the forward slash to perform floating-point division. Next, look how using the back slash changes the result…
If I hadn’t pointed this out, would you have noticed?
The downside I see right away to using this method is during debugging. Your peers might gloss over your cleverness and suspect the bug is elsewhere (or, if you’re like me … the next day I would probably have forgotten). Therefore, I suggest liberal use of code comments.
Categories: Expression Editor, Tips
Hello, I’m trying to build a user display. I want to utilize a single button that will write two individual values to two individual byte registers at the same time the button is pressed. Does anyone know a expression that will perform this action? Thanks in advance!