06-17-2008 04:07 AM
06-17-2008 07:22 AM
I looked at your code... You need to re-design it.
Design the approach by functionality.
Functions:
1: Front Panel Button: to turn Heater ON or OFF
2. LED Indicator: To indicate state of the heater.
3. Remote Switch: represents something somewhere which can also control the heater. Something that affects the status of the heater, thus the LED.
Since the Front Panel button also indicates the status of the heater, same as the LED, you could combine them into one.
However, your code uses logic (and the bad use of Local Variables) instead of states.
Consider this: You need to read the change of state of the Front Panel button. You need to read the state of the LED at regular intervals. Since the application does not interact or affect the state of the external switch, maybe we should represent it by simply reading the LED. Another VI that has access to the LED could turn it ON & OFF, which is a better representation...
I'll see if I can whip up a better example.
RayR
06-17-2008 07:35 AM
Please forgive me if I missed something in my quick read of this thread.
This sound like yet another example of a race condition, two un-coordinated writers of the same value.
If you can control the PLC's code I'd recomend you include logic to check a boolean flag that will serve as a "set output" request. It should only be writen by the PC and read by the PLC. If the PLC sees it is set and the conditions are correct, then the PLC set the output as requested.
Ben
06-17-2008 07:42 AM
06-17-2008 11:35 PM
06-17-2008 11:42 PM
06-18-2008 07:12 AM
06-18-2008 08:11 AM
Before completing the example, I need to know the following..
WHich switch has precedence over the other?
In other words, does the FP heater switch over-ride the remote one and does it reset the state of the remote switch?
Because you could press the FP switch to turn OFF the heater, but meanwhile, if the remote switch's state is ON, then when you read that state, it will turn ON the heater again.. So what happens with the remote switch?
RayR
06-18-2008 08:22 AM
06-18-2008 10:48 AM