SIEMENS AG
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:
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();
:
Toolbox for Data Link PGs/PCs to SIMATIC S7
DBW 0 and DBW 2 = floating point 1,234*10
DBW 0 = 374F hex, DBW 2 = 07E5 hex in DB 1.
54
PRODAVE S7
-5
or