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.17 Search for the Value of a Word rchw<br />

Syntax<br />

rchw(&source, w, step, n)<br />

&source: Search start address.<br />

w: Value of the word to be searched for.<br />

step: Value of the search step in bytes.<br />

n: Maximum number of search steps.<br />

Search, with a step, for the first occurrence of word w starting from address &source.<br />

The step can be positive or negative.<br />

Positive step: The search is made by increasing addresses.<br />

Negative step: The search is made by decreasing addresses.<br />

Return code<br />

Value found<br />

Positive number equal to the number of steps made to the first occurrence.<br />

Positive step: Return code = (occurrence address - &source)/step<br />

Negative step: Return code = (&source - occurrence address)/(-step)<br />

Value not found<br />

-1: Value not found<br />

Programming error causing a CPU fault<br />

Access to a prohibited address:<br />

- &source parameter error,<br />

- &source+step*n outside authorised area.<br />

6.18 Search for the Value of a Long Word rchl<br />

Syntax<br />

rchl(&source, l, step, n)<br />

&source: Search start address.<br />

l: Value of the long word to be searched for.<br />

step: Value of the search step in bytes.<br />

n: Maximum number of search steps.<br />

Search, with a step, for the first occurrence of long word l starting from address &source.<br />

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

6

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

Saved successfully!

Ooh no, something went wrong!