15.07.2013 Views

Automatic control function programming manual ladder language

Automatic control function programming manual ladder language

Automatic control function programming manual ladder language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

16.4 Programming in C<br />

16.4.1 Concept of Module<br />

Programming in C Language<br />

A module is a separate executable entity. All the objects defined in a module (data or <strong>function</strong>s) are internal and can<br />

be made available to external entities (C modules, <strong>ladder</strong> modules or monitor).<br />

To be valid, a module must have a single «main()» <strong>function</strong>.<br />

A module is the result of compiling and link editing of one or more source files in C. It is visible and accessible under<br />

PLCTOOL as a «*.XCX» type file.<br />

An application can include one or more C modules. It is strongly recommended to split large applications into several<br />

modules.<br />

16.4.2 Interface between C Modules<br />

Applications written in C can be very large (several hundred Kbytes).<br />

After editing the application, it is necessary to compile, link edit and load the entire module. The time required for these<br />

operations can rapidly become very long.<br />

To optimise the processing times, it is necessary to split large modules into several independent smaller modules that<br />

can exchange all types of data (<strong>function</strong>s, tables, structures, variables).<br />

In this way, a module works on pointers to the objects to be transferred and the pointers are initialised when the links<br />

are edited.<br />

Below we use the following terms:<br />

- «imported object» to denote the objects used in a module and defined in another,<br />

- «exported object» to denote objects defined in a module and made available to other modules.<br />

An object can be any type of global data:<br />

- Structure,<br />

- Function,<br />

- Global variable,<br />

- Array,<br />

- etc.<br />

Two <strong>function</strong>s, IMPORT() and EXPORT(), are available for processing imported and exported objects.<br />

en-938846/7 16 - 5<br />

16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!