NET.LOGIX v2.0.2010.311 and later supports retrieving the state of a ControlLogix / CompactLogix CPU. This is achieved by assigning the Tag.Name property the string constant "$CPU_STATE".
Syntax
Tag.Name = "$CPU_STATE"
Returns
When successful, Tag.Value will return a 3 element System.Int32[] array containing the current state of the ControLogix / CompactLogix CPU. Otherwise Tag.Value is null (Nothing in VB)
|
Tag.Value |
|
|
Value[0] |
OK LED State |
|
|
0 = Solid Red (Power Up) |
|
|
1 = Flashing Red (Firmware Update) |
|
|
2 = Flashing Red (Communication Fault) |
|
|
3 = Flashing Green (Awaiting Connection) |
|
|
4 = Flashing Red (Configuration Bad) |
|
|
5 = Flashing/Solid Red (Major Fault) |
|
|
6 = Solid Green (Connected) |
|
|
7 = Flashing Green (Program Mode) |
|
Value[1] |
Minor/Major Fault |
|
|
0 = No Fault |
|
|
1 = Minor Recoverable Fault (OK LED State not affected) |
|
|
2 = Minor Unrecoverable Fault (OK LED State not affected) |
|
|
3 = Major Recoverable Fault (OK LED State Flashing Red) |
|
|
4 = Major Unrecoverable Fault (OK LED State Solid Red) |
|
Value[2] |
Key Switch Position |
|
|
1 = Run Mode (RUN) |
|
|
2 = Program Mode (PROG) |
|
|
3 = Remote (REM) |
Remarks
The name "$CPU_STATE" is not case sensitive.
"$CPU_STATE" is READ_ONLY tag. Invoking Controller.WriteTag or Controller.GroupWrite will result in an Exception.
|
VB.NET Example stateCPU = cpuState.Value Console.WriteLine ("LED STATE = " + stateCPU.Value(0).ToString()) Console.WriteLine ("FAULT STATE = " + stateCPU.Value(1).ToString()) Console.WriteLine ("KEY SWITCH = " + stateCPU.Value(2).ToString()) End If
C# Example { stateCPU = cpuState.Value; Console.WriteLine ("LED STATE = " + stateCPU.GetValue(0).ToString()); Console.WriteLine ("FAULT STATE = " + stateCPU.GetValue(1).ToString()); Console.WriteLine ("KEY SWITCH = " + stateCPU.GetValue(2).ToString()); }
|