Title: Question about G04 P0 and serial out default values (#109) [Print This Page] Author: JPoepsel Time: 2018-11-19 20:32 Title: Question about G04 P0 and serial out default values (#109) Hi ytliu!
Hope you can help me.
Aa far as I understand DDCSV uses “G04 P0” to switch off buffer look-ahead (as well as M0) and a rescanning of the G-Code from the current position. This may be needed in macros, which use the #1000… serial input values, which may have changed since the last G-code scan. BUT: this G-code rescanning may be a bit slow when used often or having “long” programs. Is there another way to prevent G-code lines from look ahead like using a “G103 P1” “G103” block or even adding a “/” before the line of interest, like the HAAS machines do?
Second question: You wrote, that parameter #109 is used to set the default values for serial output (#1031…). This is not completely true. This value is not only used during startup but also, when no G-Code is running. So, if you use them in a program and the program ends, the values will be reset to the values defined in #109. This is not “nice”, since changes done during a macro only persist as long as the program runs. Of course I can do some “tricks” to expand the “live time” of that values in the receiving device (e.g. coding some escape sequences which trigger a storage of the current values there), but I think a better way would be to be able to define, how long the #109 values should be valid: “when no G code is running” or “until changed”. May be, you can add a new parameter #110, which defines this behavior..
Kind regards
Josef Author: ytliu Time: 2018-11-20 17:00
This installation package implements your second requirement.
For the first point you said, I think G04P0 and G103 are a meaning. When the parser encounters the G04P0 instruction, it will prevent prevent G-code lines from look ahead. After all the previous instructions have been run, the parser will continue to work.
Author: JPoepsel Time: 2018-11-20 17:23
>This installation package implements your second requirement.
I love you ;-)
About the look ahead:
> After all the previous instructions have been run
I don't understand this. When is look ahead switched on again after a G04P0 found? At the end of a loop, end of a macro, or a second G04P0? Author: ytliu Time: 2018-11-20 17:53
Since G-code parsing and execution are handled in different processes, in order to correctly acquire certain macro variables, such as mechanical coordinate positions or serial input IO data, the G04P0 instruction must be added before reading, otherwise the value read is parsed. The value of the time, not the value after the execution.Author: JPoepsel Time: 2018-11-20 18:26
Yes, I know. And if parsing starts again for the whole file, there is no reason to "switch the G04P0 instruction on and off". Switching it "off" makes only sense, if only parts of the (already parsed) Code is replaced by a newly parsed part. So I assume, that DDCSV always starts a complete reparsing after a G04P0 instruction.
BTW: A big thank you from my side for your work. I think, this kind of support results in much better advertising for your products than the niceses images of some marketing people will ;-) Author: ytliu Time: 2018-11-20 18:59
After the G04P0 instruction is encountered, the entire file is not re-parsed, but the subsequent G-code is parsed.Author: JPoepsel Time: 2018-11-20 19:38
Where "subsequent" is "logical" based, not file based. Correct?
(E.g .if G04P0 is coded in a macro at the end of the input file, but this macro is used at the beginning, the file is rescanned from the beginning, right?)Author: ytliu Time: 2018-11-21 06:39
No, it is file based, so in order to get the current value of the macro, you need to add G04P0 before it, otherwise the value of the macro may be wrong.Author: sahg Time: 2024-6-28 13:24
nice.