EasyManua.ls Logo

Siemens SIMATIC S7 - As200_T_Field_Read

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
46
as200_t_field_read
The functions as200_t_field_read read “amount” of bytes from the data area of
the PLC starting from "no" and store the read values in a variable field of the
PG/PC.
Attention!
5 bytes are received per timer value, and only 2 bytes contain the requested
value (see example)
If there were no errors, the function supplies a 0 as the return value, otherwise
an error number which can be evaluated in accordance with the error table (see
error_message).
C-Adapter
int as200_t_field_read (int no,int amount,void*buffer);
Example:
Timer values 0 and 1 are read and saved in ”T0” and ”T1”.
C-Adapter
#include <w95_s7.h>
int error;
adr_table_type plc_adr_table[2] = { {2,0,2,0},{0,0,2,0} };
unsigned char buffer[10];
unsigned short T0,T1;
:
error = load_tool(1,”S7ONLINE”,plc_adr_table);
:
error = as200_t_field_read(0,2,buffer);
T0 = (unsigned short)buffer[4] |
(unsigned short)buffer[3] << 8;
T1 = (unsigned short)buffer[9] |
(unsigned short)buffer[8] << 8;
:
error = unload_tool();
:

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals