Allocated flags, Reading/writing of allocated flags via ads – BECKHOFF BC3150 User Manual

Page 58

Advertising
background image

Safety Instructions

56

Fieldbus Components

Allocated Flags

4 kB of allocated flags are available. They can be used to assign different variable types to the same address, e.g. for
converting strings to bytes. Data can also be placed here that can be read or written via ADS by the controller.

Note

The BX Controllers do not save the allocated variables as remanent data.

Reading/writing of allocated flags via ADS

The flags may also be read via the controller and ADS. In PROFIBUS, the DPV-1 services are used for this purpose,
in CANopen SDO communication is used.
The AmsNetId can be taken from the System Manager, or it can be displayed in the BX menu.
The PLC port number is 800.

Index group

Meaning

Index offset (value range)

0x4020

Flag (only BXxxx0)

0..4096

Example
BX program

VAR
Flag_01 AT %MB0: WORD;
END_VAR

TwinCAT PC/CX Master Programm

VAR
fbADRSREAD: ADSREAD;
Flag_M: WORD;
END_VAR

fbADRSREAD(
NETID:='172.16.3.0.2.3' , (* AMSNetId BX *)
PORT:=800 , (* 800 - PLC *)
IDXGRP:=16#4020 , (* 0x4020hex flags *)
IDXOFFS:=0 , (* byte offset *)
LEN:=2 , (* Lenght byte *)
DESTADDR:=ADR(Merker) ,
READ:=TRUE ,
TMOUT:=t#1s );
IF NOT fbADRSREAD.BUSY THEN
fbADRSREAD(READ:=FALSE);
END_IF

Advertising