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.

6.2 Convert an ASCII String to a Signed Integer of 32 Bits atoj<br />

Syntax<br />

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

atoj(&&end, &source)<br />

&&end: Address of the long word (%M or %V) to be loaded with the address<br />

of the character on which conversion was stopped.<br />

&source: Address of the ASCII string to be converted.<br />

Returns a signed integer on 32 bits resulting from conversion of the ASCII string.<br />

Operation<br />

Conversion is stopped when a ZERO byte or a character other than a decimal digit is detected.<br />

This <strong>function</strong> operates in the same way as atoi(). Function atoj() loads address &&end with the address of the character<br />

on which conversion was stopped or zero if the end of the string was reached.<br />

In case of overflow, atoj() returns the maximum positive value of a signed integer on 32 bits, i.e. 0x7FFFFFFF.<br />

The long word at address &&end is loaded with:<br />

- 0 if conversion was stopped on a ZERO byte at the end of the string,<br />

- the address of the (nonzero) character on which conversion was stopped,<br />

- -1 in case of overflow.<br />

Return code<br />

If OK<br />

Signed integer on 32 bits resulting from the conversion<br />

Error<br />

0x7FFFFFFF: Overflow of conversion of a signed integer on 32 bits.<br />

Programming error causing a CPU fault<br />

Access to a prohibited address:<br />

- &source parameter error,<br />

- &&end parameter error,<br />

- end of string outside authorised area.

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

Saved successfully!

Ooh no, something went wrong!