The DPRNT command of custom macro B allows you to send text information from the machine through the serial communications port. This is the same port used to send and receive CNC programs, offset data and parameters.
Understanding the Format of DPRNT
With the DPRNT command, the text can include your own fixed wording (messages) as well as the current values for any local, common or system variable data. Any value you can access within custom macro (such as offset and position data) can be sent through the serial port. Here is an example of the DPRNT command:
POPEN (Open the communications port)
DPRNT[G90*G10*L2*P#4[10]*X#24[34]*Y#25[34]*Z#26[34]*B#2[43]]
PCLOSE (Closes the communications port)
Prior to the first DPRNT command, the communications port must be opened with the POPEN command. (Notice that the communications port is closed with the PCLOSE command.)
The example DPRNT command requires further explanation. First, the entire text message to be sent must be enclosed in brackets ([]). Text characters will be sent as entered, with the asterisk (*) being used to specify a space character. For example, consider the following DPRNT command, which is a portion of the previous example:
DPRNT[G90*G10*L2]
This DPRNT command will output the text:
G90 G10 L2
Note the spaces between the CNC words. Again, they are caused by the asterisks.
The decimal format for any variable value must be designated right after the variable. After the first variable (#4), for example, notice the [10]. The first value (1) specifies how many decimal places will be sent before the decimal point (1 in our case) and the second value (0) specifies how many decimal places will be sent after the decimal point (0 in our case). If the current value of #4 is 7, the actual characters sent by this DPRNT command will be 7. (So this format provides the ability to output whole numbers.) The [34] format sends three places before and four places after the decimal point.
With #4 currently 7.0, #24 currently -12.0237, #25 currently -10.227, Z currently -13.01 and B currently 0, the previous DPRNT command will send this text:
G90 G10 L2 P7. X-012.0237 Y-010.2270 Z-013.0100 B000.0000
Creating Offset Retrieving Programs
One great application for the DPRNT command is to create a program that includes a snapshot of current offset settings. With a series of system variables, you can access the current value of any offset. This includes tool length, cutter radius compensation offsets, and fixture offsets for machining centers. For turning centers, you can access values for wear and geometry offsets as well as those for tool nose radius compensation offsets. This is helpful for repeated setups when you’d like to create a program that will reset the offsets to their current values at some future date.
Spindle Probe Findings
Spindle probes can measure most things. Once the probe has taken a measurement, you can use the DPRNT command to send the measured value to you statistical process control system.
Machine Position Data
Any data you can determine with custom macro B, you can send out as text data through the communications port. Once in a given position, you can send the current values for #5001, #5002 and #5003 (current absolute position in X, Y and Z respectively) to the communications port.