Operation
The IAR visualSTATE project models an elevator with four floors (1-4). The elevator reacts to IAR visualSTATE events generated by pushing buttons on the board, and the elevator signals its current state via
LEDs
that are activated by IAR visualSTATE action function calls.
The elevator reacts to the following events:
E_requested_floor
:
- This event is generated each time the user of the elevator presses button BP1 for requesting a new floor. To request floor 1, the user must press button BP1 once. To request floor 2, the user must press button BP1 twice, etc. If the user presses button BP1 more than four times, the number of the requested floor wraps. The user must make his request within approximately two seconds.
E_Timeout
:
- This event is generated by a timer that is started the first time the user generates event
E_requested_floor
. The timeout is approximately two seconds. When the timeout occurs and the event is generated, the elevator starts to move to the requested floor.
E_new_floor
:
- This event is generated each time the elevator reaches a new floor. As this model is not a real elevator, the event must be simulated by the user by pressing button BP4 for reaching a new floor.
The elevator uses LEDs to show its current state:
- LEDs DS3-DS4 are used for
two
purposes. When the user is not requesting a new floor, the LEDs show the current floor. When the user is requesting a new floor, the LEDs show the currently requested floor.
The LEDs indicates a floor in binary mode. Bit pattern 00 indicates floor 1, bit pattern 01 indicates floor 2, bit pattern 10 indicates floor 3 and bit pattern 11 indicates floor 4 (this rather complicated approach is due to the fact that the elevator was originally designed for boards with 7 LEDs or more).
These LEDs are operated by the action function
A_Show_Floor
.
- LEDs
DS1 and DS2 are
used to show whether the elevator is moving.
LED DS1 is on
when the elevator is moving down.
LED DS2 is on
when the elevator is moving up. These LEDs are operated by the action functions
A_drive_down
, A_drive_stop
and A_drive_up
.
To move the elevator to a specific floor, press button BP1 until LEDs DS3-DS4 indicate the requested floor. Now wait for the timeout to occur. When the timeout occurs (and if the requested floor is different from the current floor), either LED DS1 or DS2 will
turn on,
indicating that the elevator is now moving. The user must simulate the event that the elevator reaches a new floor by pressing button BP4 repeatedly until LEDs DS3-DS4 indicate the requested floor, and
LED DS1 and DS2 are turned off
indicating that the elevator is no longer moving.