plcforum.uz.ua

International PLC Forum
It is currently Fri Apr 28, 2017 1:30 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Feb 19, 2013 8:44 pm 

Joined: Thu Nov 02, 2006 1:43 pm
Posts: 32
Location: Europe
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


Top
 Profile  
 
PostPosted: Wed Mar 27, 2013 1:19 pm 

Joined: Wed Mar 27, 2013 12:56 pm
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by International PLCforum® Forum Software © PLCforum
Mobile version