On a Fanuc (and some other controls) its called DPRNT. Works like this...
In the program...
POPEN; (opens the port)
DPRNT[#510[24]]; (outputs #510 variable)
DPRNT[#109[14]]; (outputs #109 variable)
DPRNT[#7301[24]]; (outputs offset G54.1 P16 X)
PCLOS; (closes the port)
The number after the variable is how the decimal gets outputed. The first digit being before the decimal, the second digit being after the decimal. Some controls you can even output characters with it to identify the data.
POPEN; (opens the port)
DPRNT[A#510[24]]; (outputs #510 variable)
DPRNT[B#109[14]]; (outputs #109 variable)
DPRNT[P16X#7301[24]]; (outputs offset G54.1 P16 X)
PCLOS; (closes the port)
The next trick is that you need a PC thats ready to receive the data and not timeout. Or a DNC system that can receive the trigger and save the file without user control, or a printer that can capture the data as it comes out.
Theres also another one called BPRNT. I don't ever use this one though since I don't have a need to output hex or binary data (like machine parameters and such). You can also string the outputs as well in the program. I prefer to write it seperately though, makes it easier to read in the program and output.