PLC handling of MPG when handwheels are enabled *SOLVED*

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
tblough
Posts: 3097
Joined: Tue Mar 22, 2016 10:03 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Boston, MA
Contact:

PLC handling of MPG when handwheels are enabled *SOLVED*

Post by tblough »

There are some things about the default PLC handling of jogging and MPG that that make perfect sense for machines using the jog panel and MPG pendant, but are cumbersome when using dual handwheels.

First, the control starts up in X1 jog mode. Great if you are using the jog keys to move the machine. With handwheels, X100 is usually set to mimic a mechanical connection to the leadscrews. X1 and X10 are used for finer control, so I'd like my machine to start up with X100 since I have handwheels.

Second, I use my handwheels for fine positioning and only use the jog keys when I need to move a large distance quickly. Once again, the default setting of starting in incremental jog mode makes sense for jog panel and MPG machines, but I'd like to start up in continuous jog mode.

Third, and related to the first and second ones, the default PLC behavior is to automatically switch to incremental jog mode when ever X1, X10, or X100 is selected. Again, I'm using these keys to select finer positioning with my handwheels but still want to jog continuously with the jog keys so I'd like it to stay where it was. I'll select incremental when I need incremental.

Fourth, since I have dual handwheels, I'd like them to be enabled when the machine starts up and not have to press the MPG key to turn them on.

And finally, as a safety feature the PLC disables the MPG whenever a program is running. Great, but since I'm often using my handwheels to move the carriage out of the way to check the part when the program finishes, I'd like the MPG state to be restored after the program finishes. If I had it off, leave it off. If I had it on, turn it back on.

I can easily do the first through the third items in the PLC with some small edits to the MPGStage and JogPanelStage.
These changes to the MPGStage change the default from X1 to X100 when handwheels are enabled.
;x1, x10, x100 functions
;--X1
IF x1JogKey_I || SkinX1_M_SV THEN (x1JogPD_PD)
IF x1JogPD_PD || (OnAtPowerUp_M && !HandWheel_M) || X1_M || (MPG_Inc_X_1_I && MPGLED_O) ; RTB/handwheel - changed powerup to X100 if handwheels
THEN SET x1JogLED_O, RST x10JogLED_O, RST x100JogLED_O

;--X10
IF x10JogKey_I || SkinX10_M_SV THEN (x10JogPD_PD)
IF x10JogPD_PD || X10_M || (MPG_Inc_X_10_I && MPGLED_O)
THEN RST x1JogLED_O, SET x10JogLED_O, RST x100JogLED_O

;--X100
IF x100JogKey_I || SkinX100_M_SV THEN (x100JogPD_PD)
IF x100JogPD_PD || (OnAtPowerUp_M && HandWheel_M) || X100_M || (MPG_Inc_X_100_I && MPGLED_O) ; RTB/handwheel - changed powerup to X100 if handwheels
THEN RST x1JogLED_O, RST x10JogLED_O, SET x100JogLED_O
These changes to the JogPanelStage make continuous jog the default and prevent the multiplier keys from reverting to incremental mode automatically.
IF IncrContKey_I || KbTogIncContJog_M || SkinIncCont_M_SV THEN (IncrContPD_PD)
IF (IncrContPD_PD && !IncrContLED_O) || ((OnAtPowerUp_M || x1JogPD_PD || x10JogPD_PD || x100JogPD_PD) && !HandWheel_M) ; RTB/handwheel - changed on at powerup to continuous jog, don't switch to incremental if dual handwheel
THEN SET IncrContLED_O
IF (IncrContPD_PD && IncrContLED_O) || (OnAtPowerUp_M && HandWheel_M) THEN RST IncrContLED_O ; RTB/handwheel - changed on at powerup to continuous jog if dual handwheel
Here's where I run into problems. The code changes below in the MPGStage work to enable the MPG on startup
IF MPGKey_I || SkinMPG_M_SV THEN (MpgPD_PD)
IF MpgPD_PD && MPGLED_O THEN SET MPGManOffFlag_M
IF (!SV_MPG_1_ENABLED && MPG_M && MPGManOffFlag_M) || (MpgPD_PD && !MPGLED_O && HandWheel_M)
THEN RST MPGManOffFlag_M

IF (MpgPD_PD && !MPGLED_O) || (SV_MPG_1_ENABLED && MPG_M && !MPGManOffFlag_M) || (OnAtPowerUp_M && Handwheel_M) &&
!SV_PROGRAM_RUNNING THEN SET MPG_LED_OUT_O, SET MPGLED_O
However, it seems the correct spot for the OnAtPowerUP should be in the preceeding line where the one-shot for the MPG is set, like this
IF MPGKey_I || SkinMPG_M_SV || (OnAtPowerUp_M && Handwheel_M) THEN (MpgPD_PD)
IF MpgPD_PD && MPGLED_O THEN SET MPGManOffFlag_M
IF (!SV_MPG_1_ENABLED && MPG_M && MPGManOffFlag_M) || (MpgPD_PD && !MPGLED_O && HandWheel_M)
THEN RST MPGManOffFlag_M

IF (MpgPD_PD && !MPGLED_O) || (SV_MPG_1_ENABLED && MPG_M && !MPGManOffFlag_M) &&
!SV_PROGRAM_RUNNING THEN SET MPG_LED_OUT_O, SET MPGLED_O
However that does not work and I can't figure out why.

I really run into trouble when I try to have the MPG state restored after a program run. I created a semaphore to signal if the MPG was on just before a program run turns it off. Once again, I can't get this to work:
IF MPGKey_I || SkinMPG_M_SV || (OnAtPowerUp_M && Handwheel_M) THEN (MpgPD_PD) ; RTB/Handwheel, turn on MPG at power up if handwheels
IF MpgPD_PD && MPGLED_O THEN SET MPGManOffFlag_M
IF (!SV_MPG_1_ENABLED && MPG_M && MPGManOffFlag_M) || (MpgPD_PD && !MPGLED_O && HandWheel_M)
THEN RST MPGManOffFlag_M

IF ((MpgOnSaved_M || MpgPD_PD) && !MPGLED_O) || (SV_MPG_1_ENABLED && MPG_M && !MPGManOffFlag_M) && ; if shut off by program running then retore MPG state
!SV_PROGRAM_RUNNING THEN SET MPG_LED_OUT_O, SET MPGLED_O, RST MpgOnSaved_M

IF MPGLED_O && SV_PROGRAM_RUNNING THEN SET MpgOnSaved_M ; RTB, if program running will shut off MPG in the next step, mark it for restoration

IF ((!SV_MPG_1_ENABLED && MPG_M) || (MpgPD_PD && MPGLED_O))
|| SV_PROGRAM_RUNNING THEN RST MPG_LED_OUT_O, RST MPGLED_O
If anyone can help with this I sure would appreciate it. The complete source code is attached if interested.
Attachments
OAK-HLV-H10140T-R5.src
(149.55 KiB) Downloaded 134 times
Last edited by tblough on Sat Sep 05, 2020 6:14 pm, edited 1 time in total.
Cheers,

Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
tblough
Posts: 3097
Joined: Tue Mar 22, 2016 10:03 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Boston, MA
Contact:

Re: PLC handling of MPG when handwheels are enabled

Post by tblough »

Okay, spent some time this afternoon figuring out the existing MPG logic in the PLC and got the final piece of the puzzle working. Here are my working MPGStage and JogPanelStage based off Centroid-Lathe-Standard-OAK-r5.src. These changes fully implement the five behavior changes at the top of the first post.

MPGStage All changed areas at the beginning of the stage

Code: Select all

;=============================================================================
MPGStage
;=============================================================================
; MPG Functions
; Turn on/off Jog Panel MPG LED & on the MPG
IF MPGKey_I || SkinMPG_M_SV THEN (MpgPD_PD)
IF MpgPD_PD && MPGLED_O THEN SET MPGManOffFlag_M
IF (!SV_MPG_1_ENABLED && MPG_M && MPGManOffFlag_M) || (MpgPD_PD && !MPGLED_O && HandWheel_M)
    THEN RST MPGManOffFlag_M

; RTB/Handwheel, turn mpg on at powerup if handwheels connected, turn on if not manually turned off
IF ((MpgPD_PD || (!MPGManOffFlag_M && Handwheel_M)) && !MPGLED_O)  ; RTB added !MPGManOffFlag_M test
    || (SV_MPG_1_ENABLED && MPG_M && !MPGManOffFlag_M) && !SV_PROGRAM_RUNNING 
    THEN SET MPG_LED_OUT_O, SET MPGLED_O

IF ((!SV_MPG_1_ENABLED && MPG_M) || (MpgPD_PD && MPGLED_O))
    || SV_PROGRAM_RUNNING THEN RST MPG_LED_OUT_O, RST MPGLED_O

; x1, x10, x100 functions
;--X1, RTB/handwheel - changed powerup to X100 if handwheels
IF x1JogKey_I || SkinX1_M_SV THEN (x1JogPD_PD)
IF x1JogPD_PD || (OnAtPowerUp_M && !HandWheel_M) || X1_M || (MPG_Inc_X_1_I && MPGLED_O)
    THEN SET x1JogLED_O, RST x10JogLED_O, RST x100JogLED_O

;--X10
IF x10JogKey_I || SkinX10_M_SV THEN (x10JogPD_PD)
IF x10JogPD_PD || X10_M || (MPG_Inc_X_10_I && MPGLED_O)
    THEN RST x1JogLED_O, SET x10JogLED_O, RST x100JogLED_O

;--X100, RTB/handwheel - changed powerup to X100 if handwheels
IF x100JogKey_I || SkinX100_M_SV THEN (x100JogPD_PD)
IF x100JogPD_PD || (OnAtPowerUp_M && HandWheel_M) || X100_M || (MPG_Inc_X_100_I && MPGLED_O)
    THEN RST x1JogLED_O, RST x10JogLED_O, SET x100JogLED_O

; end of changes
JogPanelStage All changed areas at the beginning of the stage

Code: Select all

;=============================================================================
JogPanelStage
;=============================================================================
;--Select Incremental or Continuous Jog Mode
IF IncrContKey_I || KbTogIncContJog_M || SkinIncCont_M_SV THEN (IncrContPD_PD)

; RTB/handwheel - changed on at powerup to continuous jog, don't switch to incremental if dual handwheel
IF (IncrContPD_PD && !IncrContLED_O) || ((OnAtPowerUp_M
    || x1JogPD_PD || x10JogPD_PD || x100JogPD_PD) && !HandWheel_M)
    THEN SET IncrContLED_O

; RTB/handwheel - changed on at powerup to continuous jog if dual handwheel
IF (IncrContPD_PD && IncrContLED_O) || (OnAtPowerUp_M && HandWheel_M) THEN RST IncrContLED_O

; end of changes
I hope others with handwheels find this useful.
Cheers,

Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
martyscncgarage
Posts: 9914
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: PLC handling of MPG when handwheels are enabled *SOLVED*

Post by martyscncgarage »

Thanks for posting that info Tom.
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
RTech
Posts: 27
Joined: Wed Jul 22, 2020 10:20 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: just ordered
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: PLC handling of MPG when handwheels are enabled *SOLVED*

Post by RTech »

Tom,

I tried these PLC changes on my lathe and they work great! Thanks for sharing this.
EISEN Centroid2.jpg
I added both an axis joystick and remote spindle switch to the apron of my EISEN lathe...very handy! Hopefully, I'll get to actually start making parts tomorrow.

Jim
tblough
Posts: 3097
Joined: Tue Mar 22, 2016 10:03 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Boston, MA
Contact:

Re: PLC handling of MPG when handwheels are enabled *SOLVED*

Post by tblough »

Great! Glad to know it helped someone. Looks like a nice conversion there.
Cheers,

Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Post Reply