[Request] XS40_MoellerFB.lib - conversion IEE754 real

inwestor
Posts: 34
Joined: Thu Nov 02, 2006 10:43 am
Location: Europe

[Request] XS40_MoellerFB.lib - conversion IEE754 real

Post 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
motigross
Posts: 1
Joined: Wed Mar 27, 2013 9:56 am

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

Post 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.