PmcEditor 1.0 GENERATOR=LUA Code CYCLE=10 OUTFILE=C:\Mach4\Pmc\DacAirMistTools1to4.lua IO LIST FMachMistOn at Signal/Mist On FAirTool1 at Signal/Output #8 (TOOL 1 AIR (DO.06.01) (--SWITCHING)) FAirTool2 at Signal/Output #9 (TOOL 2 AIR (DO.06.02) (--SWITCHING)) FAirTool3 at Signal/Output #10 (TOOL 3 AIR (DO.06.03) (--SWITCHING)) FAirTool4 at Signal/Output #11 (TOOL 4 AIR (DO.06.04) (--SWITCHING)) FMachCoolantOn at Signal/Coolant On FMistTool1 at Signal/Output #24 (TOOL 1 MIST (DO.08.01) (--SWITCHING)) FMistTool2 at Signal/Output #25 (TOOL 2 MIST (DO.08.02) (--SWITCHING)) FMistTool3 at Signal/Output #26 (TOOL 3 MIST (DO.08.03) (--SWITCHING)) FMistTool4 at Signal/Output #27 (TOOL 4 MIST (DO.08.04) (--SWITCHING)) END PROGRAM RUNG COMMENT This PMC controls the air and mist on tools 1 - 4. Note the second PMC file for tools 5 - 7 END RUNG COMMENT Reads the current tool number and stores the value in ToolNumber. END RUNG CORE_VALUE_READ 0 ToolNumber 2 END RUNG COMMENT Each tool has its own solenoids for air and mist. Air can be on by itself, but air must be on to get mist.\nIf I turn off mist, I want air to stay on. END RUNG CONTACTS 0 FMachMistOn 0 Signal/1145 PARALLEL COIL 0 RMistRequest 0 0 0 SERIES OSR COIL 0 FMachCoolantOn 0 1 0 Signal/1144 END END END RUNG COMMENT MachCoolantOn is the Mach "Coolant" output signal. (Flood button), (M08). "Coolant" is the AirRequest for the tools. END RUNG CONTACTS 0 FMachCoolantOn 0 Signal/1144 COIL 0 RAirRequest 0 0 0 END RUNG COMMENT If I turn off air, I want mist to turn off as well. END RUNG CONTACTS 0 FMachCoolantOn 1 Signal/1144 OSR COIL 0 FMachMistOn 0 0 1 Signal/1145 END RUNG COMMENT Logic is the same for each tool. END RUNG COMMENT If I request air only, and tool 1 is active, turn on air for that tool.\nIf I request mist, turn on mist for that tool. Air request will already be on from line 5 because mist is requested. END RUNG COMMENT Tool 1 END RUNG CONTACTS 0 RAirRequest 0 Signal/1144 EQU ToolNumber 1 PARALLEL SERIES OSR COIL 0 FAirTool1 0 1 0 Signal/1058 END SERIES CONTACTS 0 RMistRequest 0 Signal/1145 OSR COIL 0 FMistTool1 0 1 0 Signal/1074 END END END RUNG COMMENT If air request turns off or we change tools, turn off both air and mist for that tool.\nThe double contacts on AirRequest and ToolNumber are so that MistRequest turning off only turns off mist. END RUNG PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 1 CONTACTS 0 RMistRequest 1 END PARALLEL SERIES PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 1 END OSR COIL 0 FAirTool1 0 0 1 Signal/1058 END SERIES OSR COIL 0 FMistTool1 0 0 1 Signal/1075 END END END RUNG COMMENT Tool 2 END RUNG CONTACTS 0 RAirRequest 0 Signal/1144 EQU ToolNumber 2 PARALLEL SERIES OSR COIL 0 FAirTool2 0 1 0 Signal/1059 END SERIES CONTACTS 0 RMistRequest 0 OSR COIL 0 FMistTool2 0 1 0 Signal/1075 END END END RUNG PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 2 CONTACTS 0 RMistRequest 1 END PARALLEL SERIES PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 2 END OSR COIL 0 FAirTool2 0 0 1 Signal/1059 END SERIES OSR COIL 0 FMistTool2 0 0 1 Signal/1075 END END END RUNG COMMENT Tool 3 END RUNG CONTACTS 0 RAirRequest 0 Signal/1144 EQU ToolNumber 3 PARALLEL SERIES OSR COIL 0 FAirTool3 0 1 0 Signal/1060 END SERIES CONTACTS 0 RMistRequest 0 OSR COIL 0 FMistTool3 0 1 0 Signal/1076 END END END RUNG PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 3 CONTACTS 0 RMistRequest 1 END PARALLEL SERIES PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 3 END OSR COIL 0 FAirTool3 0 0 1 Signal/1060 END SERIES OSR COIL 0 FMistTool3 0 0 1 Signal/1076 END END END RUNG COMMENT Tool 4 END RUNG CONTACTS 0 RAirRequest 0 Signal/1144 EQU ToolNumber 4 PARALLEL SERIES OSR COIL 0 FAirTool4 0 1 0 Signal/1061 END SERIES CONTACTS 0 RMistRequest 0 OSR COIL 0 FMistTool4 0 1 0 Signal/1077 END END END RUNG PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 4 CONTACTS 0 RMistRequest 1 END PARALLEL SERIES PARALLEL CONTACTS 0 RAirRequest 1 NEQ ToolNumber 4 END OSR COIL 0 FAirTool4 0 0 1 Signal/1061 END SERIES OSR COIL 0 FMistTool4 0 0 1 Signal/1077 END END END