PLC Programming Question - Not Using the Wizard - (Problem Solved)

All things ecat Hickory CNC controller

Moderator: cnckeith

Post Reply
glbreil
Posts: 112
Joined: Sun Jan 07, 2024 10:55 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: Yes

PLC Programming Question - Not Using the Wizard - (Problem Solved)

Post by glbreil »

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
Last edited by glbreil on Sat Jun 28, 2025 7:53 pm, edited 1 time in total.


glbreil
Posts: 112
Joined: Sun Jan 07, 2024 10:55 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: Yes

Re: PLC Programming Question - Not Using the Wizard

Post by glbreil »

I think I might have found a solution to my problem when studying other system variables in the PLC Programming Manual, but I haven't made it to the machine yet. Do you think this could work to all the machine to go ahead and auto measure when INP14 is not active? The key change is in red.

; Prevent G-code program from running if ToolSetterMachineReadyInput is not active
IF SV_PROGRAM_RUNNING && !ToolSetterReady_M && !SV_DOING_AUTO_TOOL_MEASURE
THEN ErrorMsg_W = TOOLSETTER_NOT_READY_MSG,
SET ErrorFlag_M,
SET SV_STOP
Last edited by glbreil on Sat Jun 28, 2025 7:54 pm, edited 1 time in total.


glbreil
Posts: 112
Joined: Sun Jan 07, 2024 10:55 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: Yes

Re: PLC Programming Question - Not Using the Wizard

Post by glbreil »

Problem Solved!


Post Reply