EasyManua.ls Logo

Siemens SIMATIC S7 - Gp_To_Float

Siemens SIMATIC S7
82 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SIEMENS AG PRODAVE S7
Toolbox for Data Link PGs/PCs to SIMATIC S7
54
gp_to_float
The function gp_to_float converts an S7 floating point value to a value of the
float type (IEEE-Format).
See also float_to_gp
C-Adapter
void gp_to_float(void * gp, void * ieee);
Example:
Assumption: DBW 0 and DBW 2 = floating point 1,234*10
-5
or
DBW 0 = 374F hex, DBW 2 = 07E5 hex in DB 1.
This program reads 2 data words (DBW 0 and DBW 2), converts the S7 floating
point format to IEEE format and makes the value available for processing in the
variable "ieee".
C-Adapter
#include <komfort.h>
#include <w95_s7.h>
int error;
int buffer[100]
int dbno,dwno,amount;
float ieee;
:
dbno = 10;
dwno = 0;
amount = 2;
error = db_read(dbno,dwno,&amount,buffer);
gp_to_float(buffer,&ieee);
:
error = unload_tool();
:

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals