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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

General Purpose Functions<br />

6.38 Initialise the Base Associated with the %Y Variables y_init<br />

Syntax<br />

y_init(&y_start_address)<br />

y_start_address: Address loaded in the base associated with the %Y variables.<br />

Loads the base associated with the %Y variables with the address passed as parameter.<br />

Operation<br />

The %Y variables can replace any %M, %V, %I, %Q, %R and %W global variables. The programmer must initialise<br />

the base by <strong>function</strong> y_init(..) before using the %Y variables.<br />

The use of <strong>function</strong> y_init(..) inhibits visibility of any local variables of the %SP module. To recover visibility, proceed<br />

as follows:<br />

Var_1 = %Y0.& Saves the base in Var_1 (e.g.: %V100.L).<br />

y_init(Var_2 + 100) The base points to a new variable area.<br />

...... Use of new %Y variables.<br />

y_init(Var_1) Restore the base.<br />

...... Use of local %Y variables.<br />

REMARK Loading of a base associated with the %Y variables by <strong>function</strong> y_init is only possible<br />

during execution of the task (%TS, %TF, %TH or %INI) using the variables.<br />

Example:<br />

- If the %Y variables are used in task %TS0, <strong>function</strong> y_init must be called each time<br />

task %TS0 is executed<br />

- If the %Y variables are used in a looped TF background task (iterative background<br />

task), <strong>function</strong> y_init only needs to be called once at the beginning of the task.<br />

Example of Use of y_init(..) and %Y<br />

Processing of 8 axis groups with a single %SP0 using %Y variables<br />

y_init(%R100.&) %Y0.B replaces %R100.B %Y80.B replaces %W100.B<br />

sp(0) Processing of axis group 1<br />

y_init(%R200.&) %Y0.B replaces %R200.B %Y80.B replaces %W200.B<br />

sp(0) Processing of axis group 2<br />

y_init(%R800.&) %Y0.B replaces %R800.B %Y80.B replaces %W800.B<br />

sp(0) Processing of axis group 8<br />

en-938846/7 6 - 33<br />

6

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

Saved successfully!

Ooh no, something went wrong!