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

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