PLC Programming Question - Not Using the Wizard - (Problem Solved)
Posted: Sat Jun 28, 2025 6:05 pm
Hello I have added a motorized tool probe arm and set it up so that INP16 is ProbeTrip, INP15 is ProbeDetect, and INP14 is ProbeArmMachineReady. The arm is raised and lowered with OUT19 & OUT20 using Auxillary buttons Aux3 & Aux4. That all works great, the arm goes up and down and activates the appropriate inputs. What I wanted to do was use INP14 to prevent the machine from executing a G-Code program when the arm was down in the tool measuring position. The problem is the code I have used not only keeps the machine from executing a G-Code program it keeps it from executing an auto tool measure command. It Seems SV_Program_Running is not the right command to use, but I am at a loss for what else would work. For now I have just commented it out and the rest works fine. I was hoping some of you could point me toward the right command to accomplish what I am trying to do. Here is the section of Code and the part in red is my problem. Thanks In Advance.
;---------------------------------------------------------------------
; NEW: Tool Setter Arm Control (Simplified for "Push and Hold" operation)
;---------------------------------------------------------------------
; Check if Tool Setter Machine Ready (INP14) is active
; This sets ToolSetterReady_M if INP14 is active, otherwise, it will be RST by default below
IF TRUE THEN RST ToolSetterReady_M ; Default to OFF
IF INP14 THEN SET ToolSetterReady_M
; Prevent G-code program from running if ToolSetterMachineReadyInput is not active
;IF SV_PROGRAM_RUNNING && !ToolSetterReady_M
; THEN ErrorMsg_W = TOOLSETTER_NOT_READY_MSG,
; SET ErrorFlag_M,
; SET SV_STOP
; Control ToolSetterArmDown (OUT19) with Aux3Key_M (push and hold)
; Default to OFF for ToolSetterArmDown and its active flag
IF TRUE THEN RST ToolSetterArmDown
IF TRUE THEN RST ToolSetterArmDownActive_M
IF TRUE THEN RST Aux3LED
; Condition to SET ToolSetterArmDown and its active flag
IF Aux3Key_M && !ToolSetterArmUpActive_M
THEN SET ToolSetterArmDown, SET ToolSetterArmDownActive_M, SET Aux3LED
; Control ToolSetterArmUp (OUT20) with Aux4Key_M (push and hold)
; Default to OFF for ToolSetterArmUp and its active flag
IF TRUE THEN RST ToolSetterArmUp
IF TRUE THEN RST ToolSetterArmUpActive_M
IF TRUE THEN RST Aux4LED
; Condition to SET ToolSetterArmUp and its active flag
IF Aux4Key_M && !ToolSetterArmDownActive_M
THEN SET ToolSetterArmUp, SET ToolSetterArmUpActive_M, SET Aux4LED
; Turn off both arms if E-Stop is active (Safety Interlock - highest priority)
; These will override any SET commands above if SV_STOP is true.
IF SV_STOP
THEN RST ToolSetterArmDown, RST ToolSetterArmUp,
RST ToolSetterArmDownActive_M, RST ToolSetterArmUpActive_M
;---------------------------------------------------------------------
; END NEW: Tool Setter Arm Control and G-code Program Interlock
;---------------------------------------------------------------------
Thanks Gary
;---------------------------------------------------------------------
; NEW: Tool Setter Arm Control (Simplified for "Push and Hold" operation)
;---------------------------------------------------------------------
; Check if Tool Setter Machine Ready (INP14) is active
; This sets ToolSetterReady_M if INP14 is active, otherwise, it will be RST by default below
IF TRUE THEN RST ToolSetterReady_M ; Default to OFF
IF INP14 THEN SET ToolSetterReady_M
; Prevent G-code program from running if ToolSetterMachineReadyInput is not active
;IF SV_PROGRAM_RUNNING && !ToolSetterReady_M
; THEN ErrorMsg_W = TOOLSETTER_NOT_READY_MSG,
; SET ErrorFlag_M,
; SET SV_STOP
; Control ToolSetterArmDown (OUT19) with Aux3Key_M (push and hold)
; Default to OFF for ToolSetterArmDown and its active flag
IF TRUE THEN RST ToolSetterArmDown
IF TRUE THEN RST ToolSetterArmDownActive_M
IF TRUE THEN RST Aux3LED
; Condition to SET ToolSetterArmDown and its active flag
IF Aux3Key_M && !ToolSetterArmUpActive_M
THEN SET ToolSetterArmDown, SET ToolSetterArmDownActive_M, SET Aux3LED
; Control ToolSetterArmUp (OUT20) with Aux4Key_M (push and hold)
; Default to OFF for ToolSetterArmUp and its active flag
IF TRUE THEN RST ToolSetterArmUp
IF TRUE THEN RST ToolSetterArmUpActive_M
IF TRUE THEN RST Aux4LED
; Condition to SET ToolSetterArmUp and its active flag
IF Aux4Key_M && !ToolSetterArmDownActive_M
THEN SET ToolSetterArmUp, SET ToolSetterArmUpActive_M, SET Aux4LED
; Turn off both arms if E-Stop is active (Safety Interlock - highest priority)
; These will override any SET commands above if SV_STOP is true.
IF SV_STOP
THEN RST ToolSetterArmDown, RST ToolSetterArmUp,
RST ToolSetterArmDownActive_M, RST ToolSetterArmUpActive_M
;---------------------------------------------------------------------
; END NEW: Tool Setter Arm Control and G-code Program Interlock
;---------------------------------------------------------------------
Thanks Gary