EasyManuals Logo

Siemens SIMATIC S7 Operating Instructions

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
Page #33 background imageLoading...
Page #33 background image
SIEMENS AG PRODAVE S7
Toolbox for Data Link PGs/PCs to SIMATIC S7
29
db_write
The function db_write writes an amount of data words from a variable field of
the PG/PC into the PLC.
If the data block does not exist this is indicated by a return value = error
number.
If the data which is being written, exceeds the amount available in the data
block, the " amount” is corrected and error message 303 hex is returned.
Important!
The data words must be stored in "buffer" in accordance with STEP5-Notation
(high byte - low byte).
If there were no errors, the function supplies 0 as the return value otherwise an
error message which can be evaluated in accordance with the error table (see
error_message).
See also db_read
C-Adapter (mini)
int db_write
(int dbno,int dwno, int* amount, void* buffer);
Example:
DB10 consisting of 20 data words (DW 0 - DW 19) exists in the PLC.
Value 2468 hex is assigned to DW 1 and DW 2.
C-Adapter
#include <w95_s7.h>
int buffer[100];
int error,dbno,dwno,amount;
:
dbno = 10;
dwno = 1;
amount = 2;
buffer[0] = 0x6824;
buffer[1] = 0x6824;
error = db_write(dbno,dwno,&amount,buffer);
:
error = unload_tool();
:

Table of Contents

Other manuals for Siemens SIMATIC S7

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Siemens SIMATIC S7 and is the answer not in the manual?

Siemens SIMATIC S7 Specifications

General IconGeneral
BrandSiemens
ModelSIMATIC S7
CategoryController
LanguageEnglish

Related product manuals