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.
These changes to the JogPanelStage make continuous jog the default and prevent the multiplier keys from reverting to incremental mode automatically.;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
Here's where I run into problems. The code changes below in the MPGStage work to enable the MPG on startupIF 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
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 thisIF 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 that does not work and I can't figure out why.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
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 anyone can help with this I sure would appreciate it. The complete source code is attached if interested.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