WAGO PLC

A

Thread Starter

Anonymous

Did anybody program USR LED of the WAGO controllers, e.g. 750-841? I don't know how to use visual.lib which is made to manage this LED.

Any suggestions are welcome.
 
<pre>PROGRAM PLC_PRG
VAR
FirstCycle : BOOL := TRUE;
Timer : TP;
ErrorCode : BYTE := 1;
Version : WORD;
Param : ARRAY [0..3] OF FLASHING_SEQUENCE; (* Array, that the flashing sequences describes *)
PointerToFS : POINTER TO FLASHING_SEQUENCE;
END_VAR
--------------------------------------------------
(* Example how to display an error code over the USR-LED with the Visual.lib *)

(* Initialization of the flashing sequences in the first cycle.
The entries can be modified at run-time. *)
IF FirstCycle = TRUE THEN

Version := VISUAL_VERSION(1);

(* fast flashing sequence to initiate an error code *)
Param[0].Colour := RED;
Param[0].Frequency := 10;
Param[0].Relation := 50;
Param[0].Duration := t#1s;
Param[0].NextIndex := 1;

(* display the error code *)
Param[1].Colour := ORANGE;
Param[1].Frequency := 1;
Param[1].Relation := 128;
Param[1].Duration := t#0s;
Param[1].NextIndex := 3;

(* Turn off LED if PLC is stopped *)
Param[2].Frequency := 0;
Param[2].Relation := 0;
Param[2].Duration := t#0s;

(* Turn on LED if PLC is started *)
Param[3].Colour := GREEN;
Param[3].Frequency := 0;
Param[3].Relation := 128;
Param[3].Duration := t#0s;

PointerToFS := ADR(Param); (* Get pointer to structure *)
SET_FLASHING_SEQUENCE(1, ADR(PointerToFS)); (* Give address of pointer to structure to Firmware *)

FirstCycle := FALSE;

END_IF

(* Turn on USR-LED if PLC is started *)
IF GET_RUN_VALUE(1) THEN
SET_FLASHING_SEQUENCE_INDEX(1, 1, 3);
START_FLASHING_SEQUENCE(1);
END_IF

(* Turn off USR-LED if PLC is stopped *)
IF GET_STOP_VALUE(1) THEN
SET_FLASHING_SEQUENCE_INDEX(1, 1, 2);
END_IF

(* Show an error code every 10 seconds *)
IF Timer.Q = 0 THEN

Param[1].Duration := WORD_TO_TIME(ErrorCode * 1000(*ms*) ); (* NULL => infinite flashing *)
SET_FLASHING_SEQUENCE_INDEX(1, 1, 0); (* Show the error code immediately *)

ErrorCode := ErrorCode + 1;

IF ErrorCode > 6 THEN
ErrorCode := 1;
END_IF

END_IF

Timer(IN := Timer.Q = 0, PT := T#10s);
</pre>
 
<p>I've had problems using the GET_RUN_VALUE and GET_STOP_VALUE functions. They never seem to work right and consequently don't turn the LED on/off to display run mode.

<p>If you're just looking to turn the LED ON/OFF to indicate run mode then you can create two POUs as PROGRAMS in ST and call them usrLED_On and usrLED_Off.
<pre>
(* Variable Declaration Section *)
PROGRAM usrLED_On
VAR
Sequence : ARRAY [0..1] OF FLASHING_SEQUENCE;
ptrFS : POINTER TO FLASHING_SEQUENCE;
END_VAR


(* Program Section *)
sequence[0].Colour := ORANGE;
sequence[0].Frequency := 0; (* Hertz*)
sequence[0].Relation := 128;
sequence[0].Duration := t#0ms;
sequence[0].NextIndex := 0;
ptrFS := ADR(Sequence);
SET_FLASHING_SEQUENCE(1, ADR(ptrFS));
START_FLASHING_SEQUENCE(1);


(* Variable Declaration Section *)
PROGRAM usrLED_Off
VAR
END_VAR

(* Program Section *)
STOP_FLASHING_SEQUENCE(1);

</pre>
<p>Then you can go to the RESOURCES Tab, Double-Click on "Task Configuration" in the left-hand pane. Select "System Events" in the Middle pane. Check "Start" and "Stop" in the "System Events" window. And enter usrLED_On in the "called POU" for "Start" and usrLED_Off in the "called POU" for "Stop".

<p>This will create a valid Run Mode light. It works even if someone switches the internal slider to the off position - the light will change from on to off.

<p>You can also use the usrLED_On program to setup multiple flashing sequences and then use an "Error" program to change which sequence index is running in order to display errors.

<p>Just some thoughts, I know it's been 6 months since the question was asked, but I just found this forum. :O)

<p>Also, I'm using Firmware Version: 01.11.01 (09) on my 750-841 Ethernet PFCs.

<p>Take Care,<br>
Larry
 
Thanks a lot for your topic, I was looking a very long time for this LED. (=plc in run).

Pierre
 
Thanks for posting this, Larry. Can't wait to try it on our 750-842 Ethernet controllers. (It's quite annoying that Wago didn't make it default to a "the PLC is running your code" light, like most other PLCs... <sigh>)

Hope you're still a happy Control.Com member.
Kind regards,
Roger V.

><p>I've had problems using the GET_RUN_VALUE and
>GET_STOP_VALUE functions. They never seem to work right and
>consequently don't turn the LED on/off to display run mode.
>
><p>If you're just looking to turn the LED ON/OFF to indicate
>run mode then you can create two POUs as PROGRAMS in ST and
>call them usrLED_On and usrLED_Off.
><pre>
>(* Variable Declaration Section *)
>PROGRAM usrLED_On
>VAR
> Sequence : ARRAY [0..1] OF FLASHING_SEQUENCE;
> ptrFS : POINTER TO FLASHING_SEQUENCE;
>END_VAR
>
>
>(* Program Section *)
>sequence[0].Colour := ORANGE;
>sequence[0].Frequency := 0; (* Hertz*)
>sequence[0].Relation := 128;
>sequence[0].Duration := t#0ms;
>sequence[0].NextIndex := 0;
>ptrFS := ADR(Sequence);
>SET_FLASHING_SEQUENCE(1, ADR(ptrFS));
>START_FLASHING_SEQUENCE(1);
>
>
>(* Variable Declaration Section *)
>PROGRAM usrLED_Off
>VAR
>END_VAR
>
>(* Program Section *)
>STOP_FLASHING_SEQUENCE(1);
>
></pre>
><p>Then you can go to the RESOURCES Tab, Double-Click on
>"Task Configuration" in the left-hand pane. Select "System
>Events" in the Middle pane. Check "Start" and "Stop" in the
>"System Events" window. And enter usrLED_On in the "called
>POU" for "Start" and usrLED_Off in the "called POU" for
>"Stop".
>
><p>This will create a valid Run Mode light. It works even
>if someone switches the internal slider to the off position
>- the light will change from on to off.
>
><p>You can also use the usrLED_On program to setup multiple
>flashing sequences and then use an "Error" program to change
>which sequence index is running in order to display errors.
>
><p>Just some thoughts, I know it's been 6 months since the
>question was asked, but I just found this forum. :O)
>
><p>Also, I'm using Firmware Version: 01.11.01 (09) on my
>750-841 Ethernet PFCs.
>
><p>Take Care,<br>
>Larry
 
Top