PC Worx Express - While/Repeat Loops

ce_ht

Member
Join Date
Nov 2017
Location
Derby
Posts
12
Hi, I am currently programming a Phoenix Contact PLC using PC Worx Express. The software and PLC programming in general are still fairly new to me.

I have got the PLC doing what I want it to do by using mainly IF statements but I am having some trouble with loops. I keep getting watchdog errors even when running simple loops, for example I am trying to run the following;

WHILE Global_Reset = FALSE DO
Red_Lamp :=TRUE;
END_WHILE;

I have a number of outputs and counters I want to reset using the global reset input but even with the simple function above I am having no luck.
Thanks for any help
 
Hi,

The code should be
IF Global_Reset = FALSE THEN
RED_Lamp := TRUE;
ELSE
RED_Lamp := FALSE;
END_IF

You would use WHILE/FOR loops specifically for repeating a piece code for n no. of times and then EXIT. Your code is stuck in the WHILE loop infinitely and hence you get a watchdog. (You could put an EXIT after RED_Lamp := TRUE and then it would work) but again use a Loop when you really need to. For your specific code above IF THEN ELSE is sufficient.

Hope this helps.
Thanks.
 
Last edited:
Or you can do it more simple:

RED_Lamp:= NOT Global_Reset ;

There's no need to use IF instruction at all
 

Similar Topics

I have a zip file of a program that I'm told was created in Proworx NxT. Would the comments be stored in it if I could find the software or...
Replies
2
Views
547
I am getting random comm loss (error code 561 i think?) anyway i looked it up and its loss of comm to 2 modules on a controlnet network. The 2...
Replies
0
Views
331
The back story: We have one customer that has some equipment that uses DeviceNet that must remain in place. On those (5) DeviceNet networks they...
Replies
2
Views
860
Working on a site where they are using a DeltaV DCS system. They are using Topworx DVC6200 controllers on their modulating valves. These control...
Replies
1
Views
1,017
When making changes, I was taught to go to Combined > Make Change > go to Offline > will prompt to save > Save > Exit out of program > will prompt...
Replies
0
Views
609
Back
Top Bottom