franke Master Poster
Joined: 26 Jun 2004 Posts: 161 Location: Indiana, USA
|
Posted: Fri Jul 02, 2004 11:58 am Post subject: How To Debug A Macro Using DPRNT |
|
|
Sometimes debugging a large macro program can be difficult. You're trying to look at the program screen, position data and see what value your variables are set to all at the same time. I use this small macro to dynamically output the value of variables to a computer connected to the machine tool. If you use a terminal program like Windows terminal you can see the data as it is received.
To use this macro put an G65P626 in the program you're debugging anywhere you want to check the value of variables. Of course you will need to modify the macro to output the variables you are interested in but you get the idea!
Code: |
%
O626
POPEN
DPRNT [V154**#154[24]***V156**#156[24]***V158**#158[24]]
DPRNT [V160**#160[24]***V162**#162[24]***V164**#164[24]]
DPRNT [V168**#168[24]***V170**#170[24]***V172**#172[24]]
DPRNT [V174**#174[24]***V176**#176[24]***V178**#178[24]]
DPRNT [V180**#180[24]***V182**#182[24]***V154**#184[24]]
DPRNT [V186**#186[24]***V188**#188[24]***V190**#190[24]]]
DPRNT [G54*X**#5221[24]***G54**Y**#5222[24]***G54*Z**#5223[24]]
DPRNT [G55*X**#5241[24]***G55**Y**#5242[24]***G55*Z**#5243[24]]
DPRNT [G56*X**#5261[24]***G56**Y**#5262[24]***G56*Z**#5263[24]]
DPRNT [G57*X**#5281[24]***G57**Y**#5282[24]***G57*Z**#5283[24]]
DPRNT [G58*X**#5301[24]***G58**Y**#5302[24]***G58*Z**#5303[24]]
PCLOS
M99
% |
In this example,
DPRNT [V154**#154[24]***V156**#156[24]***V158**#158[24]],
the value of variable #154 is output with 2 places before the decimal and four after. V154 is output before the value of #154 for readability.
In this example,
DPRNT [G54*X**#5221[24]***G54**Y**#5222[24]***G54*Z**#5223[24]],
the value of G54 X is output with 2 places before the decimal and four after. G54 X is output before the value for readability.
Here is a sample of the output from the macro:
Code: |
%
V154 0.4060 V156 0.1051 V158 0.0272
V160 0.4800 V162 0.1015 V164 2.0235
V168 71.4336 V170 6.3552 V172 46.4336
V174 -5.2954 V176 3.5138 V178 0.5109
V180 1.8244 V182 73.1520 V154 6.2947
V186 48.1520 V188 3.5138 V190 0.0000
G54 X -12.9893 G54 Y -8.0718 G54 Z -16.9907
G55 X -12.9893 G55 Y -13.3672 G55 Z -19.1225
G56 X -12.4784 G56 Y -13.3672 G56 Z -19.1225
G57 X -12.9755 G57 Y -13.3672 G57 Z -19.1225
G58 X -13.5002 G58 Y -13.3672 G58 Z -19.1225
% |
If you have any additional thoughts share them here in this thread so that all can benifit |
|