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.

Organisation of the %Y Variables Available in the %SP Modules Called:<br />

%Y0.L Contains the first argument if any; else don’t care.<br />

%Y4.L Contains the second argument if any; else don’t care.<br />

%Y14.L Contains the last argument if any; else don’t care.<br />

%Y18.B Rest of the local variables.<br />

%Y7F.B Last local variable.<br />

Code Returned<br />

If OK<br />

Value returned by the %SP module called using <strong>function</strong> return().<br />

Not significant if the called module does not return a value.<br />

Example of Use of spy(..) and return(..)<br />

Exchange of arguments during a call to an %SP module<br />

Calling module (%TS, %TF or %SP):<br />

%M100.W = spy(33, 10, %M20.B + %M30.B); Creation of 128 %Y local variables in the stack.<br />

Arguments 10 and (%M20.B + %M30.B) are extended to 32 bits<br />

and stored in the stack. The call to %SP33 is the made.<br />

Module called %SP33 %Y0.L contains 10<br />

%Y4.L contains the result of the expression (%M20.B + %M30.B).<br />

return(%Y10.W + 25) Return to the calling module. The local variables are deleted<br />

and the result of the expression (%Y10.W + 25) is loaded in<br />

%M100.W.<br />

6.27 Format a Character String sprintf<br />

Syntax<br />

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

sprintf(&dest, &format {,&argn}5)<br />

&dest: Destination string address.<br />

&format: Format string address.<br />

&argn: Possible argument.<br />

Formats the string at address &format and copies it at address &dest. A ZERO byte is added at the end of &dest.<br />

Function sprintf() supports the ANSI standard C <strong>language</strong> conversion specifications.<br />

Operation<br />

Function sprintf() is equivalent to printf() except that the formatted string is copied starting at address &dest instead<br />

of being displayed.<br />

For specification of the conversion formats, see <strong>function</strong> printf().

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

Saved successfully!

Ooh no, something went wrong!