13 AUXILIARY FUNCTIONS FOR PROGRAMMING
13-10-7 External output commands (Output via RS-232C)
1. Overview
In addition to standard user macros, the types of macros listed below are provided as external
output commands. These external output macros can be used to output character data or the
numerical data in variables to an external unit via an RS-232C interface. The data are outputted
in a data length of 7 bits with an even-parity bit added.
A. Types and functions of external output macros
POPEN Setup processing for data output
PCLOS Termination processing of data output
BPRNT Printout of character data or binary printout of variable data
DPRNT Printout of character data or numerical printout of variable data on a digit-by-digit
basis
B. Programming order
POPEN Open command
BPRNT DPRNT Data output commands
PCLOS Close command
2. Open command POPEN
Programming format: POPEN
Detailed description
- The command code POPEN must be included before a series of data output command codes.
- The control code for DC2 and the percentage code % are output from the NC unit to an
external output unit.
- Once POPEN has been set, it will remain valid until PCLOS is set.
3. Close command PCLOS
Programming format: PCLOS
Detailed description
- The command code PCLOS must be included after all data output command codes.
- The control code for DC4 and the percentage code % are output from the NC unit to an
external output unit.
- This command must be used together with POPEN. This command code must be included only
after POPEN.
- This command must be set at the end of the program even after data output has been aborted
using, for example, the NC reset switch.
13-82
AUXILIARY FUNCTIONS FOR PROGRAMMING 13
4. Data output command BPRNT
Programming format:
BPRNT[1#v1[c1]2#v2[c2]]
Effective digits after decimal point Variable value
c
Variable number × 10
Character string
Detailed description
- The command BPRNT can be used to output characters or to output variable data in binary
form.
- The designated character string is output directly in the ISO coded format. Alphanumerics (A to
Z, and 0 to 9) and/or special characters (+, –, , /) can be used. Of these characters, only the
asterisk () is output as a space code.
- Since all variables are saved as those having a decimal point, the necessary number of
decimal digits must be enclosed in brackets ([ ]).
All variables are handled as data of four bytes (32 bits), and each byte is output as binary data
in the order of the most significant byte first. Minus data is processed as the complement for
that data.
Example 1: If three digits are specified for 12.3456, then
[12.346 × 103] = 12346 (0000303A)
will be output as binary data.
Example 2: If no digits are specified for –100.0, then
–100 (FFFFFF9C)
will be output as binary data.
- After the specified data has been output, the EOB (End Of Block) code is output in the format of
the appropriate ISO code.
- Variables containing <empty> are interpreted as 0s.
5. Data output command DPRNT
Programming format:
DPRNT[1#v1[d1 c1]2#v2[c2]]
Effective digits below decimal point
Effective digits above decimal point c+d8
Variable number
Character string
Detailed description
- Output of character data or decimal output of variable data is performed in the format of ISO
codes.
- The designated character string is output directly in the ISO coded format.
Alphanumerics (A to Z, and 0 to 9) and/or special characters (+, –, , /) can be used. Of these
characters, only the asterisk () is output as a space code.
- Of the data contained in a variable, the necessary number of digits above the decimal point and
that of digits below the decimal point must each be enclosed in brackets ([ ]). The variable
data will then have its total specified number of digits, including the decimal point, output in the
ISO coded format in the order of the most significant digit first. No trailing zeros will be left out in
that case.
13-83
13 AUXILIARY FUNCTIONS FOR PROGRAMMING
13-10-8 External output command (Output onto the hard disk)
1. Overview
External output macros can also be used to output data in text file format into the predetermined
directory on the hard disk.
2. Related parameters
- DPR14: Selection of an output destination port
Set DPR14 to “4” (Output onto the hard disk) in the PARAM. window provided for data
input/output operation.
- DPR15: Number of lines in feed section
Set the required number of lines to be fed.
- DPR8: Output file size
Use this parameter to specify the maximum permissible output file size.
Maximum permissible file size: DPR8 × 100 (KB)
A command for outputting a greater file will cause a corresponding alarm.
However, the file size limit is 100 KB if the value in DPR8 is 0.
Note: Output of a file of smaller size than the limit, however, may not be possible due to a
shortage of available area on the hard disk.
The PARAM. window (used to set extended parameters for data communication) can be called
up from the menu bar on the DATA I/O display.
See the Parameter List for details of the parameters.
3. Output file
The text file will be automatically outputted with a particular file name into the predetermined
directory.
Output directory: c:\MC_sdg\print\
Output file name print.txt
(A file of this name will be automatically created, if required, or the text data
will be added to the current contents of the file.)
13-84
AUXILIARY FUNCTIONS FOR PROGRAMMING 13
File contents:
Given below on the right is an example of text file contents created by the execution of the
program shown on the left under the particular parameter settings.
[Program] [Output example]
print.txt
G28XYZ
POPEN %
DPRNT[OOOOOOOOOOOO] OOOOOOOOOOOO
DPRNT[XXXXXXXXXXXX] XXXXXXXXXXXX
DPRNT[IIIIIIIIIIII] IIIIIIIIIIII
PCLOS %
G0X100.Y100.Z100.
M30
[Parameter]
DPR14: 4
DPR15: No setting
4. Related alarms
The alarm given for text file output is described below.
No. Message Argument 1 Argument 2 Argument 3
887 TAPE I/O ERROR –100 File open error 0 0
–111 File write error 0 0
–112 File size too great 0 0
13-85