Write number in Group Output in ieee-754 format ?
I need to write some parameter in a Group Output of 32 bits in the ieee-754 format. Example to write the value 15 i need to write the num 1097859072.
Any help will be appreciated.
Thanks
0
Comments
-
Hi,
you can use the instructions PackRawbyte and UnpackRawbyte to convert your value into ieee-754 format or use use the attached function.
Example:
Tpwrite "15 = "\Dnum:=FloatToUInt32(15);FUNC dnum FloatToUInt32(num Value)
VAR rawbytes raw_data;
VAR dnum dnResult;
PackRawBytes Value,raw_data,1\Float4;
UnpackRawBytes raw_data,1,dnResult\IntX:=UDINT;
RETURN dnResult;
endfunc
Regards
Micky
1
Categories
- All Categories
- 5.6K RobotStudio
- 399 UpFeed
- 20 Tutorials
- 14 RobotApps
- 301 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 336 IRC5
- 67 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 830 RAPID Programming
- 13 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 107 Collaborative Robots
- 5 Job listings