Work Light Aux 11 Toggle Code Help
Posted: Tue Apr 17, 2018 11:35 am
I've read through TB300, and I'm not seeing how you turn on and off an Aux button (with the same button). Is there one already setup for the work light since it's on the pull down in wizard? I had to tie it to flood to get it to work. I don't plan on using flood, but when I go back to auto mode, the lights are going to go out. So wouldn't have lights running unless I called for mist and flood in the code. But then, they would shut off again with the program completed. Would be nice just to tie it to one Aux button.
I've also been reading the lathe_plc.src and PLC manual. It's just taking me a while to wrap my head around which names should be used where. Can the variable names be used out in a macro? I see but the first few if statements, apparently memory locations can be. I can follow along on some of the examples to see what is happening, but then a lot of them shoot over my head. I tried to look at flood and mist in the source, but due to the fact they introduced auto and manual modes, it made it way more complex to try and follow. So I thought turning on a work light would be easy....LOL....little did I know (or how little do I know apparently).
Would something like this work, since worklight is assigned to output 8?
;------------------------------------------------------------------------------
; Filename: Mfunc79
; Toggle Worklight Aux 11 macro
; Description: User Customizable Macro
; Notes:
; Requires: Machine home must be set prior to use.
; Please see TB300 for tips on writing custom macros.
;
;Turn on work light for Aux12 button - parameter 199 set to 7911
;------------------------------------------------------------------------------
IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
IF #4120 == #90014 THEN GOTO 1000 ;Skip macro if already at position
N100 ;Insert your code between N100 and N1000
IF worklight==set then worklight==rst
else worklight==set
If Aux11LED==set then Aux11LED==rst
else AuxLED==set
N1000 ;End of Macro
Does a macro only run once when the Aux11 button is pushed? Or is this where a one shot should be used?
I've also been reading the lathe_plc.src and PLC manual. It's just taking me a while to wrap my head around which names should be used where. Can the variable names be used out in a macro? I see but the first few if statements, apparently memory locations can be. I can follow along on some of the examples to see what is happening, but then a lot of them shoot over my head. I tried to look at flood and mist in the source, but due to the fact they introduced auto and manual modes, it made it way more complex to try and follow. So I thought turning on a work light would be easy....LOL....little did I know (or how little do I know apparently).
Would something like this work, since worklight is assigned to output 8?
;------------------------------------------------------------------------------
; Filename: Mfunc79
; Toggle Worklight Aux 11 macro
; Description: User Customizable Macro
; Notes:
; Requires: Machine home must be set prior to use.
; Please see TB300 for tips on writing custom macros.
;
;Turn on work light for Aux12 button - parameter 199 set to 7911
;------------------------------------------------------------------------------
IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
IF #4120 == #90014 THEN GOTO 1000 ;Skip macro if already at position
N100 ;Insert your code between N100 and N1000
IF worklight==set then worklight==rst
else worklight==set
If Aux11LED==set then Aux11LED==rst
else AuxLED==set
N1000 ;End of Macro
Does a macro only run once when the Aux11 button is pushed? Or is this where a one shot should be used?