Kitamura Mycenter Zero - DELTA Ethercat Retrofit

All things ecat Hickory CNC controller

Moderator: cnckeith

spikee
Posts: 129
Joined: Thu Feb 01, 2024 5:34 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: No
Contact:

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by spikee »

Hmm something interesting is happening. So M6_PD actually gets set. But the rest of the code does not seem to be activated:
Image
My guess is that it immediatly gets reset before arriving at:

Code: Select all

5749: ;- IF M6_SV && !DoingIndex_M && !DoingRotation_M
5750: ;-   THEN (M6PD_PD)
...
5755: ;- IF M6PD_PD THEN SET DoingM6_M, SET SetRequestedBinPositionStage
...
5884: ;- IF (RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M && IsSwingarmATC_M &&
5885: ;-   !AtRequestedToolLocation_M THEN SET ATRequestedToolLocation_M
...
Some more checking:
Image
I tried once to trigger on doing_M6 but it never triggers. Very peculiar...

Hmm even more interesting, when I use PLC detective to check the line 5749 is true it actually triggers and sets it

Hmm on line 5885 it actually sets ATRequestedToolLocation_M
Image

aha it seems to reset it all here:
Image

Code: Select all

;- IF ((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M && (IsSwingarmATC_M ||
;-   (AtPutbackLocation_M && AtRequestedToolLocation_M && ToolChangeComplete_M && !M6_SV &&
;-   IsCarouselATC_M))) || SV_STOP
;-   THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
;-   RST RotateCarouselStage, RST SetRequestedBinPositionStage, RST DoingM6_M, 
;-   RST M6_SV, RST AtPutbackLocation_M, RST AtRequestedToolLocation_M, 
;-   RST ToolChangeComplete_M, PutBackPosition_W = CarouselPosition_W
but that feels strange, cause when i go into that the status is
Line#5881:
Image
(unless I'm missing something I can't monitor SV_STOP)

Line#5889:
Image
---
So I tested this in C with the measured values and it triggers correctly.

Code: Select all

#include <stdio.h>

int main(void) {
    int RequestedBinPosition_W     = 14;
    int CarouselPosition_W         = 14;
    int DoingM6_M                 = 1;
    int IsSwingarmATC_M           = 1;
    int AtPutbackLocation_M        = 0;
    int AtRequestedToolLocation_M  = 1;
    int ToolChangeComplete_M       = 0;
    int M6_SV                     = 1;
    int IsCarouselATC_M           = 0;
    int SV_STOP                   = 0;
    int test                      = 0;

    if (
        (
            (RequestedBinPosition_W == CarouselPosition_W) &&
            (DoingM6_M) &&
            (
                IsSwingarmATC_M ||
                (
                    AtPutbackLocation_M &&
                    AtRequestedToolLocation_M &&
                    ToolChangeComplete_M &&
                    !M6_SV &&
                    IsCarouselATC_M
                )
            )
        )
        || SV_STOP
    ) {
        test = 1;
    }

    printf("test = %d\n", test);
    return 0;
}
And test = 1

So it seems to work as intended. But than the generated M6 code for the swingarm is incorrect?
Based on this it would never be able to pass line 306 as it is already resets before it even gets to that line.
Allin1Chris wrote: Mon Jan 13, 2025 4:21 pm Hi Chris, could you offer some guidance here? :D


Allin1Chris
PLC Expert
Posts: 237
Joined: Wed Jul 31, 2019 12:53 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by Allin1Chris »

spikee wrote: Tue Jan 14, 2025 3:40 pm

Code: Select all

;- IF ((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M && (IsSwingarmATC_M ||
;-   (AtPutbackLocation_M && AtRequestedToolLocation_M && ToolChangeComplete_M && !M6_SV &&
;-   IsCarouselATC_M))) || SV_STOP
;-   THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
;-   RST RotateCarouselStage, RST SetRequestedBinPositionStage, RST DoingM6_M, 
;-   RST M6_SV, RST AtPutbackLocation_M, RST AtRequestedToolLocation_M, 
;-   RST ToolChangeComplete_M, PutBackPosition_W = CarouselPosition_W
Appears i may of made a mistake with that logic when combining the Carousel (Armless) and Swingarm Logic.

Try changing that section of logic to read

Code: Select all

IF IsSwingarmATC_M && ((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M) || SV_STOP)
  THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
       RST RotateCarouselStage, RST SetRequestedBinPositionStage

IF IsCarouselATC_M && (((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M && AtPutbackLocation_M &&
  AtRequestedToolLocation_M && ToolChangeComplete_M && !M6_SV) || SV_STOP)
  THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
  RST RotateCarouselStage, RST SetRequestedBinPositionStage, RST DoingM6_M, 
  RST M6_SV, RST AtPutbackLocation_M, RST AtRequestedToolLocation_M, 
  RST ToolChangeComplete_M, PutBackPosition_W = CarouselPosition_W
When requesting support READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043

Please ALWAYS post a FRESH report. To make a report: https://www.youtube.com/watch?v=Ecvg0VJp1oQ.

(We pride ourselves on providing timely solid technical support but, without good information we may not be able to help and/or reply until such information is posted.)

Centroid PLC Tutorial Videos


spikee
Posts: 129
Joined: Thu Feb 01, 2024 5:34 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: No
Contact:

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by spikee »

I'll give it a try tomorrow. Learning a lot to track this all down!
Thr plc itself is pretty simple. Figuring how everything is interconnected within it is quite a bit more challenging.
spikee_kitamura.src
updated plc file
(302.7 KiB) Downloaded 80 times
M6 code that needs to be added:

Code: Select all

...
Cycle Arm From Home to Carousel/Spindle
M94 /13                           ;Request Arm Cycle
;;;;;;Spikee add code to move atc arm
M101 /70320                       ;Wait for ArmAtSpindleNewTool_M

;Unclamp Tool
M94 /16                           ;Unclamp Tool
M101 /70801                       ;Wait for Tool Unclamped

;Cycle Arm 180, Replacing Tools
M94 /13                           ;Request Arm Cycle
;;;;;;Spikee add code to move atc arm
M101 /70320                       ;Wait for ArmAtSpindleNewTool_M

;Clamp Tool
M95 /16                           ;Clamp Tool
M101 /70802                       ;Wait for Tool Clamped

;Cycle Arm To Home
M94 /13                           ;Request Arm Cycle
;;;;;;Spikee add code to move atc arm
M101 /70318                       ;Wait for ArmAtHome_M
...


spikee
Posts: 129
Joined: Thu Feb 01, 2024 5:34 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: No
Contact:

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by spikee »

So I spent some time today on getting further with the ATC.
The code that chris posted did not compile "Rung" problems.
So I tried my best to rewrite it:

Code: Select all

IF (IsSwingarmATC_M && (RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M) || SV_STOP
    THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
    RST RotateCarouselStage, RST SetRequestedBinPositionStage

IF IsCarouselATC_M && ((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M && 
    AtPutbackLocation_M && AtRequestedToolLocation_M && ToolChangeComplete_M && !M6_SV) || SV_STOP
    THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
    RST RotateCarouselStage, RST SetRequestedBinPositionStage, RST DoingM6_M, 
    RST M6_SV, RST AtPutbackLocation_M, RST AtRequestedToolLocation_M, 
    RST ToolChangeComplete_M, PutBackPosition_W = CarouselPosition_W
Afaik this does the same.

So now it can actually pass to the ATC arm stage. And errors out when your arm does not move (i.e. by default it just sets the IO, not send g-code. This is the behavoir one would expect at this point.) But when doing that I stumbled on another bug.
The Pot up/down implementation is not correct. Additionaly M107 can break and in that state an e-stop does not help, and a power cycle is the only thing that fixes it.

M107 bug:
When you look at the carroussel ATC code it makes sure the pot and or caroussel is in the correct position before it starts turning.
In the swingarm atc M107 -> RotateCarouselStage code it does not. Normally to be able to rotate the carroussel in this setup the carousel pot needs to be up. In the swingarm code it just errors out:

Code: Select all

;Fault if Pot is not up when trying to move carousel
IF (DoingM6_M || DoingIndex_M || DoingRotation_M) && (RequestedBinPosition_W != CarouselPosition_W) &&
  (!CarouselPotIsUp_I || CarouselPotIsDown_I) && IsSwingarmATC_M
  THEN FaultMsg_W = CAROUSEL_POT_NOT_UP_C, SET OtherFault_M
Initially i thought i could just fix it in my M6 marco by calling the M94 /xx code before doing M107. Unfortionatly that is not possible as the pot up/down codes are only allowed to run when "DoingM6_M" is active (M94 /8). So i tried to work around that but that basically causes more issues down the line.
So the next thing I tried is to get around it by " fixing" the logic at the output relais (i.e. potUp is always active unless potDown output is active). Unfortionatly this also messes things up down the line.

The current default hickory swingarm PLC code is not able to recover if the input CarouselPotIsDown_I != TRUE when M107 / a toolchange call

Additionaly M107 can "crash" due to somewhere in the PLC code it not being fully reset at E-Stop stage.
Allin1Chris wrote: Tue Jan 14, 2025 5:21 pm
There are a few dirty methods to solve this such as just calling CarouselPotIsDown_O after e-stop or something like that and or bypassing the safeties that are build in relating to this. But the best solution is to make the PLC RotateCarouselStage auto-recover / setup if it is not in the correct position. Something which the regular carousselAtc code does.
Attachments
spikee_kitamuraV0.1.src
(303.45 KiB) Downloaded 82 times
mfunc6.mac
(13.85 KiB) Downloaded 92 times


Allin1Chris
PLC Expert
Posts: 237
Joined: Wed Jul 31, 2019 12:53 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by Allin1Chris »

spikee wrote: Wed Jan 15, 2025 6:21 pm So I spent some time today on getting further with the ATC.
The code that chris posted did not compile "Rung" problems.
So I tried my best to rewrite it:

Code: Select all

IF (IsSwingarmATC_M && (RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M) || SV_STOP
    THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
    RST RotateCarouselStage, RST SetRequestedBinPositionStage

IF IsCarouselATC_M && ((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M && 
    AtPutbackLocation_M && AtRequestedToolLocation_M && ToolChangeComplete_M && !M6_SV) || SV_STOP
    THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
    RST RotateCarouselStage, RST SetRequestedBinPositionStage, RST DoingM6_M, 
    RST M6_SV, RST AtPutbackLocation_M, RST AtRequestedToolLocation_M, 
    RST ToolChangeComplete_M, PutBackPosition_W = CarouselPosition_W
Afaik this does the same.
This should be the correct code, i had adjusted it further after sending it previously.

Code: Select all

IF IsSwingarmATC_M && (((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M) || SV_STOP)
  THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
       RST RotateCarouselStage, RST SetRequestedBinPositionStage

IF IsCarouselATC_M && (((RequestedBinPosition_W == CarouselPosition_W) && DoingM6_M && AtPutbackLocation_M &&
  AtRequestedToolLocation_M && ToolChangeComplete_M && !M6_SV) || SV_STOP)
  THEN RST RotateCarouselStage, RST CarouselEnable_O, RST SetCarouselDirectionStage,
  RST RotateCarouselStage, RST SetRequestedBinPositionStage, RST DoingM6_M, 
  RST M6_SV, RST AtPutbackLocation_M, RST AtRequestedToolLocation_M, 
  RST ToolChangeComplete_M, PutBackPosition_W = CarouselPosition_W
spikee wrote: Wed Jan 15, 2025 6:21 pm M107 bug:
When you look at the carroussel ATC code it makes sure the pot and or caroussel is in the correct position before it starts turning.
In the swingarm atc M107 -> RotateCarouselStage code it does not. Normally to be able to rotate the carroussel in this setup the carousel pot needs to be up. In the swingarm code it just errors out:
Interesting that currently running swingarm systems have not encountered this. Looking into it, looks like DoingRotation_M is not reset when a fault condition occurs. This would only happen if E-Stop or a fault occured during the carousel rotation via "DoingRotation_M".

Adding a reset for it in the following logic under the ResetCarouselStage should correct it. This would mean that after An E-Stop under this condition the carousel wont try to move to that tool even if the same T# M107 was called again. But when M6 is called it will rotate the carousel then via the logic under RotateCarouselStage.

Code: Select all

;==============================================================================
                            ResetCarouselStage
;==============================================================================
IF SV_STOP || (!SV_PROGRAM_RUNNING && M6_SV) 
  THEN RST DoingIndexMinus_M, RST DoingIndexPlus_M, RST DoingIndex_M,
  RST CarouselEnable_O, RST SetCarouselDirectionStage, RST RotateCarouselStage,
  RST SetRequestedBinPositionStage, RST DoingM6_M, RST M6_SV, RST AtPutbackLocation_M,
  RST AtRequestedToolLocation_M, RST ToolChangeComplete_M, RST DoingPutback_M, RST DoingRotation_M
When requesting support READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043

Please ALWAYS post a FRESH report. To make a report: https://www.youtube.com/watch?v=Ecvg0VJp1oQ.

(We pride ourselves on providing timely solid technical support but, without good information we may not be able to help and/or reply until such information is posted.)

Centroid PLC Tutorial Videos


spikee
Posts: 129
Joined: Thu Feb 01, 2024 5:34 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: No
Contact:

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by spikee »

Allin1Chris wrote: Thu Jan 16, 2025 1:00 pm
Hi Chris, that seems to work so far. Any ideas on how to solve the pot not up situation?

Code: Select all

;Fault if Pot is not up when trying to move carousel
IF (DoingM6_M || DoingIndex_M || DoingRotation_M) && (RequestedBinPosition_W != CarouselPosition_W) &&
  (!CarouselPotIsUp_I || CarouselPotIsDown_I) && IsSwingarmATC_M
  THEN FaultMsg_W = CAROUSEL_POT_NOT_UP_C, SET OtherFault_M
As you are not able to call:

Code: Select all

M94 /14                           ;Request PotDown 
M101 /70807                       ;Confirm Pot is Down
when

Code: Select all

M94 /8                            ;Request Tool Change
is not active. But when you make it active it immediately starts doing other things.

I also feel like the PLC code is setup for solenoids that stay in position even when the signal has been removed.
As I notice in the PLC code that the pot up/down signal is only high/low for like 1 second. The output is not either up, or either down. In my situation that creates quite weird behaviour. I would image it would also create weird behaviour in other setups.

Attachments
spikee_kitamuraV0.2.src
(303.85 KiB) Downloaded 77 times
mfunc6.mac
(13.85 KiB) Downloaded 88 times


Allin1Chris
PLC Expert
Posts: 237
Joined: Wed Jul 31, 2019 12:53 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by Allin1Chris »

Thanks for the video, helps a lot in understanding the situation. The Output should remain on until the input is seen, then it turns off once CarouselPotIsDown signal is true. Can see in the short clip in this video the type of mechanism this PLC is intended for.



Can you check the PLC Detective and your PotDown Input when you give it the Pot Down command. It seems like watching the video you sent that it may of seen the input for just a moment and turned off the output. The PLC I/O screen is not as fast and quick blips of state of inputs are not always seen.

You will likely need to modify the code from here if the Output needs to remain on to keep your pot in place.

CarouselPotUpDownStage is where the output is turned on and off and its conditions.

Code: Select all

;==============================================================================
                        CarouselPotUpDownStage
;==============================================================================
;Carousel Pot Down
IF True_M THEN CarouselPotUpDownTimer_T = 3500
IF ((DoingM6_M && M14_SV) || (Aux14Key_I &&  M14_SV)) && !CarouselEnable_O
  THEN SET CarouselPotDown_O, SET CarouselPotUpDownTimer_T, SET MovingPotDown_M,
  RST MovingPotUp_M  
  
IF SV_STOP || !SV_PROGRAM_RUNNING || (MovingPotDown_M && CarouselPotIsDown_I)
  THEN RST CarouselPotDown_O, RST M14_SV
As a quick example, if you need the output to remain on, might be best to do something like the following code

Code: Select all

IF SV_STOP || !SV_PROGRAM_RUNNING THEN RST M14_SV
IF M14_SV THEN (CarouselPotDown_O)
This will keep the output on for as long as M14_SV remains active then.
When requesting support READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043

Please ALWAYS post a FRESH report. To make a report: https://www.youtube.com/watch?v=Ecvg0VJp1oQ.

(We pride ourselves on providing timely solid technical support but, without good information we may not be able to help and/or reply until such information is posted.)

Centroid PLC Tutorial Videos


spikee
Posts: 129
Joined: Thu Feb 01, 2024 5:34 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: No
Contact:

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by spikee »

Allin1Chris wrote: Thu Jan 16, 2025 5:00 pm Can you check the PLC Detective and your PotDown Input when you give it the Pot Down command. It seems like watching the video you sent that it may of seen the input for just a moment and turned off the output. The PLC I/O screen is not as fast and quick blips of state of inputs are not always seen.
Hi Chris, yes this is what happens. My guess is that normally systems than use a latching relay/solenoid or some circuit that does so instead of a momentary one. In such instance just giving it a pulse is good enough.

It is still kinda strange as it actually reads the sensor value to see it has arrived, and at that point it has not (yet). I could have a look in the plc-detective this is the case. It actually takes like 2-3 seconds before it arrives at the pot down location (i reduced the flow by a lot). So it would not be able to do that yet. Unless thare is some debouce issue happening but presumably that is not the case.

I was a bit lazy and got chatgpt to modify the code. At first glance it looks pretty good, just need to fix the formatting and do a final check:

Code: Select all

(*
  Single-Solenoid, Spring-Return
  -------------------------------------
  If 'CarouselPotUp_O' is SET (ON), pot goes UP.
  If 'CarouselPotUp_O' is RST (OFF), pot goes DOWN.
*)

(*
  M14_SV = "Command Pot Down"
  M15_SV = "Command Pot Up"
*)

(* ================================
   COMMAND: POT DOWN
   ================================ *)
IF ( (DoingM6_M AND M14_SV)
   OR (Aux14Key_I AND M14_SV) )
   AND (NOT CarouselEnable_O)
THEN
    // Turn solenoid OFF => spring returns pot DOWN
    RST CarouselPotUp_O;
    
    // Start or reset the move timer
    SET CarouselPotUpDownTimer_T;
    
    // Set "moving down" flag
    SET MovingPotDown_M;
    RST MovingPotUp_M;
END_IF;

(* Keep solenoid OFF if the pot is physically down *)
IF CarouselPotIsDown_I THEN
    RST CarouselPotUp_O;
END_IF;


(* ================================
   COMMAND: POT UP
   ================================ *)
IF ( (DoingM6_M AND M15_SV)
   OR (Aux14Key_I AND M15_SV) )
   AND (NOT CarouselEnable_O)
THEN
    // Turn solenoid ON => pot goes UP
    SET CarouselPotUp_O;
    
    // Start or reset the move timer
    SET CarouselPotUpDownTimer_T;
    
    // Set "moving up" flag
    SET MovingPotUp_M;
    RST MovingPotDown_M;
END_IF;

(* Keep solenoid ON if the pot is physically up *)
IF CarouselPotIsUp_I THEN
    SET CarouselPotUp_O;
END_IF;


(* ================================
   TIMEOUT / FAULT HANDLING
   ================================ *)

(* If we are trying to move the pot, but the limit switch isn't reached
   before the timer expires, declare a fault *)
IF ( (MovingPotDown_M AND CarouselPotUpDownTimer_T)
   OR (MovingPotUp_M   AND CarouselPotUpDownTimer_T) )
THEN
    FaultMsg_W := CAROUSEL_POT_UP_DOWN_TIME_OUT_C;
    SET OtherFault_M;
END_IF;

(* Once the pot has reached its final position, reset the timer & flags *)
IF (MovingPotDown_M AND CarouselPotIsDown_I)
 OR (MovingPotUp_M   AND CarouselPotIsUp_I)
THEN
    RST CarouselPotUpDownTimer_T;
    RST MovingPotDown_M;
    RST MovingPotUp_M;
END_IF;


(* ================================
   STOP / ABORT HANDLING
   ================================ *)
IF ( SV_STOP
  OR (NOT SV_PROGRAM_RUNNING) )
THEN
    // Turn solenoid OFF, pot goes DOWN via spring
    RST CarouselPotUp_O;
    
    // Reset bits
    RST CarouselPotUpDownTimer_T;
    RST MovingPotDown_M;
    RST MovingPotUp_M;
    
    // Clear any M-codes
    RST M14_SV;
    RST M15_SV;
END_IF;


(* ================================
   OTHER FAULTS
   ================================ *)
(* For example: Low Air Pressure while attempting to unclamp a tool *)
IF (NOT AirPressureOk_I) AND ToolUnclampOut_O THEN
    FaultMsg_W := LOW_AIR_FAULT_C;
    SET OtherFault_M;
END_IF;
This code has a bit of a risk that it will set itself as there are no delays buit in the "latching" circuit. So i need to double check that.


spikee
Posts: 129
Joined: Thu Feb 01, 2024 5:34 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: No
Contact:

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by spikee »

So i re-wrote the carouselputupdown stage and I think it contains all the needed features.

Code: Select all

;=============================
;   COMMAND: POT DOWN
;=============================
IF True_M THEN CarouselPotUpDownTimer_T = 3500
IF (M14_SV || (Aux14Key_I && M14_SV) ) && (!CarouselEnable_O)
  THEN RST CarouselPotUp_O, 
  SET CarouselPotUpDownTimer_T, 
  SET MovingPotDown_M, 
  RST MovingPotUp_M

;Echo Input to Memorybit for Macros
IF CarouselPotIsDown_I THEN (PotDownState_M)

;=============================
;   COMMAND: POT UP
;=============================
IF (M15_SV 
   || (Aux14Key_I && M15_SV) )
   && (!CarouselEnable_O)
   && (ToolCounter_I)              ;// ensure caroussel index is in postions, so you dont crash it into the caroussel
THEN
    SET MovingPotUp_M,              ;// pot is commanded to go up
    RST MovingPotDown_M,             ;// ensure down command is off
    SET CarouselPotUpDownTimer_T    ;// start move timer, etc.

;Echo Input to Memorybit for Macros
IF CarouselPotIsUp_I THEN (PotUpState_M)

;=============================
;   LOGIC: POT DOWN / POT UP LOGIC (latcing + set/reset) ; movingpotdown is safe state
;=============================
IF MovingPotUp_M THEN
    SET CarouselPotUp_O,
    RST M14_SV,
    RST M15_SV;
IF (!MovingPotUp_M) && (MovingPotDown_M) THEN
    RST CarouselPotUp_O,
    RST M14_SV,
    RST M15_SV

;=============================
;   SAFETY + TIMER + RESET
;=============================
;RST Timer on successful completion, job cancellation or fault
IF SV_STOP || !SV_PROGRAM_RUNNING || (MovingPotDown_M && CarouselPotIsDown_I) || 
  (MovingPotUp_M && CarouselPotIsUp_I)
  THEN RST CarouselPotUpDownTimer_T, RST MovingPotDown_M, RST MovingPotUp_M, RST M14_SV, SET M15_SV

IF (MovingPotDown_M && CarouselPotUpDownTimer_T) || 
  (MovingPotUp_M && CarouselPotUpDownTimer_T) 
  THEN FaultMsg_W = CAROUSEL_POT_UP_DOWN_TIME_OUT_C, SET OtherFault_M 
I removed the DoingM6_M prerequisite as in my case you can move the pot up/down at any moment as long as the carousel is not turning AND toolcounter I = true (carousel is lined up). potdown is the safe move. I need to put this on the machine later and give it a go.


cncsnw
Community Expert
Posts: 4584
Joined: Wed Mar 24, 2010 5:48 pm

Re: Kitamura Mycenter Zero - DELTA Ethercat Retrofit

Post by cncsnw »

I am not prepared to interpret the whole sequence to understand your intent and whether it makes sense, but...

The expression:

Code: Select all

(M14_SV || (Aux14Key_I && M14_SV) )
is functionally no different from the expression:

Code: Select all

M14_SV
So it is not clear what you are trying to accomplish with the Aux14 key.

Also, there is probably no reason to RST CarouselPotUp_O in direct response to M14_SV, given that you are also setting MovingPotDown_M, and your later logic is going to reset CarouselPotUp_O in response to MovingPotDown_M.

Your logic will be easier to understand if there is only one place where you ultimately control (SET or RST) a given output.


Post Reply