Changing States based on ON/OFF Change in Multiple Bits

Use a single lamp to display in different colors the ON/OFF states of four different BOOL variables.

Example Operation

Setting Workflow

  1. Add Variables
  2. Set up Parts

Add Variables

Project Explorer : [Variables] ➞ [All Variables]

Add the below variable(s).

Variables property:

[Name] [Data Type]

Var1

[BOOL]

Var2

[BOOL]

Var3

[BOOL]

Var4

[BOOL]

Set up Parts

Project Explorer : [Screen Design] ➞ [Screens] ➞ [Screen1]

Drag and drop the following objects from the [Tool Chest] to the screen.

N-State Lamp object (Name: N_StateLamp1) properties:

Tab Sub Tab Property Value
[Function] [Basic] [Type] [Bit]
[State Change Condition] [Bit]
[Number of States] 5
[Variables] [Variable] [Variable] [Name]: Var1
[Variable] [Variable] [Name]: Var2
[Variable] [Variable] [Name]: Var3
[Variable] [Variable] [Name]: Var4
[Bit Position] [Low Bit]
[Shape] [Text] [States] [State 0] [Text] State 0
[State 1] [Text] State 1
[State 2] [Text] State 2
[State 3] [Text] State 3
[State 4] [Text] State 4
[Basic] [States] [State 0] to [State 4] [Fill] [Type] [Solid]
[Value] [ID] ID:(Any)