On Sunday 03 March 2019 04:28:31 andy pugh wrote: > On Sun, 3 Mar 2019 at 01:03, Gene Heskett <[email protected]> wrote: > > so how do I move the motion.analog-out-01 FP variable to a global > > variable for later use in my gcode? Even if its only 1 line later... > > Do you really mean analog-OUT? The analog-out HAL pins are controlled > by M68, copying a value from a G-code variable to a HAL pin. > So, your "M68 E1 Q#<_off_angle>" sets motion.analog-out-01 to be equal > to the value of your G-code variable #<_off_angle> so that you can use > that value in HAL. > > So, can you explain if the FP value in question is calculated in > G-code and sent to HAL, or comes from HAL and you want it in the > G-code? Sent to hal using the M68 E# Q#variable. This according to the docs is availabe instantly at motion.analog-out-0#, so this is not a startup only thing. But its sent from a subroutine called by some gui buttons. But the variable its intended to modify in the main code doesn't exist if the main program has not been executed, so I need a way to move that fp value to the gcode for use in a G10 L2 P0 r#variable statement as the main program starts up. I can see that fp value with a halmeter, at motion.analog-out-0#, so why can't I then assign it to a gcode variable? > Your " #<_angle> = motion.analog-out-01" is just completely wrong, you > can't insert HAL labels in G-code like that. There _is_ a way to read > HAL pins in G-code but you get the values at program-start, not the > live value while the program is running.
This is live while lcnc is running. Data generated by clicking on the alignX pyvcp button after recording the initial locations vars with align-start. This problem has resulted in the align kit I sent you already being obsolete. > And there is no point reading the value of the motion.analog-out pins > as they only ever have values that are already in the G-code. But that gcode that sets it is in a subroutine, part of the axis gui, completely independent of the gcode in the main program, and apparently cannot create a globally defined var from that subroutine for use in the main program. Or maybe it can but if the subroutine hasn't been invoked, then the main program exits on loading because that var does not exist. BTDT. I've got to make it immune to chicken v egg problems. Or, if I can create and set it in the subroutine, maybe a main program conditional test based on EXISTS might be a way around it? Not been tried yet. Thanks Andy. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
