EasyManua.ls Logo

Siemens SIMATIC S7 - As200_Z_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
47
as200_z_field_read
The function as200_z _field_read reads "amount" of counter values from the
data area of the PLC starting from "no" and stores the read values in a variable
field of the PG/PC.
Attention!
3 bytes are received per counter 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_z_field_read (int no,int amount,void*buffer);
Example:
Counter values 3 and 4 are read and saved in ”Z3” and ”Z4”.
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 Z3,Z4;
:
error = load_tool(1,”S7ONLINE”,plc_adr_table);
:
error = as200_z_field_read(3,2,buffer);
Z3 = (unsigned short)buffer[2] |
(unsigned short)buffer[1] << 8;
Z4 = (unsigned short)buffer[5] |
(unsigned short)buffer[4] << 8;
:
error = unload_tool();
:

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals