09.12.2012 Views

Basic Characteristics RAPID

Basic Characteristics RAPID

Basic Characteristics RAPID

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.

Multitasking <strong>Basic</strong> <strong>Characteristics</strong> <strong>RAPID</strong><br />

doing, for example.<br />

Synchronising using polling<br />

This is the easiest way to do it, but the performance will be the slowest.<br />

Persistents are then used together with the instructions WaitUntil, IF, WHILE or<br />

GOTO.<br />

If the instruction WaitUntil is used, it will poll internally every 100 ms. Do not poll<br />

more frequently in other implementations.<br />

Example<br />

TASK 0<br />

MODULE module1<br />

PERS BOOL startsync:=FALSE;<br />

PROC main()<br />

startsync:= TRUE;<br />

.<br />

ENDPROC<br />

ENDMODULE<br />

TASK 1<br />

MODULE module2<br />

PERS BOOL startsync:=FALSE;<br />

PROC main()<br />

WaitUntil startsync;<br />

.<br />

ENDPROC<br />

ENDMODULE<br />

Synchronising using an interrupt<br />

To use this method, a cross connection must be prepared between two I/O-signals; one<br />

output cross connected to one input. The instruction SetDO, ISignalDI or WaitDI is<br />

then used.<br />

Example<br />

In this example do1 is connected to di1.<br />

TASK 0<br />

5-40 <strong>RAPID</strong> Reference Manual

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

Saved successfully!

Ooh no, something went wrong!