Dć17 – Rockwell Automation 1775-KA PLC-3 Communication Adapter Module User Manual User Manual

Page 227

Advertising
background image

Detailed Flowcharts

Appendix D

DĆ17

Figure D.20

SLEEP and WAKEUP Interaction

PROCESS A

PROCESS B

PROCESS C

SLEEP

A Previous
Wakeup

Later

WAKEUP

2

1

7

8

3

4

6

5

NOTE: Sequence of processor
execution is indicated by circled
numbers.

10090–I

The SLEEP and WAKEUP subroutines are always used in connection
with some type of indivisible process interlock. Indivisibility is achieved
on many processors (as on the Z80) by disabling processor interrupts. For
this reason, SLEEP and WAKEUP assume that interrupts are off when
they are called. They will always return with interrupts off.

When one process calls SLEEP, the results is a return from a call to
WAKEUP by another process. When a process calls WAKEUP, the result
is a return from a call to SLEEP by another process. An interrupt
subroutine that calls WAKEUP is viewed as a subroutine of the
interrupted process.

Figure D.20 shows an example of interaction between SLEEP and
WAKEUP. In this example, process B work up process A some time ago.
Now at 1, when A goes to sleep, actual execution resumes after the
wakeup call in B at 3 and 4. Some time later, process C (at an interrupt,
for example) calls WAKEUP at 5. Execution flow proceeds to the
instructions at 8 following the call to sleep in process A. The next time A
calls SLEEP, the WAKEUP call in C will terminate.

This is not the only possible implementation of SLEEP and WAKEUP. A
second alternative implementation would allow a process to call

SLEEP and WAKEUP

Advertising