How to mask a num value?
Hi,
I have a number of 104 (example, changes depeding on what the number I get from the PLC is). I would like to read the two last digits of 104 (04) and read that into a new num, is this possible in RAPID? Shearched but can't find anything regarding that.
Best regards,
Alexander K
AlexK2008-8-6 10:56:13Alexander Källberg
Comments
-
Hi Alexander,
Try this:
m = your original integer
n = the two last digits
n = m - Trunc(m / 100) * 100
Example:
m = 1234
m / 100 = 1234 / 100 = 12.34
Trunc(m / 100) = Trunc(12.34) = 12
Trunc(m / 100) * 100 = 12 * 100 = 1200
n = m - Trunc(m / 100) * 100 = 1234 - 1200 = 34
Disclaimer: This algorithm was not tested in RAPID and needs to be validated before put into production.
Henrik Berlin2008-8-6 16:49:40Henrik Berlin
ABB0 -
Or something like this
Per Svensson
Robotics and Vision Specialist
Consat Engineering0 -
Thank you very much, need to put me into the above examples, I'm not a math genius, but I don't think it will be a problem, else I will bother the two of you again
Best regards,
Alexander K
Best regards
Alexander Källberg0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings