Page 1 of 1

[Request] XS40_MoellerFB.lib - conversion IEE754 real

Posted: Tue Feb 19, 2013 5:44 pm
by inwestor
Hello,
can someone provide the
Standard S40 function blocks: XS40_MoellerFB.lib for codesys2

I need conversion from 4Byte Float to Codesys REAL and try to have a look inside function:

IEEE_To_Real number conversion: IEEE-754 standard format to data type REAL
Real_To_IEEE number conversion: data type REAL to IEEE-754 standard format

thx
inwestor

Re: [Request] XS40_MoellerFB.lib - conversion IEE754 real

Posted: Wed Mar 27, 2013 10:19 am
by motigross
Hi,
create your own function:
******
FUNCTION IEEE754_To_Real : REAL
VAR_INPUT
Word0:WORD; (* Low Word bit 0-->15*)
Word1:WORD; (* High Word bit 16-->31*)
END_VAR
VAR
dword1:DWORD;
pR: POINTER TO REAL;
END_VAR
******
dword1:=Word1*16#10000+Word0;
pR:=ADR(dword1);
IEEE754_To_Real:=pR^;
******

Moti.