Siemens Simantic Net NCM for Industrial Ethernet S7 User Manual

Page 159

Advertising
background image

Programming FCs (Functions) and FBs for S7 Ethernet CPs

159

SIMATIC NET NCM S7 for Industrial Ethernet
C79000-G8976-C129–06

Example of AG_SEND

Below you will find an executable example of an FC5 (AG_SEND) call and
parameter evaluation.

The OB100 listed below belongs to the FC100 selected here in which the send call
takes place; OB100 sets the ACT bit correctly when the CPU starts up.

To function correctly, a DB100 with a size of at least 240 bytes must be loaded.

The program requires a CP at address 256 and a configured connection of the
type ISO Transport / ISO-on-TCP or TCP with ID=1 (please adapt your
configuration where necessary !).

//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

FUNCTION FC 100: VOID

TITLE = SENDE_DEMO
AUTHOR : Tester

FAMILY : S7300

NAME : FC5_Demo

VERSION : 1.0

//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

BEGIN

CALL FC 5 (

ACT

:= M100.0,

ID

:= 1,

LADDR

:= W#16#100,

SEND

:= P#DB100.dbx0.0 BYTE 240,

LEN

:= 240,

DONE

:= M100.1,

ERROR := M100.2,
STATUS

:= MW102 );

//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

R M100.0;
SET;

A M100.1;

JC done;

SET;

A M100.2;

JC err;

//
//

//

//

//

//

//

Reset parameter ACT for all further FC5 calls;

Test whether DONE = TRUE

Test whether ERROR = TRUE

//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

BEU;

//
//

Neither DONE nor ERROR is set, the job is
still running.

//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

done

S M100.0;
BEU;

//
//

Job completed without error. Set ACT = TRUE so
that the following call can trigger the new

job.

//–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

Advertising