Semaphore application example continued:
FB 1
:A
F 10.0
:JC
=M001
:
:AN
I
0.0
:BEC
:
:L
KH 2222
:T
FW 12
:AN
F 10.0
:S
F 10.0
:
M001 :JU
FB10
NAME :REPORT
:
:BE
FB 10
NAME :REPORT
:AN
F 10.1
:JC
FB 100
NAME :SEMADIS
:
:A
F 10.1
:AN
F 10.2
:S
F 10.2
:L
KT010.2
:SE
T 10
:
:A
F 10.2
:AN
F 10.3
:JC
FB 110
NAME :MSGOUT
:
:A
F 10.2
:AN
F 10.4
:AN
T 10
:JC
FB 101
NAME :SEMAENAB
:
:AN
F
10.4
:BEC
:
:L
KH0000
:T
FY10
:BE
CPU 948 Programming Guide
C79000-G8576-C848-04
If no message is active,
generate message and
set "MESSAGE" flag.
Call "REPORT" FB
If no semaphore is disabled,
call "disable semaphore" FB.
If the semaphore is disabled
and the timer has not started,
start the timer.
If the timer has started
and no message is being transmitted,
call "output message" FB.
If the timer has started
and the semaphore is not enabled
and the timer has elapsed,
call "enable semaphore" FB.
If the semaphore is enabled,
reset all flags.
Semaphore Operations
Continued on next page
3 - 79