0i-D - C Language Executor
0i-D - C Language Executor
C Language Executor
PROGRAMMING MANUAL
B-64303EN-3/01
• No part of this manual may be reproduced in any form.
• All specifications and designs are subject to change without notice.
The products in this manual are controlled based on Japan’s “Foreign Exchange and
Foreign Trade Law”. The export from Japan may be subject to an export license by the
government of Japan.
Further, re-export to another country may be subject to the license of the government of
the country from where the product is re-exported. Furthermore, the product may also be
controlled by re-export regulations of the United States government.
Should you wish to export or re-export these products, please contact FANUC for advice.
In this manual we have tried as much as possible to describe all the various matters.
However, we cannot describe all the matters which must not be done, or which cannot be
done, because there are so many possibilities.
Therefore, matters which are not especially described as possible in this manual should be
regarded as ”impossible”.
This manual contains the program names or device names of other companies, some of
which are registered trademarks of respective owners. However, these names are not
followed by or in the main body.
B-64303EN-3/01 DEFINITION OF WARNING, CAUTION, AND NOTE
WARNING
Applied when there is a danger of the user being
injured or when there is a danger of both the user
being injured and the equipment being damaged if
the approved procedure is not observed.
CAUTION
Applied when there is a danger of the equipment
being damaged, if the approved procedure is not
observed.
NOTE
The Note is used to indicate supplementary
information other than Warning and Caution.
s-1
B-64303EN-3/01 PREFACE
PREFACE
This manual consists of the following chapters.
APPENDIX
Describes the procedure for checking a system alarm that occurs
in a C Language Executor application, additional information
about installation of the C compiler, and character codes.
Applicable models
The models covered by this manual, and their abbreviations are :
NOTE
Some functions described in this manual may not
be applied to some products.
For details, refer to the DESCRIPTIONS
(B-64302EN).
p-1
PREFACE B-64303EN-3/01
p-2
B-64303EN-3/01 TABLE OF CONTENTS
TABLE OF CONTENTS
DEFINITION OF WARNING, CAUTION, AND NOTE .................................s-1
PREFACE ....................................................................................................p-1
I. SPECIFICATION
1 Overview................................................................................................. 3
1.1 Feature .......................................................................................................... 4
2 System components.............................................................................. 6
2.1 C Language Executor .................................................................................... 7
2.2 C Language Library ....................................................................................... 8
2.3 Application program....................................................................................... 9
2.4 The hardwares of CNC which are used in C Language Executor................ 12
3 Application program development environment .............................. 14
3.1 Composition of development system ........................................................... 15
3.2 Development procedure .............................................................................. 17
4 C Language Library function list........................................................ 19
4.1 ANSI C standard library ............................................................................... 19
4.2 MS-C extended C standard library............................................................... 21
4.3 Graphic library ............................................................................................. 22
4.4 CNC/PMC window library ............................................................................ 24
4.5 Other libraries .............................................................................................. 30
II. PROGRAMMING
1 List of Functions.................................................................................. 37
1.1 ANSI C Standard library .............................................................................. 38
1.2 MS-C extended C standard library............................................................... 42
1.3 Graphic library ............................................................................................. 47
1.4 CNC/PMC window library ............................................................................ 50
1.5 Other libraries .............................................................................................. 56
1.6 Japanese(Multi-byte character) functions .................................................... 61
2 How to make application program ..................................................... 62
2.1 Wind River Compiler C/C++ installation....................................................... 63
2.2 Overview of installing the C Language Library and creating an application
program ....................................................................................................... 63
2.3 Special files.................................................................................................. 64
2.4 Variables of type 'int'.................................................................................... 64
2.5 Using compiler libraries ............................................................................... 65
2.6 Describing 2-byte characters in source-codes ............................................. 65
2.7 Remarks ...................................................................................................... 66
c-1
TABLE OF CONTENTS B-64303EN-3/01
c-2
B-64303EN-3/01 TABLE OF CONTENTS
c-3
TABLE OF CONTENTS B-64303EN-3/01
c-4
B-64303EN-3/01 TABLE OF CONTENTS
APPENDIX
A Troubleshooting If a System Alarm Occurs in the C Language
Executor Application Program ....................................................... 1249
B Additional Information on C Compiler Installation ....................... 1256
B.1 Installing the C compiler .......................................................................... 1257
B.2 Installing the linker ................................................................................... 1263
B.3 Installing the C Language Library ............................................................ 1263
B.4 Obtaining and installing other tools.......................................................... 1264
B.5 Customization procedure......................................................................... 1265
C Character Code List......................................................................... 1281
C.1 Half-size character code list (for 8.4-inch color LCD)............................... 1282
C.2 Half-size character code list (for 10.4-inch color LCD)............................. 1288
C.3 FANUC character code list (for 8.4-inch color LCD) ................................ 1293
C.4 FANUC character code list (for 10.4-inch color LCD) .............................. 1302
D Simplified Chinese Character Code List ....................................... 1310
E Russian (Cyrillic) Character Code List .......................................... 1335
F Turkish Character Code List........................................................... 1336
c-5
I. SPECIFICATION
B-64303EN-3/01 SPECIFICATION 1.Overview
1 Overview
FANUC Series 0i –D C Language Executor enables to add the Machine Tool Builder's original screen
into FANUC Series 0i-D and to customize screen displaying and operation interface of CNC software.
It is possible to replace arbitrary screens of CNC with user application's screen.
The user application program about screen displaying and operation interface is developed using
general C language just like ordinary PC's application program developing.
The executable file which is developed by the Machine Tool Builder is built in CNC unit.
The user program which is compiled on PC is stored in flash ROM of CNC unit, and it is read into
CNC's memory by CNC's start-up procedure,then,executed on C Language Executor.
Series 0i-D
PC
Application program is stored
in flash ROM. Application C Language CNC
program Library Software
Memory
Card
(LCD/MDI unit)
-3-
1.Overview SPECIFICATION B-64303EN-3/01
1.1 Feature
No additional hardware is required to use C Language Executor and application program on FANUC
Series 0i-D (*). The user application program can be built in your Series 0i-D as it is.
Function libraries of C language which are provided by C Language Executor has compatibility
with ANSI and MS-C.
Therefore, ordinary application programs on PC can be translated to CNC's as long as they don't
depend on specific hardware.
The application program which is developed by the Machine Tool Builder is executed as a task
in CNC softwares.
Some arbitrary screens of existing CNC screens can be replaced with user screens which are
displayed by the user application program.
Application program can read or write various CNC data via libraries which are provided by C
Language Executor.
Therefore, the user application program works as a part of CNC software.
Additionally, it is possible not only to replace existing CNC screens, but also to add new user's
screens.
Graphic display function, which has 640 × 480 resolution and 256color/pixel,is used in
application program.
This graphic screen is imposed on character screen.
For graphic display, MS-C compatible graphic functions, such as line, rectangle and arc drawing,
painting, etc.,are provided.
Communication with personal computer,etc. is available using reader/puncher interface(RS-232C)
on CNC unit.
Communication driver is built in the C Language Library, therefore, communication is processed
by just calling communication functions.
The user application program can read from or write to FANUC FLOPPY CASSETTE ADAPTER and FANUC
HANDY FILE connected to CNC unit.
-4-
B-64303EN-3/01 SPECIFICATION 1.Overview
C Language Executor can be used with Macro Executor(Execution Macro and also Conversational
Macro) of Series 0i-D.
The screen displaying part of macro program which has been developed by the Machine Tool Builder
can be replaced with C program, therefore, existing software property does not become useless.
(C Language Executor doesn't have Execution Macro function.)
C Language Executor can be used with MANUAL GUIDE i or TURN MATE i for the Series 0i-D. When
using C Language Executor with MANUAL GUIDE i or TURN MATE i, however, there are some restrictions
(part of sources need to be modified). For details, see Section 5.8 "Use with MANUAL GUIDE i"
and Section 5.9 "Use with TURN MATE i" later in Part II.
The application program which is developed by the Machine Tool Builder is installed to CNC
unit using memory card (JEIDA/PCMCIA compatible SRAM card or ATA flash memory card).
It is easy to install and update the application program because it isn't need to write EPROM
using ROM-writer.
C Language Executor supports hardwares such as touch-panel and input/output via memory card.
These I/O devices are good for building better user interface.
(11) Simultaneous displaying of CNC and user screen using window display
The application program can display user window on the arbitrary screens including the CNC
screens using window display function (VGA window).
It is possible to display Machine Tool Builder's original message window or the software machine
operation panel on the existing CNC screen.
-5-
2.System components SPECIFICATION B-64303EN-3/01
2 System components
The system components that C Language Executor and the user application program are shown below.
*3
Application
CNC window
program
CNC software *1
C Language Executor
*4 C Language Library
*2
-6-
B-64303EN-3/01 SPECIFICATION 2.System components
C Language Executor loads the application program and C Language Library from flash ROM into
DRAM in startup procedure of CNC unit, and starts executing the application program.
C Language Executor manages the user application's background task in addition to switching
process by screen switching.
-7-
2.System components SPECIFICATION B-64303EN-3/01
C Language Library executes input/output operations, which are called by the application
program, such as character displaying to screen by "printf" function, reading MDI key by "getch"
function, graphic displaying by MS-C compatible function and input/output via reader/puncher
interface etc.
(2) Input/output CNC information (current position, parameter and tool offset, etc.)
C Language Library provides input/output function of various CNC information using CNC window
function, and also PMC information using PMC window.
C Language Library provides ANSI compatible C language standard library (there are some
exceptions) and MS-C extended C language standard library which doesn't depend on specific
hardware and operating system.
C Language Library provides MS-DOS compatible file system. The application program can access
SRAM disk (max 63KB) on nonvolatile memory (SRAM) or memory card (PC card) via this file system.
It is possible to read or write files using functions such as "fopen", "fprintf", "fgets", etc.
in application program.
-8-
B-64303EN-3/01 SPECIFICATION 2.System components
APPLICATION PROGRAM
(A)MAIN TASK
AUXILIARY TASK
(D)WINDOW TASK
-9-
2.System components SPECIFICATION B-64303EN-3/01
ALARM TASK and COMMUNICATION TASK are called AUXILIARY TASK.(Also called BACKGROUND TASK
because these tasks are executed in background of MAIN TASK) AUXILIARY TASKS are limited in their
function.
COMMUNICATION
MAIN TASK ALARM TASK
TASK
Standard function ○ ○ ○
Key input ○ × ×
Character display ○ × ×
Graphic display ○ × ×
File I/O ○ ○(*1) ○(*1)
CNC/PMC window ○ ○(*2) ×
Reader/puncher interface ○ ○(*3) ○(*3)
Reading F-ROM ○ ○(*3) ○(*3)
Reading touch-panel ○ ○ ○
○ means "available, × means "not available
(*1) The same file cannot be accessed by two or more tasks simultaneously.
It is necessary to control exclusively in application program.
(*2) Simultaneous access with MAIN TASK causes BUSY ERROR.
(*3) It is necessary to control communication port and F-ROM reading exclusively by the
application program itself.
Task switching between MAIN TASK and AUXILIARY TASK is done by calling task control library
function in application program.
Periodically starting of AUXILIARY TASK is also commanded in application program.
It is possible to compose application program with only one task.
In this case, only MAIN TASK is used.
Additionally, the window task is available in addition to the above tree tasks.
The window task runs simultaneously with above tree tasks and is used to display windows on
arbitrary screen.
The following functions are available in the window task.
HIGH-LEVEL
WINDOW TASK
TASK
Standard function ○ ○(*3)
Key input × ×
Character display ○(*1) ×
Graphic display ○(*1) ×
File I/O × ×
CNC/PMC window ○(*2) ○(*3)
Reader/puncher interface × ×
Reading F-ROM × ×
Reading touch-panel ○ ×
- 10 -
B-64303EN-3/01 SPECIFICATION 2.System components
(*1) The destination of the output of the display becomes not normal window but VGA window.
(*2) Exclusive control might be necessary with other tasks.
(*3) There is a function that cannot be used.
For example, the program which consists of only Main task has following structures.
main function
Initialization
Read CNC information and Read numeric value from MDI ‥‥‥
display them on screen key and update data
- 11 -
2.System components SPECIFICATION B-64303EN-3/01
- 12 -
B-64303EN-3/01 SPECIFICATION 2.System components
"KB" means "kilo bytes" (1024 bytes),"MB" means "mega bytes" (1024 kilo bytes)
(*1) Usable memory capacity of Macro Executor is ((custom soft capacity) - (C Language
Executor DRAM capacity))
(*2) These display devices are VGA graphic devices."16-color" or "256-color" means number
of color palettes which can be simultaneously displayed on the screen. The
application program can map the arbitrary color from 4096 colors into each color
palette.
(*3) 19-line in a screen is also available.
(*4) 30-line in a screen is also available.
(*5) It is also possible to set 256-color display.
(*6) This is available on VGA display device.
- 13 -
3. Application program
development environment SPECIFICATION B-64303EN-3/01
- General PC(personal computer) is used to develop (edit and compile) application program.
- Only execution of application program is possible on CNC unit.
- Debugging of application program is worked on both PC and CNC. Some parts of application program
which can work on PC can be debugged on PC as ordinary PC's software.
Whole program is debugged on CNC.
- 14 -
3. Application program
B-64303EN-3/01 SPECIFICATION development environment
MEMORY CARD
PCMCIA Rel.1.0,JEIDA V4.0 compatible
READER/WRITER
MEMORY CARD
1MB or more capacity
(Required capacity depends on application program)
COMMERCIAL
・Microsoft Windows XP Home Edition
SOFTWARE
Microsoft Windows XP Professional
Microsoft Windows 2000 or Microsoft Windows 98
・Text editor(arbitrary)
・Wind River Compiler C/C++
(*) You can use a FANUC-recommended memory card, or a flash ATA card or CompactFlash card purchased
from FANUC, as the above memory card.
FANUC
C LANGUAGE
LIBRARY ・ANSI compatible C standard library
・MS-C compatible library
・CNC window library
- 15 -
3. Application program
development environment SPECIFICATION B-64303EN-3/01
MEM
(LINK)
FANUC C Language
Library
personal computer
MEMORY CARD
FANUC Series 0i-D
CNC hardware
- 16 -
3. Application program
B-64303EN-3/01 SPECIFICATION development environment
SPECIFICATION
DESIGN
FUNCTION
DESIGN
PROGRAMIMIG
CODING, EDITING
working on PC
COMPILING,
LINKING
DEBUGGING
working on CNC
TESTING
(2) Testing on PC
Source level debugging of application program on PC can be done by using compiler for PC.
Function module level testing can be completed even if there are some difference between PC and
C Language Executor.
- 17 -
3. Application program
development environment SPECIFICATION B-64303EN-3/01
After module level testing on PC, you develop entire application with FANUC library.
If any error occurred in this step, you confirm usage of C Language Library.
You use MAKEFILE which is provided from FANUC to compile, link and make memory card file.
You write application program to flash ROM on CNC via memory card.
- 18 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
(1) Diagnostics
assert
setjmp longjmp
(5) Input/output
- 19 -
4.C Language Library function list SPECIFICATION B-64303EN-3/01
(9) Mathematics
- 20 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
- 21 -
4.C Language Library function list SPECIFICATION B-64303EN-3/01
- 22 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
NAME FUCNTION
gr_displaychar Draw a standard size character
gr_displayfourlarge Draw a quad size character
gr_displaysixlarge Draw a hex size character
_putpattern Put monochrome image data
_getpattern Get monochrome image data
gr_dispstr Draw a standard size string
gr_disp6str Draw a hex size strings
gr_bitblt Copy image data
gr_disp4str Draw a quad size string.
gr_displaysmlchar Draw a small size character.
gr_dispsstr Draw a small size string.
gr_displayfchar Draw a FANUC character.
gr_dispfstr Draw a FANUC character string.
gr_disp9ifchar Draw 9-inch font character.
gr_disp9ifstr Draw 9-inch font character string.
mmc_line_b Draw a line between specified two points.
mmc_polyline Draw a polyline.
mmc_circle_b Draw a circle.
mmc_ellipse_b Draw an ellipse.
mmc_pie_b Draw a pie figure.
mmc_arc_b Draw an arc.
mmc_gettext Get character in the specified area.
mmc_puttext Put character data on memory to text screen.
mmc_textsize Get required byte size for getting character.
- 23 -
4.C Language Library function list SPECIFICATION B-64303EN-3/01
The following functions which are used to input/output data between CNC/PMC are provided.
NAME FUCNTION
cnc_sysinfo Read CNC system information
cnc_dwnstart Start output of NC program to be registered
cnc_download Output NC program to be registered
cnc_dwnend Stop output NC program to be registered
cnc_vrfstart Start output NC program to be compared
cnc_verify Output NC program to be compared
cnc_vrfend Stop output NC program to be compared
cnc_upstart Start input NC program
cnc_upload Input NC program
cnc_upend Stop input NC program
cnc_search Search specified program
cnc_delall Delete all program
cnc_delete Delete specified program
cnc_rdprogdir Read program directory
cnc_rdproginfo Read program information
cnc_rdprgnum Read program number in executing
cnc_rdseqnum Read sequence number in executing
cnc_actf Read actual feed rate of controlled axes
cnc_acts Read actual spindle speed
cnc_absolute Read absolute position
cnc_machine Read machine position
cnc_relative Read relative position
cnc_distance Read distance to go
cnc_skip Read skipped position
cnc_srvdelay Read servo delay amount
cnc_accdecdly Read acceleration/deceleration delay amount
cnc_rddynamic Read dynamic data
cnc_statinfo Read CNC status information
cnc_alarm Read alarm status
cnc_rdalminfo Read alarm information
cnc_rdtofs Read tool offset amount
cnc_wrtofs Write tool offset amount
cnc_rdtofsr Read tool offset amount (range specified)
cnc_wrtofsr Write tool offset amount (range specified)
cnc_rdzofs Read work zero offset
cnc_wrzofs Write work zero offset
- 24 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
NAME FUCNTION
cnc_rdzofsr Read work zero offset (range specified)
cnc_wrzofsr Write work zero offset (range specified)
cnc_rdparam Read parameter
cnc_wrparam Write parameter
cnc_rdparar Read parameters (range specified)
cnc_wrparas Write parameters (multiple output)
cnc_rdset Read setting parameter
cnc_wrset Write setting parameter
cnc_rdsetr Read setting parameters (range specified)
cnc_wrsets Write setting parameters (multiple output)
cnc_rdpitchr Read pitch error compensation data (range specified)
cnc_wrpitchr Write pitch error compensation data (range specified)
cnc_rdmacro Read custom macro variable
cnc_wrmacro Write custom macro variable
cnc_rdmacror Read custom macro variables (range specified)
cnc_wrmacror Write custom macro variables (range specified)
cnc_rdpmacro Read P-code macro variable
cnc_wrpmacro Write P-code macro variable
cnc_rdpmacror Read P-code macro variables (range specified)
cnc_wrpmacror Write P-code macro variables (range specified)
cnc_diagnoss Read diagnostics data
cnc_diagnosr Read diagnostics data (range specified)
cnc_adcnv Read A/D conversion data
cnc_rdopmsg Read operator's message
cnc_setpath Set path index (2-path system (T series))
cnc_getpath Get path index (2-path system (T series))
cnc_settimer Set calendar timer of CNC
cnc_rdspload Read load information of serial spindle
cnc_rdexecprog Read executing program
cnc_rdmovrlap Read manual overlapped motion value
cnc_getfigure Read the maximum number of significant figures and the number of decimal places
cnc_rdtofsinfo Read tool offset information
cnc_seqsrch Search for sequence number
cnc_wrrelpos Clear or preset relative position of controlled axis
cnc_acts2 Read actual spindle speed (S) (multiple spindles allowed, read of specified axis)
cnc_rdwkcdshft Read workpiece coordinate system shift
cnc_wrwkcdshft Write workpiece coordinate system shift
cnc_rdpdf_drive Read program storage drive information
cnc_rdpdf_inf Read program storage file information
cnc_rdpdf_curdir Read current directory information
cnc_wrpdf_curdir Set current directory
cnc_rdpdf_subdir Read subdirectory information
- 25 -
4.C Language Library function list SPECIFICATION B-64303EN-3/01
NAME FUCNTION
cnc_rdpdf_alldir Read file list information
cnc_pdf_add Create directory or file
cnc_pdf_del Delete directory or file
cnc_pdf_rename Rename directory or file
cnc_pdf_slctmain Select main program
cnc_pdf_cond Consolidate programs
cnc_wrpdf_attr Change attribute of directory or file
cnc_rdpdf_subdirn Get the number of directories and files in specified directory
cnc_pdf_rdmain Get main program information
cnc_information Get CNC information
cnc_rdsyssoft3 Read series and edition of CNC system software (3)
cnc_dwnstart4 Start output of NC program to be registered (4)
cnc_download4 Output NC program to be registered (4)
cnc_dwnend4 Stop output of NC program to be registered (4)
cnc_upstart4 Start reading NC program (4)
cnc_upload4 Read NC program (4)
cnc_upend4 Stop reading NC program (4)
cnc_rdpitchinfo Read pitch error compensation data information
cnc_rdmacroinfo Read custom macro variable information
cnc_rdsetinfo Read setting parameter information
cnc_rddiaginfo Read diagnostics data information
Read the minimum parameter number, maximum parameter number, and total
cnc_rdparanum
number of parameters
Read the minimum setting parameter number, maximum setting parameter number,
cnc_rdsetnum
and total number of setting parameters
Read the minimum diagnostics data number, maximum diagnostics data number,
cnc_rddiagnum
and total number of diagnostics data items
cnc_rdnspdl Read the number of spindles
cnc_rdprogdir2 Read the number of spindles (2)
cnc_rdaxisname Read axis name
cnc_rdposition Read position information
cnc_rdspeed Read speed information
cnc_rdsvmeter Read servo load meter
cnc_rdspmeter Read spindle load meter
cnc_rdgcode Read modal G code
cnc_rdcommand Read command value
cnc_alarm2 Read alarm status (2)
cnc_rdopmsg2 Read operator's message (2)
cnc_rdopmsg3 Read operator's message (3)
cnc_rdspdlname Read spindle name
cnc_rdprogdir3 Read program directory (3)
cnc_rdtofsinfo2 Read tool offset information (2)
- 26 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
NAME FUCNTION
cnc_rdmacror2 Read custom macro variables (double-precision floating point)
cnc_wrmacror2 Write custom macro variables (double-precision floating point)
cnc_rdaxisdata Read controlled axis/spindle-related data
cnc_dncstart2 Start output of NC program for operation (2)
cnc_dnc2 Output NC program for operation (2)
cnc_dncend2 Stop output of NC program for operation (2)
cnc_loadtorq Read abnormal load torque data
cnc_rdsyshard Read CNC hardware configuration information
cnc_sysinfo_ex Read CNC system information (2)
cnc_machine3 Read machine position of controlled axis (3)
cnc_rdjogdrun Read jogging speed or dry run speed
cnc_rdpmacror2 Read P-code macro variables (double-precision floating point)
cnc_wrpmacror2 Write P-code macro variables (double-precision floating point)
cnc_rdalmmsg Read all alarm messages at once
cnc_rdalmmsg2 Read alarm message (extended message string)
cnc_rdprogdir4 Read program directory (4)
cnc_stopophis Stop history data sampling
cnc_startophis Resume history data sampling
cnc_rdophisno Read the number of operation history data items
cnc_rdophisno3 Read the number of operation history data items (3)
cnc_rdophistry4 Read operation history data (4)
cnc_clearophis Clear history data
cnc_rdhissgnl3 Read signal to be included in operation history (3)
cnc_wrhissgnl3 Set signal to be included in operation history (3)
cnc_rdalmhisno3 Read the number of alarm history data items (3)
cnc_rdalmhistry5 Read alarm history data (5)
cnc_rdomhisno Read the number of external operator's message history data items
cnc_rdomhistry2 Read external operator's message history data (2)
cnc_rdgrpid Read tool life management data (tool group number)
cnc_rdngrp Read tool life management data (number of tool groups)
cnc_rdntool Read tool life management data (number of tools)
cnc_rdlife Read tool life management data (tool life)
cnc_rdcount Read tool life management data (tool life counter)
cnc_rd1length Read tool life management data (tool length compensation number 1)
cnc_rd2length Read tool life management data (tool length compensation number 2)
cnc_rd1radius Read tool life management data (tool radius compensation number 1)
cnc_rd2radius Read tool life management data (tool radius compensation number 2)
cnc_t1info Read tool life management data (tool information 1)
cnc_t2info Read tool life management data (tool information 2)
cnc_toolnum Read tool life management data (tool number)
Read tool life management data (number of tools, tool life, life counter)(range
cnc_rdtoolrng
specified)
- 27 -
4.C Language Library function list SPECIFICATION B-64303EN-3/01
NAME FUCNTION
cnc_rdtoolgrp Read all tool life management data in group at once
cnc_wrcountr Write tool life management data (life counter) (range specified)
cnc_wrtoolgrp Register tool life management data (tool group)
cnc_wrlife Write tool life management data (tool life)
cnc_wrcount Write tool life management data (life counter)
cnc_wrcnttype Write tool life management data (life counter type)
cnc_wr1length Write tool life management data (tool length compensation number 1)
cnc_wr2length Write tool life management data (tool length compensation number 2)
cnc_wr1radius Write tool life management data (tool radius compensation number 1)
cnc_wr2radius Write tool life management data (tool radius compensation number 2)
cnc_wrt1info Write tool life management data (tool information 1)
cnc_wrt2info Write tool life management data (tool information 2)
cnc_wrtoolnum Write tool life management data (tool number)
cnc_rdcnttype Read tool life management data (tool life counter type)
cnc_rdusegrpid Read tool life management data (number of tool group being used or to be used)
Read tool life management data (maximum number of tool groups that can be
cnc_rdmaxgrp
registered)
Read tool life management data (maximum number of tools that can be registered
cnc_rdmaxtool
in group)
cnc_rdusetlno Read tool life management data (ordinal number of tool to be used in group)
cnc_rd1tlifedata Read tool life management data (tool data 1)
cnc_rd1tlifedat2 Read tool life management data (tool data 1) (2)
cnc_rd2tlifedata Read tool life management data (tool data 2)
cnc_wr1tlifedata Write tool life management data (tool data 1)
cnc_wr1tlifedat2 Write tool life management data (tool data 1) (2)
cnc_wr2tlifedata Write tool life management data (tool data 2)
cnc_rdgrpinfo Read tool life management data (tool group information)
cnc_rdgrpinfo4 Read tool life management data (tool group information 4)
cnc_wrgrpinfo Write tool life management data (tool group information)
cnc_deltlifegrp Delete tool life management data (tool group information)
cnc_instlifedt Add tool life management data (tool data)
cnc_deltlifedt Delete tool life management data (tool data)
cnc_clrcntinfo Clear tool life management data (life counter, tool information) (range specified)
Read tool life management data (maximum number of groups that can be
cnc_rdtlinfo registered/maximum number of tools that can be registered in group/maximum tool
life value)
cnc_rdtlgrp Read tool life management data (tool group information)
cnc_rdtltool Read tool life management data (tool information)
cnc_rdgrpid2 Read tool life management data (tool group number) (2)
cnc_rdcntover Read tool life management data (count override)
cnc_getdtailerr Get CNC error details
cnc_wrmdiprog Write MDI program
- 28 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
NAME FUCNTION
cnc_rdmdipntr Read execution pointer for MDI operation
cnc_wrmdipntr Write execution pointer for MDI operation
cnc_statinfo2 Read CNC status information (2)
cnc_rdparainfo Read parameter data information
cnc_rdpdf_line Read program on a line-by-line basis
cnc_wrpdf_line Write program on a line-by-line basis
cnc_pdf_delline Delete program on a line-by-line basis
cnc_pdf_rdactpt Get program execution pointer
cnc_pdf_wractpt Set program execution pointer
NAME FUCNTION
pmc_rdpmcrng Read arbitrary PMC data (range specified)
pmc_wrpmcrng Write arbitrary PMC data (range specified)
pmc_rdpcmsg Read PMC message
pmc_get_current_pmc_unit Get the unit type of PMC currently being operated
pmc_get_number_of_pmc Get the number of PMC paths
pmc_get_pmc_unit_types Get PMC unit types
pmc_select_pmc_unit Select PMC unit to be operated
pmc_getpmcptr Get PMC memory address information
pmc_isvalidpmcptr Validate PMC memory address information
pmc_rdpmcchar Read 1-byte signed data from PMC memory
pmc_rdpmcshort Read 2-byte signed data from PMC memory
pmc_rdpmclong Read 4-byte signed data from PMC memory
pmc_wrpmcchar Write 1-byte signed data to PMC memory
pmc_wrpmcshort Write 2-byte signed data to PMC memory
pmc_wrpmclong Write 4-byte signed data to PMC memory
pmc_rdpmcinfo Read arbitrary PMC data (range specified)
- 29 -
4.C Language Library function list SPECIFICATION B-64303EN-3/01
These functions are used to control key input from CNC's MDI panel.
NAME FUCNTION
aux_mdi_getmatrix Get MDI key matrix
aux_mdi_putmatrix Put MDI key matrix
aux_mdi_rstmatrix Reset MDI key matrix
aux_mdi_altmatrix Alter MDI key matrix
aux_mdi_putc Put one character to key input buffer
aux_mdi_write Write block data to key input buffer
aux_mdi_control Test or control key input buffer
aux_mdi_repeat Set key repeating interval time
aux_mdi_getstat Read inputting status of MDI key.
aux_mdi_clrbuf Clear input buffer of MDI key.
These functions are used to control CRT display and multiple window display.
NAME FUCNTION
crt_getcurscrn Get current screen index
crt_setuserscrn Register user screen index
crt_isnewscrn Test screen switching status
crt_gettype Set CRT information
crt_setmode Set CRT screen mode
crt_cncscrn Switch to CNC screen
crt_fchar Output character by FANUC character code
crt_setuserskey Customize softkey on CNC screen
crt_setswt Set switching method between CNC's screen and user's
crt_setscrlarea Set scroll area
crt_opengr Open graphic display
crt_closegr Close graphic display
crt_graphic Enable or disable graphic display
crt_readfkey Read the status of function keys
crt_2ndcursor Display the secondary cursor
crt_settextattr Set attribute of characters on VRAM
crt_gettextattr Get attribute of character on VRAM
crt_setpalette Set color palette of VGA characters
crt_setallpalette Set all color palette of VGA characters
crt_getcncpalette Get color palette of CNC screen
- 30 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
NAME FUCNTION
crt_fstr Output character string by FANUC character code.
crt_gettextimg Get text data from VRAM.
crt_puttextimg Put text data into VRAM.
crt_setgraphpage Select graphics page to use.
crt_set6chmode Select drawing method of 6x sized character.
win_open Open window
win_close Close window
win_select Select window
win_activate Activate window
win_move Move window
win_size Alter window size
win_full Let active window be full screen size
win_window Let active window be window size
win_info Set window information
win_col Set color of window frame and title string
win_hide Hide window
win_show Show window
win_setttl Set window title string
win_setfrm Set window frame line character
win_getstat Get window display status
win_redraw Redraw windows.
crt_reguserchar Register user character
crt_mapuch Map user character
crt_getcgpttn Get CG pattern
vwin_open Open VGA window
vwin_close Close VGA window
vwin_select Select VGA window
vwin_show Show VGA window
vwin_hide Hide VGA window
vwin_info Get VGA window information
NAME FUCNTION
aux_file_format Format specified drive
aux_file_mount Mount memory card
aux_file_unmount Unmount memory card
aux_file_memcinfo Get memory card information
- 31 -
4.C Language Library function list SPECIFICATION B-64303EN-3/01
These functions are used to communicate with peripherals via reader/puncher interface
(RS-232C).
NAME FUCNTION
rs_open Initialize communication device
rs_close Terminate communication
rs_putc Put one character to communication buffer
rs_getc Get one character from communication buffer
rs_write Write block data to communication buffer
rs_read Read block data from communication buffer
rs_buffer Test or control communication buffer
rs_status Get status of communication line and buffer
rs_wait Wait communication event
NAME FUCNTION
os_show_tim Read timer
os_set_tim Set timer
os_sync_tim Wait until specified time
os_wait_tim Wait until specified term
os_make_flg Make event flag
os_delt_flg Delete event flag
os_sign_flg Signal event flag
os_wait_flg Wait event flag signal
os_clar_flg Clear event flag
os_puls_flg Signal event flag (pulse type)
os_make_sem Make counter-type semaphore
os_delt_sem Delete semaphore
os_sign_sem Signal semaphore
os_wait_sem Wait semaphore signal
os_strt_wtsk Start window task
- 32 -
B-64303EN-3/01 SPECIFICATION 4.C Language Library function list
These are the functions which communicate with FCA (FANUC CASSETTE ADAPTOR) or FANUC Handy
File.
NAME FUCNTION
fca_setparam Initialize communication line
fca_bye Close communication line
fca_open Open a binary file on FCA device
fca_close Close a binary file
fca_read Read binary data from the file
fca_write Write binary data to the file
fca_fopen Open a text file on FCA device
fca_fclose Close a text device
fca_getc Read a character from the text file
fca_putc Write a character to the text file
fca_delete Delete a file on FCA device
fca_rename Change name of a file on FCA device
fca_readdir Read directory information of FCA device
fca_status Read status information of FCA device
fca_remains Read free space size of a floppy disk
These are the functions which read C Language Executor data stored in the flash ROM module.
NAME FUCNTION
aux_from_open Open the specified F-ROM file
aux_from_close Close the F-ROM file
aux_from_select Select data in the F-ROM file
aux_from_moveptr Move read pointer
aux_from_read Read data from the F-ROM file
aux_from_getdir Read directory information of a F-ROM file
aux_from_getinfo Read F-ROM file information
aux_from_getc Read a character from the F-ROM file
aux_from_gets Read a line from the F-ROM file
This is the function which reads the status and (X,Y) coordinate of the touch-panel.
NAME FUCNTION
aux_tpl_read Read the status and (X,Y) coordinate of touch-panel
aux_tpl_invalskey Disable output of key codes of soft keys with the touch-panel
- 33 -
II. PROGRAMMING
B-64303EN-3/01 PROGRAMMING 1.List of Functions
1 List of Functions
(abbreviation) CExe : C Language Executor
ANSI : American National Standards Institute
MS-C : Microsoft Corp. MS-C Ver 6.0, Ver 7.0 or Ver 8.0
(mark) ○ : available
× : not available
M : available only on Main task
MA : available on Main task and Alarm task
MAC : available on Main task, Alarm task and Communication task
For the functions that can be used in a window task, see Section 5.6, "Window task" in II.
For the functions that can be used in a high level task, see Section 5.8, "High-Level task" in
II.
- 37 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 38 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 39 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 40 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 41 -
1.List of Functions PROGRAMMING B-64303EN-3/01
Compatible functions with extended library of Microsoft C Compiler (MS-C Ver 6.0).
NAME CExe ANSI MS-C NAME CExe ANSI MS-C
FP_OFF × × ○ _fstrcmp MAC × ○
FP_SEG × × ○ _fheapset × × ○
_atold × × ○ _fheapwalk × × ○
_bcalloc × × ○ _fjstradv × × ○
_beginthread × × ○ _fjstrchr × × ○
_bexpand × × ○ _fjstrcmp × × ○
_bfree × × ○ _fjstrcspn × × ○
_bfreeseg × × ○ _fjstricmp × × ○
_bheapadd × × ○ _fjstrlen × × ○
_bheapchk × × ○ _fjstrlwr × × ○
_bheapmin × × ○ _fjstrmatch × × ○
_bheapseg × × ○ _fjstrncat × × ○
_bheapset × × ○ _fjstrncmp × × ○
_bheapwalk × × ○ _fjstrncpy × × ○
_bmalloc × × ○ _fjstrnicmp × × ○
_bmsize × × ○ _fjstrnset × × ○
_brealloc × × ○ _fjstrrchr × × ○
_cexit × × ○ _fjstrrev × × ○
_c_exit × × ○ _fjstrset × × ○
_chain_intr × × ○ _fjstrskip × × ○
_chdrive MAC × ○ _fjstrspn × × ○
_clear87 × × ○ _fjstrstr × × ○
_control87 × × ○ _fjstrtok × × ○
_disable × × ○ _fjstrupr × × ○
_dos_findfirst MAC × ○ _fmalloc MAC × ○
_dos_findnext MAC × ○ _fmemccpy × × ○
_dos_getdiskfree MAC × ○ _fmemchr MAC × ○
_enable × × ○ _fmemcmp MAC × ○
_endthread × × ○ _fmemcpy MAC × ○
_exit × × ○ _fmemicmp MAC × ○
_expand MAC × ○ _fmemmove MAC × ○
_fbtom × × ○ _fmemset MAC × ○
_fcalloc MAC × ○ _fmsize MAC × ○
_fexpand MAC × ○ _fmtob × × ○
_ffree MAC × ○ _fnthctype × × ○
_fheapchk × × ○ _fpreset × × ○
_fheapmin × × ○ _frealloc MAC × ○
_fstrchr MAC × ○ _freect × × ○
- 42 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 43 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 44 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 45 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 46 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
Compatible functions with a part of graphic library of Microsoft C Compiler (MS-C Ver 6.0).
- 47 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 48 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 49 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 50 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 51 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 52 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 53 -
1.List of Functions PROGRAMMING B-64303EN-3/01
- 54 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 55 -
1.List of Functions PROGRAMMING B-64303EN-3/01
These are the functions which customize key-input from MDI panel,alter key code, enable
key repeating and generate key code by the application program.
These are the functions which control CRT display and multiple window display.
- 56 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 57 -
1.List of Functions PROGRAMMING B-64303EN-3/01
These are the functions which communicate with peripherals via reader/puncher interface
(RS-232C).
- 58 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
These are the functions which communicate with FCA (FANUC CASSETTE ADAPTOR) or FANUC Handy
File.
- 59 -
1.List of Functions PROGRAMMING B-64303EN-3/01
These are the functions which read C Language Executor data stored in the flash ROM module.
This is the function which reads the status and (X,Y) coordinate of the touch-panel.
- 60 -
B-64303EN-3/01 PROGRAMMING 1.List of Functions
- 61 -
2.How to make application program PROGRAMMING B-64303EN-3/01
2
Table of contents
How to make application program
- 62 -
B-64303EN-3/01 PROGRAMMING 2.How to make application program
See Sections B.1 and B.2 in Appendix B, "Additional Information on C Compiler Installation"
later.
See Sections B.3, B.4, and B.5 in Appendix B, "Additional Information on C Compiler
Installation" later.
- 63 -
2.How to make application program PROGRAMMING B-64303EN-3/01
For the compiler used with the 0i-D C Language Executor, variables of type 'int' are 4-bytes
long.
- 64 -
B-64303EN-3/01 PROGRAMMING 2.How to make application program
The following functions use the library supplied together with the compiler.
To use these functions, add the library to the LD.OPT file in the TOOL folder in your
development environment.
1) Functions that use the library supplied together with the compiler
setjmp, longjmp
va_start, va_arg, va_end
vprintf, vprintf, vsprintf
The Diab C/C++ Power-PC compiler does not support Japanese language. If a 2-byte character
whose second byte happens to be 5Ch is included directly in a source file, it is not recognized
as correct data.
- 65 -
2.How to make application program PROGRAMMING B-64303EN-3/01
2.7 Remarks
C Language Executor uses the different include files from the compiler's default.
So, the object files made for the personal computer debugging cannot be used for execution
on CNC. Recompile using include files for C Language Executor. (The include directory is
switched by the macro CC in MAKEFILE)
[**WARNING**]
If an application program performs one of the following operations, the CNC may behave in
an unexpected manner.
- Access to data in an area other than the application data area.
- Execution of a program other than an application program (except call the function that
the C Language Executor offers it)
- 66 -
B-64303EN-3/01 PROGRAMMING 3.Function References
3 Function References
The function specifications that C Language Library provides with are described in
this function reference with following format.
[Example]
> ----------------------------------------------------------------------------
> 1. Format specified drive. <Main>
> ----------------------------------------------------------------------------
>
>
> [Name]
> aux_file_format
>
>
> [Syntax]
> #include <auxfile.h>
> int aux_file_format( unsigned char drive ) ;
>
>
> [Arguments]
> drive Drive name ( ='A' ).
>
>
> [Return]
> 0 Successfully.
> 9 Invalid drive name.
>
>
> [Description]
> Formats specified drive.
>
> Specify drive name to be formatted in "drive". For formatting S-RAM
> disk, execute as follows.
>
> aux_file_format( 'A' ) ;
>
> All files in specified drive will be deleted by execution of this
> function.
>
> Automatic initialization of S-RAM disk is done by setting CNC
> parameter No.8662, S-RAM capacity setting, and rebooting system.
- 67 -
3.Function References PROGRAMMING B-64303EN-3/01
"<Main>" after title shows that this function is available in the MAIN task,
not available in the Communication task and the Alarm task. If "<Main,Alarm,
Comm>" is in this section, this function is available in all tasks.
For the functions that can be used in a window task, see Section 5.6, "Window task" in II.
For the functions that can be used in a high level task, see Section 5.9, "High-Level task" in
II.
"[Syntax]" shows required header files to use this function, type of return
value of this function and sequence and types of all arguments.
"[Return]" shows all possible return values and their types and meanings.
* Note
In description of member variables and bits of bit variables in a structure, some of the variables
are listed as "Not used." These variables may be used for any other purpose due to a design change.
Currently, application programs cannot use these variables because they have undefined values.
- 68 -
B-64303EN-3/01 PROGRAMMING 3.Function References
1. Diagnostics ( assert.h )
- 69 -
3.Function References PROGRAMMING B-64303EN-3/01
3. Mathematics ( math.h )
- 70 -
B-64303EN-3/01 PROGRAMMING 3.Function References
6. Input/output ( stdio.h )
- 71 -
3.Function References PROGRAMMING B-64303EN-3/01
- 72 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 73 -
3.Function References PROGRAMMING B-64303EN-3/01
1. Diagnostics ( assert.h )
------------------------------------------------------------------------------
1.1 Abort by assertion. <Main>
------------------------------------------------------------------------------
[Name]
assert
[Syntax]
#include <assert.h>
void assert( int expression ) ;
[Arguments]
expression Expression to be diagnosed.
[Return]
------
[Description]
"assert" is used to debug programs simply. "assert" displays diagnostic message and
stops the program when the value of "expression" is false (i.e. "0"). To stop the program,
"while(1);" is execute, the next step is never executed. When "expression" is true (i.e.
non-zero), "assert" does nothing.
"assert" is defined as MACRO, so, define NDEBUG identifier and recompile to remove it.
- 74 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
2.1 Test for alphanumeric character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isalnum
[Syntax]
#include <ctype.h>
int isalnum( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is an alphanumeric character, otherwise zero.
[Description]
"isalnum" tests whether "c" is an alphanumeric character ('A'-'Z','a'-'z','0'-'9') or
not. This function works correctly for integer value of ASCII character set. The result
is not warranted for other input value.
- 75 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
2.2 Test for alphabetic character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isalpha
[Syntax]
#include <ctype.h>
int isalpha( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is an alphabetic character, otherwise zero.
[Description]
"isalpha" tests whether "c" is an alphabetic character ('A'-'Z', 'a'-'z') or not. This
function works correctly for integer value of ASCII character set. The result is not
warranted for other input value.
- 76 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
2.3 Test for control character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
iscntrl
[Syntax]
#include <ctype.h>
int iscntrl( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a control character, otherwise zero.
[Description]
"iscntrl" tests whether "c" is a control character (0x00-0x1f,0x7f) or not. This function
works correctly for integer value of ASCII character set. The result is not warranted
for other input value.
- 77 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
2.4 Test for numeric character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isdigit
[Syntax]
#include <ctype.h>
int isdigit( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a numeric character, otherwise zero.
[Description]
"isdigit" tests whether "c" is a numeric character ('0'-'9') or not. This function works
correctly for integer value of ASCII character set. The result is not warranted for other
input value.
- 78 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
2.5 Test for visible character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isgraph
[Syntax]
#include <ctype.h>
int isgraph( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a visible character, otherwise zero.
[Description]
"isgraph" tests whether "c" is a visible character (0x21-0x7e) or not. This function
works correctly for integer value of ASCII character set. The result is not warranted
for other input value.
- 79 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
2.6 Test for lowercase alphabetic character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
islower
[Syntax]
#include <ctype.h>
int islower( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a lowercase alphabetic character, otherwise zero.
[Description]
"islower" tests whether "c" is a lowercase alphabetic character ('a'-'z') or not. This
function works correctly for integer value of ASCII character set. The result is not
warranted for other input value.
- 80 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
2.7 Test for printable character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isprint
[Syntax]
#include <ctype.h>
int isprint( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a printable character, otherwise zero.
[Description]
"isprint" tests whether "c" is a printable character (0x20-0x7e) or not. This function
works correctly for integer value of ASCII character set. The result is not warranted
for other input value.
- 81 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
2.8 Test for punctuation character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ispunct
[Syntax]
#include <ctype.h>
int ispunct( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a punctuation character, otherwise zero.
[Description]
"ispunct" tests whether "c" is a punctuation character (0x21-0x2f, 0x3a-0x40, 0x5b-0x60,
0x7b-0x7e) or not. This function works correctly for integer value of ASCII character
set. The result is not warranted for other input value.
- 82 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
2.9 Test for whitespace character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isspace
[Syntax]
#include <ctype.h>
int isspace( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a whitespace character, otherwise zero.
[Description]
"isspace" tests whether "c" is a whitespace character (0x09-0x0d, 0x20) or not. This
function works correctly for integer value of ASCII character set. The result is not
warranted for other input value.
- 83 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
2.10 Test for uppercase alphabetic character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isupper
[Syntax]
#include <ctype.h>
int isupper( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is an uppercase alphabetic character, otherwise zero.
[Description]
"isupper" tests whether "c" is an uppercase alphabetic character ('A'-'Z') or not. This
function works correctly for integer value of ASCII character set. The result is not
warranted for other input value.
- 84 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
2.11 Test for hexadecimal numeric character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
isxdigit
[Syntax]
#include <ctype.h>
int isxdigit( int c ) ;
[Arguments]
c Character code to be tested.
[Return]
Returns non-zero value if "c" is a hexadecimal character, otherwise zero.
[Description]
"isxdigit" tests whether "c" is a hexadecimal character ('A'-'Z', 'a'-'f','0'-'9') or
not. This function works correctly for integer value of ASCII character set. The result
is not warranted for other input value.
- 85 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
2.12 Convert uppercase to lowercase. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
tolower
[Syntax]
#include <ctype.h>
int tolower( int c ) ;
[Arguments]
c Character code to be converted.
[Return]
Returns a lowercase alphabetic character if "c" is an uppercase, otherwise "c" as it
is.
[Description]
"tolower" converts "c" to a lowercase alphabetic character if "c" is uppercase.
- 86 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
2.13 Convert lowercase to uppercase. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
toupper
[Syntax]
#include <ctype.h>
int toupper( int c ) ;
[Arguments]
c Character code to be converted.
[Return]
Returns an uppercase alphabetic character if "c" is a lowercase, otherwise "c" as it
is.
[Description]
"toupper" converts "c" to an uppercase alphabetic character if "c" is lowercase.
- 87 -
3.Function References PROGRAMMING B-64303EN-3/01
3. Mathematics ( math.h )
------------------------------------------------------------------------------
3.1 Calculate the arc cosine value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
acos
[Syntax]
#include <math.h>
double acos( double x ) ;
[Arguments]
x A floating point value to be calculated arc cosine.
[Return]
Returns the arc cosine value (in radian) of "x". If argument is out of valid range, returns
0 and sets EDOM in the global variable "errno".
[Description]
Calculates the arc cosine value of "x"."x" must be in -1 through 1. The result is in
0 through PI radian.
- 88 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.2 Calculate the arc sine value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
asin
[Syntax]
#include <math.h>
double asin( double x ) ;
[Arguments]
x A floating point value to be calculated arc sine.
[Return]
Returns the arc sine value (in radian) of "x". If argument is out of valid range, returns
0 and sets EDOM in the global variable "errno".
[Description]
Calculates the arc sine value of "x"."x" must be in -1 through 1. The result is in -PI/2
through PI/2 radian.
- 89 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.3 Calculate the arc tangent value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
atan
[Syntax]
#include <math.h>
double atan( double x ) ;
[Arguments]
x A floating point value to be calculated arc tangent.
[Return]
Returns the arc tangent value (in radian) of "x".
[Description]
Calculates the arc tangent value of "x".
The result is in -PI/2 through PI/2 radian.
- 90 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.4 Calculate the arc tangent value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
atan2
[Syntax]
#include <math.h>
double atan2( double y, double x ) ;
[Arguments]
x A denominator of the value to be calculated arc tangent.
y A numerator of the value to be calculated arc tangent.
[Return]
Returns the arc tangent value (in radian) of y/x.
If both "y" and "x" are 0, returns 0 and sets EDOM in the global variable "errno".
[Description]
Calculates the arc tangent value of y/x.
Both "x" and "y" are must not be 0. The result is in -PI through PI radian.
- 91 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.5 Calculate the smallest integer value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ceil
[Syntax]
#include <math.h>
double ceil( double x ) ;
[Arguments]
x A floating point value whose fractions is raised.
[Return]
Returns the smallest integer value that is greater than or equal to "x".
[Description]
Calculates the smallest integer value that is greater than or equal to "x".
- 92 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.6 Calculate the cosine value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
cos
[Syntax]
#include <math.h>
double cos( double x ) ;
[Arguments]
x A floating point value in radian to be calculated cosine.
[Return]
Returns the cosine value of "x".
If "x" is too large, returns 0 and sets ERANGE in the global variable "errno".
[Description]
Calculates the cosine value of "x".
- 93 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.7 Calculate the hyperbolic cosine value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
cosh
[Syntax]
#include <math.h>
double cosh( double x ) ;
[Arguments]
x A floating point value in radian to be calculated hyperbolic cosine.
[Return]
Returns the hyperbolic cosine value of "x".If the result is too large, returns +/-HUGE_VAL
and sets ERANGE in the global variable "errno".
[Description]
Calculates the hyperbolic cosine value of "x".
- 94 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.8 Calculate the exponential function. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
exp
[Syntax]
#include <math.h>
double exp( double x ) ;
[Arguments]
x A floating point value to be calculated exponential function.
[Return]
Returns the exponential function value of "x".
If the result is too large, returns HUGE_VAL and sets ERANGE in the global variable "errno".
If the result is too small, returns 0.
[Description]
Calculates the exponential function ("e" raised to "x" power) of "x".
- 95 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.9 Calculate the absolute value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fabs
[Syntax]
#include <math.h>
double fabs( double x ) ;
[Arguments]
x A floating point value to be calculated the absolute value.
[Return]
Returns the absolute value of "x".
[Description]
Calculates the absolute value of "x".
- 96 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.10 Calculate the largest integer value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
floor
[Syntax]
#include <math.h>
double floor( double x ) ;
[Arguments]
x A floating point value whose fractions is discarded.
[Return]
Returns the largest integet value that is less than or equal to "x"
[Description]
Calculates the largest integer value that is less than or equal to "x".
- 97 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.11 Calculate the floating point remainder value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fmod
[Syntax]
#include <math.h>
double fmod( double x, double y ) ;
[Arguments]
x A divident to be calculated remainder.
y A divosor to be calculated remainder.
[Return]
Returns the remainder of "x" and "y". If "y" is 0, returns 0 and sets EDOM in the global
variable "errno".
[Description]
Calculates the remainder of "x" and "y". The remainder satisfies "x - i*y ("i" is an
integer value)" and its absolute value is smaller than the absolute value of "y".
- 98 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.12 Calculate the mantissa value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
frexp
[Syntax]
#include <math.h>
double frexp( double value, int *exp ) ;
[Arguments]
value A floating point value to be divided.
exp A integer variable in where the exponential part is
stored.
[Return]
Returns the mantissa of a divided floating point value.
[Description]
Divides "value" into a mantissa part "m" and an exponential part "n" "m" relates with
"n" as "value = m × 2n" and the absolute value of "m" is greater than or equal to 0.5
and less than 1. If "value" is 0,both "m" and "n" are 0.
- 99 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.13 Calculate the value multiplied by the power of 2. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ldexp
[Syntax]
#include <math.h>
double ldexp( double x, int exp ) ;
[Arguments]
x A floating point value of the manttisa.
exp A exponential part.
[Return]
Returns the raied value.
If the result is too large, returns +/-HUGE_VAL and sets ERANGE in the global variable
"errno".
[Description]
Calculates the raised value "x × 2exp" by the mantissa and the exponent.
- 100 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.14 Calculate the natural (base-e) logarithm value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
log
[Syntax]
#include <math.h>
double log( double x ) ;
[Arguments]
x A floating point value to be calculated natural
logarithm.
[Return]
Returns the natural logarithm value of "x".
If "x" is 0, returns HUGE_VAL and sets ERANGE in the global variable
"errno". If "x" is negative, returns HUGE_VAL and sets EDOM in the
global variable "errno".
[Description]
Calculates the natural logarithm (base-e logarithm) value of "x".
- 101 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.15 Calculate the base-10 logarithm value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
log10
[Syntax]
#include <math.h>
double log10( double x ) ;
[Arguments]
x A floating point value to be calculated base-10 logarithm.
[Return]
Returns the base-10 logarithm value of "x".
If "x" is 0, returns HUGE_VAL and sets ERANGE in the global variable
"errno". If "x" is negative, returns HUGE_VAL and sets EDOM in the
global variable "errno".
[Description]
Calculates the base-10 logarithm value of "x".
- 102 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.16 Get the fractional part and the integer part. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
modf
[Syntax]
#include <math.h>
double modf( double value, double *iptr ) ;
[Arguments]
value A floating point value to be divided.
iptr A integer variable in where the integer part is stored.
[Return]
Returns the fractional part of "value".
[Description]
Divides "value" into a fractional part and an integer part, both parts have the same
sign.
- 103 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.17 Calculate the raised value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
pow
[Syntax]
#include <math.h>
double pow( double x, double y ) ;
[Arguments]
x A floating point value to be raised.
y An exponent value.
[Return]
Returns "x" raised to the power of "y".
If "x" is 0 and "y" is negative, returns HUGE_VAL and sets EDOM in the
global variable "errno". If both "x" and "y" are 0 or "x" is negative
and "y" is not an integer, returns 0 and sets EDOM in the global
variable "errno". If the result is too large, returns +/-HUGE_VAL and
sets ERANGE in the global variable "errno".
[Description]
Calculates "x" raised to the power of "y".
- 104 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.18 Calculate the sine value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
sin
[Syntax]
#include <math.h>
double sin( double x ) ;
[Arguments]
x A floating point value in radian to be calculated
sine.
[Return]
Returns the sine value of "x".
If "x" is too large, returns 0 and sets ERANGE in the global variable
"errno".
[Description]
Calculates the sine value of "x".
- 105 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.19 Calculate the hyperbolic sine value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
sinh
[Syntax]
#include <math.h>
double sinh( double x ) ;
[Arguments]
x A floating point value in radian to be calculated hyperbolic sine.
[Return]
Returns the hyperbolic sine value of "x".
If the result is too large, returns +/-HUGE_VAL and sets ERANGE in
the global variable "errno".
[Description]
Calculates the hyperbolic sine value of "x".
- 106 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.20 Calculate the square root value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
sqrt
[Syntax]
#include <math.h>
double sqrt( double x ) ;
[Arguments]
x A floating point value to be calculated square root.
[Return]
Returns the square root value of "x".
If "x" is negative, returns 0 and sets EDOM in the global variable
"errno".
[Description]
Calculates the square root value of "x".
- 107 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
3.21 Calculate the tangent value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
tan
[Syntax]
#include <math.h>
double tan( double x ) ;
[Arguments]
x A floating point value in radian to be calculated tangent.
[Return]
Returns the tangent value of "x".
If "x" is too large, returns 0 and sets ERANGE in the global variable
"errno".
[Description]
Calculates the tangent value of "x".
- 108 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
3.22 Calculate the hyperbolic tangent value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
tanh
[Syntax]
#include <math.h>
double tanh( double x ) ;
[Arguments]
x A floating point value in radian to be calculated hyperbolic tangent.
[Return]
Returns the hyperbolic tangent value of "x".
[Description]
Calculates the hyperbolic tangent value of "x".
- 109 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
4.1 Save current environment for non-local jump. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
setjmp
[Syntax]
#include <setjmp.h>
int setjmp( jmp_buf env ) ;
[Arguments]
env Buffer in which contents of stack is saved.
[Return]
Returns zero. When "setjmp" is called again by "longjmp", it returns
"value", one of arguments of "longjmp". If "value" is zero, it
returns 1.
[Description]
"setjmp" saves contents of stack in "env" for restoring by the later "longjmp". This
enables jumping between functions.
See also "longjmp" for more information. This function use the library supplied together
with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 110 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
4.2 Execute a non-local jump. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
longjmp
[Syntax]
#include <setjmp.h>
void longjmp( jmp_buf env, int value ) ;
[Arguments]
env Buffer in which contents of stack is saved.
value Return value of "setjmp".
[Return]
------
[Description]
"longjmp" restores environment which has been saved by "setjmp" before, and jumps to
the previous "setjmp" function. This enables jumping between functions. When "setjmp"
is called from "longjmp", "setjmp" returns "value" which is an one of arguments of
"longjmp".
If "value" is zero, "setjmp" returns 1. After re-calling "setjmp", values of all variables
are ones at calling "longjmp". Global variables whish has been changed by the other
functions are not restored. All register variables are undefined. Usually, "setjmp" is
called in the function which calls a function in which "longjmp" is called. That is,
"setjmp" must be the outer nested function than "longjmp". When "longjmp" jumps to an
inner function, the program doesn't work correctly.
outer← → inner
main() process1() process2() process3()
calls calls calls
setjmp() longjmp() longjmp()
GOOD
NO GOOD
This function use the library supplied together with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 111 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
5.1 Initialize arg_ptr. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
va_start
[Syntax]
#include <stdarg.h>
void va_start( va_list arg_ptr, prev_param ) ;
[Arguments]
arg_ptr Pointer to the list of arguments.
prev_param Previous argument to the first optional argument.
[Return]
------
[Description]
Initialize "arg_ptr" to let it point the first argument of the arguments list. This
function is defined as MACRO. There are two definitions of this macro, such as ANSI
standard macro defined in stdarg.h and UNIX System V macro defined in varargs.h. Only
the ANSI standard macro is defined in C Language Library.
This function use the library supplied together with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 112 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
5.2 Get a next argument. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
va_arg
[Syntax]
#include <stdarg.h>
type va_arg( va_list arg_ptr, type ) ;
[Arguments]
arg_ptr Pointer to the list of arguments.
type Type of an argument to be gotten.
[Return]
Returns an argument pointed by "arg_ptr".
[Description]
Returns a value whose type is "type" in a position pointed by "arg_ptr", then increments
"arg_ptr" to let it point the next argument in the list. The next argument position is
determined by size of "type". More arguments can be gotten using "arg_ptr" repeatedly.
This function use the library supplied together with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 113 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
5.3 Reset arg_ptr. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
va_end
[Syntax]
#include <stdarg.h>
void va_end( va_list arg_ptr ) ;
[Arguments]
arg_ptr Pointer to the list of arguments.
[Return]
------
[Description]
Initializes "arg_ptr" as NULL.
This function use the library supplied together with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 114 -
B-64303EN-3/01 PROGRAMMING 3.Function References
6. Input/output ( stdio.h )
------------------------------------------------------------------------------
6.1 Delete a file. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
remove
[Syntax]
#include <stdio.h>
int remove( const char *path ) ;
[Arguments]
path Pathname of a file to be deleted.
[Return]
Returns zero if a file has been successfully deleted. If not, returns
-1 and sets an one of following values in the global variable "errno".
Symbol Meaning
EACCES Specified file is a Read-Only file.
ENOENT Specified file or path does not exist, or "path" is a directory.
[Description]
Deletes a file specified by "path".
- 115 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.2 Change the name of a file. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
rename
[Syntax]
#include <stdio.h>
int rename( const char *oldname, const char *newname ) ;
[Arguments]
oldname Pointer to the old name.
newname Pointer to the new name.
[Return]
Returns zero if file name has been successfully changed. If not,
returns -1 and sets an one of following values in the global variable "errno".
Symbol Meaning
A file or directory whose name is "newname" already exists,
EACCES "path" is invalid, or a different path is specified in "newname" for a
directory.
ENOENT Specified file or path does not exist.
EXDEV Attempted moving a file to the another device.
[Description]
Changes a file name or directory name specified by "oldname" to a new name specified
by "newname". The old name must be a path name of a file or a directory which already
exists. The new name must not be a path name of a file or a directory which already exists.
A file can be moved from some directory to another one by specifying a different path
name in "oldname" from "newname". But it is impossible to move a file from some device
to the another device. For directory, only renaming is available, moving is not available.
(Note) The library of the current version can not move any file. rename() function calling
to move a file makes an error. (errno=EACCES)
- 116 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.3 Generate a temporary file name. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
tmpnam
[Syntax]
#include <stdio.h>
char *tmpnam( char *string ) ;
[Arguments]
string Pointer to a temporary file name.
[Return]
Returns a pointer to a generated unique file name if it has been successfully generated.
If not, returns NULL.
[Description]
Generates a file name by which a temporary file can be opened without overwriting existing
files. This name is stored in a buffer pointed by "string". If "strings" is NULL, the
result is stored in the internal static buffer. So, the following calling destroy this
result. At least buffer size must be larger than L-tmpnam bytes (defined in stdio.h).
This function can generate up to TMP_MAX of unique file names.
The generated string is composed of a path prefix, such as P_tmpdir define in stdio.h,
and following sequence of numeric characters. The values of this numeric string are 1
through 65535.
A process of "tmpnam" is not changed by modifying L_tmpnam or P_tmpdir.
- 117 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.4 Close a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fclose
[Syntax]
#include <stdio.h>
int fclose( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
Returns zero if a stream has been successfully closed. If not,returns EOF.
[Description]
Closes specified stream. Buffers linked to the stream will be flushed before closing.
Buffers allocated by the system will be deallocated. But buffers which has been allocated
by user using "setbuf" or "setvbuf" will not be deallocated automatically.
- 118 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.5 Flush a stream buffer. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fflush
[Syntax]
#include <stdio.h>
int fflush( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
Returns zero if a buffer has been successfully flushed. Also if specified stream has
no buffer, or it has been opened with Read-Only mode, returns zero. If any error occurs,
returns EOF. In this case, any data may be missed because of incorrect writing.
[Description]
Flushes specified stream. If specified stream has been opened for output, contents of
the buffer are written to the file. If for input, they are cleared. All streams for output
are flushed by specifying NULL in argument. Steams will still exist as they are after
calling "fflush". Calling "fflush" makes the result of "ungetc" ineffective. Buffers
are automatically flushed when a buffer is full, a stream is closed, or program
successfully terminated without closing streams. This function does not influence to
the streams without buffering.
- 119 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.6 Open a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fopen
[Syntax]
#include <stdio.h>
FILE *fopen( const char *filename, const char *mode ) ;
[Arguments]
filename Path name of a file.
mode Permitted access type.
[Return]
Returns a pointer to the opened file. If any error, returns NULL pointer.
[Description]
Opens a file specified by "filename". Specify access type which is requested to the file
in "mode".
Type Meaning
r Opens with Read-Only mode. Error if specified file does not exist.
Opens with output mode. Opens an empty file. Contents of the existing
w
file are destroyed.
Opens with output mode, appending to the end of the file. If specified
a
file does not exist, creates it.
r+ Opens with both input and output mode. Specified file must exist.
Opens an empty file with both input and output mode. Contents of the
w+
existing file are destroyed.
a+ Opens with both input and output. If no specified file, creates it.
Additionally, the following open mode can also be specified as additional character in
the above list.
Mode Meaning
Opens the file in text mode.(default)
In this mode, line feed characters are converted as follows.
t Input CR + LF → LF
Output LF → CR + LF
Opens the file in binary mode. In this mode, line feed characters are not
b
converted.
- 120 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.7 Re-open a same stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
freopen
[Syntax]
#include <stdio.h>
FILE *freopen( const char *filename, const char *mode,
FILE *stream ) ;
[Arguments]
filename Path name of a new file.
mode Permitted access type.
stream Pointer to a FILE structure.
[Return]
Returns a pointer to the newly opened file. If any error, closes a
old file and returns NULL pointer.
[Description]
Closes a file linked to the stream, then reallocates the stream to the file specified
by "filename". This function is usually used to redirect already opened standard input
(stdin), standard output (stdout) or standard error output (stderr) to specified file.
The new file to be linked the steam is opened with "mode". Specify access type which
is requested to the file in "mode".
Type Meaning
r Opens with Read-Only mode. Error if specified file does not exist.
Opens with output mode. Opens an empty file. Contents of the existing file
w
are destroyed.
Opens with output mode, appending to the end of the file. If specified file
a
does not exist, creates it.
r+ Opens with both input and output mode. Specified file must exist.
Opens an empty file with both input and output mode. Contents of the
w+
existing file are destroyed.
a+ Opens with both input and output. If no specified file, creates it.
- 121 -
3.Function References PROGRAMMING B-64303EN-3/01
Additionally, the following open mode can also be specified as additional character in
the above list.
Mode Meaning
Opens the file in text mode.(default)
In this mode, line feed characters are converted as follows.
t Input CR + LF → LF
Output LF → CR + LF
Opens the file in binary mode.
b
In this mode, line feed characters are not converted.
- 122 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.8 Set a buffer for stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
setbuf
[Syntax]
#include <stdio.h>
void setbuf( FILE *stream, char *buffer ) ;
[Arguments]
stream Pointer to a FILE structure.
buffer Buffer allocated by user.
[Return]
------
[Description]
Controls buffering of a stream. Specified stream must be already opened file from/to
which any input/output has not been done. Buffering is not performed for the stream if
"buffer" is NULL.
Otherwise, "buffer" must point a buffer whose size is BUFSIZ. BUFSIZ is a buffer size
defined in stdio.h. By calling this function, user defined buffer is used as an
input/output buffer instead of system defined one.
Functions of "setbuf" is included in "setvbuf". It is recommended to use "setvbuf" for
newly made programs. "setbuf" is provided for compatibility with existing programs.
- 123 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.9 Control a buffer for stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
setvbuf
[Syntax]
#include <stdio.h>
int setvbuf( FILE *stream, char *buffer, int mode, size_t size ) ;
[Arguments]
stream Pointer to a FILE structure.
buffer Buffer allocated by user.
mode Buffering mode.
size Buffer size.
[Return]
Returns zero if successful. If not (invalid mode or buffer size),returns non-zero.
[Description]
Controls buffering and buffer size of stream. Specified stream must be already opened
file from/to which any input/output has not been done. Buffer pointed by "buffer" is
used unless "buffer" is NULL. If NULL, new buffer whose size is "size" is automatically
allocated. "mode" is one of follows.
Mode Meaning
Full buffering.
_IOFBF "buffer" is a pointer to the buffer, and "size is a size of the buffer. If "buffer"
is NULL, new buffer of "size" byte allocated automatically is used.
_IONBF No buffer is used regardless of "buffer" and "size".
- 124 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.10 Print formatted data to a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fprintf
[Syntax]
#include <stdio.h>
int fprintf( FILE *stream, const char *format [, argument]... ) ;
[Arguments]
stream Pointer to a FILE structure.
format Format control string.
argument Optional arguments.
[Return]
Returns number of characters which have been output. If any error, returns negative value.
[Description]
Outputs a series of formatted data to a stream. Each arguments (if exist) are output
with conversion according to the format specification in "format". Formats of "format"
are same as ones of "printf". See "printf" for details of "format" and "argument".
- 125 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.11 Read formatted data from a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fscanf
[Syntax]
#include <stdio.h>
int fscanf( FILE *stream, const char *format [, argument]... ) ;
[Arguments]
stream Pointer to a FILE structure.
format Format control string.
Argument Optional arguments.
[Return]
Returns a number of fields converted successfully. This does not includes fields which
has been read and not converted. Returns EOF if any error is detected in a stream before
the first conversion, or the end of file is detected. Return value zero means that no
fields have been converted.
[Description]
Reads formatted data to arguments (if exist) from a stream.
"argument" are pointer to variables whose types are same as type specification in "format".
Formats of "format" are same as "scanf". See "scanf" for details of "format" and
"argument".
- 126 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.12 Print formatted data to standard output. <Main>
------------------------------------------------------------------------------
[Name]
printf
[Syntax]
#include <stdio.h>
int printf( const char *format [, argument]... ) ;
[Arguments]
format Format control string.
argument Optional arguments.
[Return]
Returns number of characters which have been output. If any error, returns negative value.
[Description]
Outputs a series of formatted data to the standard output stream (stdout). "format" is
composed of ordinary characters, escape sequences and format specifications. Ordinary
characters and escape sequences are output to the standard output in order. If any
arguments follow the format string, output formatting for the arguments are performed
using the format string. The first character of format specification is '%'. Format
specification is decoded rightward from the left. The first argument following "format"
is output according to the first format specification. The second argument is output
according to the second format specification, and so forth.
More arguments than the format specifications are ignored. If a number of arguments is
short of format specifications, the result of "printf" is not warranted.
- 127 -
3.Function References PROGRAMMING B-64303EN-3/01
3) "flag" specification
- 128 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.13 Read formatted data from standard input. <Main>
------------------------------------------------------------------------------
[Name]
scanf
[Syntax]
#include <stdio.h>
int scanf( const char *format [, argument]... ) ;
[Arguments]
format Format control string.
argument Optional arguments.
[Return]
Returns a number of fields converted successfully. This may be less than the requested
number to "scanf". This does not includes fields which has been read and not converted.
Returns EOF if any error is detected in a stream before the first conversion, or the
end of file is detected. Return value zero means that no fields have been converted.
[Description]
Reads formatted data to arguments from the standard input stream
(stdin). "argument" are pointer to variables whose types are same as
type specification in "format". Format specification controls
decoding input fields. Specify one or more of following characters
for format specification.
- 129 -
3.Function References PROGRAMMING B-64303EN-3/01
- 130 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 131 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.14 Print formatted data to memory. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
sprintf
[Syntax]
#include <stdio.h>
int sprintf( char *buffer, const char *format [, argument]... ) ;
[Arguments]
buffer Buffer in which string is stored.
format Format control string.
argument Optional arguments.
[Return]
Returns number of characters which have been stored in the buffer.
(The last NULL character is not counted.)
[Description]
Stores a series of formatted data in a buffer. Each arguments (if exist) are stored with
conversion according to the format specification in "format". Formats of "format" are
same as ones of "printf". See "printf" for details of "format" and "argument".
- 132 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.15 Read formatted data from memory. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
sscanf
[Syntax]
#include <stdio.h>
int sscanf( const char *buffer, const char *format
[, argument]... ) ;
[Arguments]
buffer Stored data.
format Format control string.
Argument Optional arguments.
[Return]
Returns a number of fields converted successfully. This does not includes fields which
has been read and not converted. Returns EOF if the end of string is detected. Return
value zero means that no fields have been converted.
[Description]
Reads formatted data to arguments (if exist) from a buffer.
"argument" are pointer to variables whose types are same as type specification in "format".
Formats of "format" are same as "scanf".
See "scanf" for details of "format" and "argument".
- 133 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.16 Print formatted data to a file using variable arguments.<Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
vfprintf
[Syntax]
#include <stdio.h>
#include <stdarg.h>
int vfprintf( FILE *stream, const char *format, va_list argptr ) ;
[Arguments]
stream Pointer to a FILE structure.
format Format control string.
argptr Pointer to a list of arguments.
[Return]
Returns number of characters which have been output. If any error, returns negative value.
[Description]
Outputs a series of formatted data to a stream. Each arguments are output with conversion
according to the format specification in "format". "argptr" is a pointer of va_list type
defined in stdarg.h. It points a list of arguments to be converted and output according
to format specifications of "format". Formats of "format" are same as ones of "printf".
See "printf" for details of "format" and "argument".
This function use the library supplied together with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 134 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.17 Print formatted data to standard output using variable arguments. <Main>
------------------------------------------------------------------------------
[Name]
vprintf
[Syntax]
#include <stdio.h>
#include <stdarg.h>
int vprintf( const char *format, va_list argptr ) ;
[Arguments]
format Format control string.
argptr Pointer to a list of arguments.
[Return]
Returns number of characters which have been output. (The last NULL character is not
counted.) If any error, returns negative value.
[Description]
Outputs a series of formatted data to the standard output. Each arguments are output
with conversion according to the format specification in "format". "argptr" is a pointer
of va_list type defined in stdarg.h. It points a list of arguments to be converted and
output according to format specifications of "format".
Formats of "format" are same as ones of "printf". See "printf" for details of "format"
and "argument".
This function use the library supplied together with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 135 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.18 Print formatted data to memory using variable arguments. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
vsprintf
[Syntax]
#include <stdio.h>
#include <stdarg.h>
int vsprintf( char *buffer, const char *format, va_list argptr ) ;
[Arguments]
buffer Buffer in which string is stored.
format Format control string.
argptr Pointer to a list of arguments.
[Return]
Returns number of characters which have been stored. (The last NULL character is not
counted.) If any error, returns negative value.
[Description]
Stores a series of formatted data in a buffer pointed "buffer". Each arguments are stored
with conversion according to the format specification in "format". "argptr" is a pointer
of va_list type defined in stdarg.h. It points a list of arguments to be converted and
output according to format specifications of "format". Formats of "format" are same as
ones of "printf". See "printf" for details of "format" and "argument".
This function use the library supplied together with the compiler.
For information on how to use it, see Section 2.5, “Using compiler libraries” in II,
“PROGRAMMING” earlier.
- 136 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.19 Read a character from a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fgetc
[Syntax]
#include <stdio.h>
int fgetc( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
Returns a read character. Returns EOF if any error if any error or the end of file is
detected. Use "feof" and "ferror" functions to distinguish an error from EOF.
[Description]
Reads a character from a file linked to "stream". A character is returned with conversion
to int. A file pointer is incremented to point the next character. This function is same
as "getc" function and is not a macro but a function.
- 137 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.20 Read a strings from a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fgets
[Syntax]
#include <stdio.h>
char *fgets( char *string, int n, FILE *stream ) ;
[Arguments]
string Buffer in which data is stored.
n Buffer size.
stream Pointer to a FILE structure.
[Return]
Returns "string" if successful. Returns NULL if any error or the end of file is detected.
Use "feof" and "ferror" functions to distinguish an error from EOF.
[Description]
Reads characters from a file linked to "stream" and stores them in "string". Reading
is repeated until newline character('\n') is detected, the end of the stream is detected,
or a length of read character become equivalent to "n-1". The result is stored in "string"
adding NULL character('\0'). If "n" is 1, "string" is empty (""). This function is similar
to "gets" function, but "gets" replaces a newline character to a NULL character.
- 138 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.21 Write a character to a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fputc
[Syntax]
#include <stdio.h>
int putc( int c, FILE *stream ) ;
[Arguments]
c Character to be written.
stream Pointer to a FILE structure.
[Return]
Returns a written character. If any error, returns EOF.
[Description]
Writes a character specified by "c" to an output stream. This function is similar to
"putc" function, buf this is a function, not a macro.
- 139 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.22 Write a string to a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fputs
[Syntax]
#include <stdio.h>
int fputs( const char *string, FILE *stream ) ;
[Arguments]
string String to be output.
stream Pointer to a FILE structure.
[Return]
Returns "non-negative value" if successful. If any error, returns EOF.
[Description]
Write "strings" to a stream. The terminating character, NULL character ('\0'), is not
output.
- 140 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.23 Read a character from a stream. <Main>
------------------------------------------------------------------------------
[Name]
getc
[Syntax]
#include <stdio.h>
int getc( FILE *stream ) ;
[Arguments]
stream Current stream.
[Return]
Returns a read character. Returns EOF if any error or the end of file is detected. Use
"feof" and "ferror" functions to distinguish an error from EOF.
[Description]
Reads a character from a file linked to "stream". A file pointer is incremented to point
the next character. This function is same as "fgetc" function and is not a function but
a macro.
- 141 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.24 Read a character from standard input. <Main>
------------------------------------------------------------------------------
[Name]
getchar
[Syntax]
#include <stdio.h>
int getchar( void ) ;
[Arguments]
------
[Return]
Returns a character read from the standard input. Returns EOF if any error or the end
of file is detected. Use "feof" and "ferror" functions to distinguish an error from EOF.
[Description]
Reads a character from the standard input. This is same as "getc" function. This function
is same as "_fgetchar" function but is a macro.
- 142 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.25 Read a line string from standard input. <Main>
------------------------------------------------------------------------------
[Name]
gets
[Syntax]
#include <stdio.h>
char *gets( char *buffer ) ;
[Arguments]
buffer Pointer to a buffer in which input characters are stored.
[Return]
Returns address of a buffer specified in argument. Returns NULL if any error or the end
of file is detected. Use "feof" and "ferror" functions to distinguish an error from EOF.
[Description]
Reads a line from the standard input stream (stdin) and stores it in "buffer". A line
is composed of all characters until the first newline character('\n'). A newline
character is replaced with a NULL character('\0'). This function is similar to "fgets"
function, buf "fgets" doesn't replace a newline character.
- 143 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.26 Write a character to a stream. <Main>
------------------------------------------------------------------------------
[Name]
putc
[Syntax]
#include <stdio.h>
int putc( int c, FILE *stream ) ;
[Arguments]
c Character to be written.
stream Pointer to a FILE structure.
[Return]
Returns a written character. If any error, returns EOF.
[Description]
Writes a character "c" to an output stream. Any integer value whatever can be specified,
but the only lower 8 bits are written.
- 144 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.27 Write a character to standard output. <Main>
------------------------------------------------------------------------------
[Name]
putchar
[Syntax]
#include <stdio.h>
int putchar( int c ) ;
[Arguments]
c Character to be written.
[Return]
Returns a written character. If any error, returns EOF.
[Description]
Writes a character "c" to the standard output (stdout). This is same as "putc( c,
stdout )".
- 145 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.28 Write a string to standard output. <Main>
------------------------------------------------------------------------------
[Name]
puts
[Syntax]
#include <stdio.h>
int puts( const char *string ) ;
[Arguments]
string String to be written.
[Return]
Returns "non-positive value" if successful. If any error, returns EOF.
[Description]
Writes "string" to the standard output (stdout). The last character of the string, NULL
character('\0'), is replaced with a newline character('\n').
- 146 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.29 Put a character into a steam. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ungetc
[Syntax]
#include <stdio.h>
int ungetc( int c, FILE *stream ) ;
[Arguments]
c Character to be pushed.
stream Pointer to a FILE structure.
[Return]
Returns a character "c" if successful. Returns EOF if nothing has been read from the
stream or the specified character has not be able to pushed into the stream.
[Description]
Pushes a character "c" into the stream and clears the end of file indicator. The stream
must be opened with "Read mode". The next reading from the stream is processed from "c".
If "c" is EOF, it is ignored. The pushed character into the stream will be cleared befer
it is read from the stream by calling "fflush", "fseek", "fsetpos" or "rewind" functions.
The file position indicator is not changed by this function. If "ungetc" function is
used for any text stream, the file pointer is undefined until all pushed characters are
read or cleared. If "ungetc" function is used for any binary stream, the file point
indicator is set to the previous position. In the case that the value of the file point
indicator was zero before calling this function, the value after calling is not warranted.
When "ungetc" function is calling twice continuously without any reading, the result
is unstable. After calling of "fscanf" function, "ungetc" function will be unsuccessful
unless one more reading procedure. (Because "fscanf" function calls "ungetc" function
itself.)
- 147 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.30 Read data from a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fread
[Syntax]
#include <stdio.h>
size_t fread( void *buffer, size_t size, size_t count,
FILE *stream ) ;
[Arguments]
buffer Pointer to a data buffer.
size Item size in byte.
count Maximum number of item to be read.
stream Pointer to a FILE structure.
[Return]
Returns number of items which has been read actually. If this value is less than "count",
any error or the end of file before reading "count" times might be detected. If any error,
the file pointer is undefined. The value read partially is undefined. Use "feof" and
"ferror" functions to distinguish an error from EOF. If "size" or "count" is zero, returns
zero and doesn't change contents of buffer.
[Description]
Reads "count" elements of "size" bytes item from an input stream, and stores into "buffer".
The file pointer linked to "stream" (if exists) is incremented by bytes number which
has been read actually. If the specified stream is opened with text mode, a pair of
carriage return and line feed (CR+LF) is replaced with a line feed character (LF). This
conversion doesn't affect the file pointer and the return value.
- 148 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.31 Write data to a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fwrite
[Syntax]
#include <stdio.h>
size_t fwrite( void *buffer, size_t size, size_t count,
FILE *stream ) ;
[Arguments]
buffer Pointer to a data buffer.
size Item size in byte.
count Maximum number of item to be written.
stream Pointer to a FILE structure.
[Return]
Returns number of items which has been written actually. If this value is less than "count",
any error might be detected. If any error, the file pointer is undefined.
[Description]
Writes "count" elements of "size" bytes item from "buffer" to a output stream. The file
pointer linked to "stream" (if exists) is incremented by bytes number which has been
written actually. If the specified stream is opened with text mode, a line feed
character(LF) is replaced with a pair of carriage return and line feed (CR+LF). This
conversion doesn't affect the return value.
- 149 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.32 Get the current file position of a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fgetpos
[Syntax]
#include <stdio.h>
int fgetpos( FILE *stream, fpos_t *pos ) ;
[Arguments]
stream Pointer to a FILE structure.
pos Pointer to a position indicator to be stored.
[Return]
Returns zero if successful. If not, returns non-zero value and sets an one of following
values, which are defined in stdio.h, in a global variable "errno".
Symbol Meaning
EBADF File handle linked to the specified stream is invalid, or cannot be accessed.
EINVAL Specified stream is invalid.
[Description]
Gets a file position indicator of the specified stream, and stores it in the buffer pointed
by "pos". It is able to restore the pointer of the stream at calling "fgetpos" function
by "fsetpos" function using an information stored in "pos". Data format of "pos" is
internal one, it is used only by "fgetpos" and "fsetpos" functions.
- 150 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.33 Move the current file pointer. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fseek
[Syntax]
#include <stdio.h>
int fseek( FILE *streem, long offset, int orign ) ;
[Arguments]
stream Pointer to a FILE structure.
offset Offset from origin in byte.
orign Origin position.
[Return]
Returns zero if successful. If not, returns non-zero value. For non-seekable devices,
returns unstable value.
[Description]
Moves a file pointer (if exists) linked to the stream to "offset" bytes position from
"orign". The following operations to the stream are performed at this new position. It
is possible to both read and write as the next operation to the streams which are opened
with updating mode. It is possible to move the pointer to any arbitrary position, also
beyond the end of file. Calling this function clears the end of file indicator. "orign"
is one of the following constants which are defined in stdio.h.
Symbol Meaning
SEEK_CUR Current position.
SEEK_END End of file.
SEEK_SET Beginning of file.
- 151 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.34 Set the current file position of stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fsetpos
[Syntax]
#include <stdio.h>
int fsetpos( FILE *stream, fpos_t *pos ) ;
[Arguments]
stream Pointer to a FILE structure.
pos Pointer to a position indicator to be stored.
[Return]
Returns zero if successful. If not, returns non-zero value and sets an one of following
values, which are defined in stdio.h, in a global variable "errno".
Symbol Meaning
EBADF File handle linked to the specified stream is invalid, or cannot be accessed.
EINVAL Specified stream is invalid.
[Description]
Restores a file position indicator of the specified stream to "pos" which has been gotten
by the previous "fgetpos" function. This function clears the end of file indicator and
cancels the result of "ungetc" function to the stream. Data format of "pos" is internal
one, it is used only by "fgetpos" and "fsetpos" functions.
- 152 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.35 Get the current file pointer. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ftell
[Syntax]
#include <stdio.h>
long ftell( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
Returns the current file pointer. If any error, returns -1L and sets an one of following
values, which are defined in stdio.h, in a global variable "errno".
Symbol Meaning
EBADF File handle linked to the specified stream is invalid, or cannot be accessed.
EINVAL Specified stream is invalid.
[Description]
Gets the current file pointer linked to the stream. This value is a offset from the
beginning of stream. A file pointer of a stream which is opened with text mode may not
coincide with the physical offset, because a pair of carriage return and line feed (CR+LF)
is replaced with a line feed character(LF) in text mode. The current file position of
the file which has been opened with appending mode is not the next writing position but
the last reading/writing
operation position. For example, if the last operation to the file which has been opened
with appending mode is reading, the file position is not the one in which the next writing
operation will be done but the next reading operation. In case that any reading/writing
operations have not been done to for appending mode file, the current file position is
the beginning of file.
- 153 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.36 Rewind the current file pointer to the top of file. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
rewind
[Syntax]
#include <stdio.h>
void rewind( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
------
[Description]
Rewind a file pointer linked to the stream to the beginning of file.
"rewind" function clears an error indicator of the stream, but "fseek" doesn't. "rewind"
is equivalent to the following "fseek" except above.
Both "rewind" and "fseek" functions clear the end of file indicator.
"fseek" function returns a value whether a pointer movement has been done successfully
or not, but "rewind" doesn't. It is possible to clear the keyboard buffer by calling
"rewind" function to the standard input stream (stdin) linked to the keyboard by default.
- 154 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.37 Reset error indicator of a stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
clearerr
[Syntax]
#include <stdio.h>
void clearerr( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
------
[Description]
Rests the error indicator and the end of file indicator. The error indicator is not cleared
automatically. If once the error indicator of specified stream is set, operations to
the stream return the error code until calling one of "clearerr", "fseek", "fsetpos"
and "rewind".
- 155 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.38 Test for end-of-file. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
feof
[Syntax]
#include <stdio.h>
int feof( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
Returns non-zero value if any input operations have been done beyond the end of file,
or zero if not. This function doesn't return any error code.
[Description]
Tests whether reaching to the end of stream or not. Any operations after once reaching
to the end of steam return the end of file indicator until the stream is closed or one
of "clearerr", "fseek", "fsetpos" and "rewind" is called.
- 156 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
6.39 Test for error on stream. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ferror
[Syntax]
#include <stdio.h>
int ferror( FILE *stream ) ;
[Arguments]
stream Pointer to a FILE structure.
[Return]
Returns zero if no error on the stream, otherwise non-zero value.
[Description]
Test whether any read/write error occurs on a file linked to the stream. If once any
error has been occurred, the error indicator of the stream is still ON until the stream
is closed or one of "clearerr" and "rewind" functions is called.
- 157 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
6.40 Print error message. <Main>
------------------------------------------------------------------------------
[Name]
perror
[Syntax]
#include <stdio.h>
void perror( const char *string ) ;
[Arguments]
string Error message to be displayed.
[Return]
------
[Description]
Displays an error message to the standard error output (stderr)."string" is displayed
first, then a colon (':') and a system error message about the library call which has
been occurred the latest error, and last a newline is output. If "string" is NULL pointer
or a pointer to NULL string, only system error message is displayed. A error code is
stored in a global variable "errno" defined in errno.h. A system error message is read
from "sys_errlist", an array of messages sorted by error code. "perror" function uses
"errno" as a index of "sys_errlist" to display an error message. "sys_nerr" variable
is the maximum element number of "sys_errlist" array. It is necessary to call "perror"
function just after library error to display exactly. Otherwise, the following library
calls may overwrite "errno". Values which are stored in "errno" at error are original
ones of C Languege Executor. These are not compatible with any PCs (MS-DOS machines,
etc.) and may be changed in the future. So, programming that "errno" is handling is not
recommended because it may not works correctly in the future.
- 158 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.1 Convert string to int value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
atoi
[Syntax]
#include <stdlib.h>
int atoi( const char *nptr ) ;
[Arguments]
nptr Pointer to a string.
[Return]
Returns a converted value of int type.
[Description]
Converts a strings pointed by "nptr" to integer value.
Format of strings is as follows.
(whitespaces)(+,-)numeric_characters
- 159 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.2 Convert string to long value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
atol
[Syntax]
#include <stdlib.h>
long atol( const char *nptr ) ;
[Arguments]
nptr Pointer to a string.
[Return]
Returns a converted value of long type.
[Description]
Converts a strings pointed by "nptr" to long integer value.
Format of strings is as follows.
(whitespaces)(+,-)numeric_characters
- 160 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.3 Convert string to long value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strtol
[Syntax]
#include <stdlib.h>
long strtol( const char *nptr, char **endptr, int base ) ;
[Arguments]
nptr Pointer to a string.
endptr Pointer which points the position where reading is stopped.
base Base number.
[Return]
Returns a converted value of long type. If overflow, returns LONG_MAX or LONG_MIN and
sets ERANGE in a global variable "errno".
[Description]
Converts a string pointed by "nptr" to long integer value using "base" as a base number
of conversion.
Format of strings is as follows.
(whitespaces)(+,-)(0)(x,X)(numeric_characters)
A pointer which points the position where reading is stopped is stored in "endptr". If
"endptr" is NULL, nothing is stored. If a base number is between 2 and 36, conversion
is performed using it. If a base number is zero, the top characters decide a base number
as follows.
- 161 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.4 Convert string to unsigned long value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strtoul
[Syntax]
#include <stdlib.h>
unsigned long strtoul( const char *nptr, char **endptr, int base ) ;
[Arguments]
nptr Pointer to a string.
endptr Pointer which points the position where reading is
stopped.
base Base number.
[Return]
Returns a converted value of unsigned long type. If overflow, returns ULONG_MAX and
sets ERANGE in a global variable "errno".
[Description]
Converts a string pointed by "nptr" to unsigned long integer value using "base" as a
base number of conversion.
Format of strings is as follows.
(whitespaces)(+,-)(0)(x,X)(numeric_characters)
A pointer which points the position where reading is stopped is stored in "endptr". If
"endptr" is NULL, nothing is stored. If a base number is between 2 and 36, conversion
is performed using it.
If a base number is zero, the top characters decide a base number as follows.
- 162 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.5 Generate pseudo-random number. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
rand
[Syntax]
#include <stdlib.h>
int rand( void ) ;
[Arguments]
------
[Return]
Returns a pseudo random number.
[Description]
Returns a pseudo random number between 0 and 32767. "srand" function initializes a series
of random number.
- 163 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.6 Seed pseudo-random number generator. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
srand
[Syntax]
#include <stdlib.h>
void srand( unsigned int seed ) ;
[Arguments]
seed Number of new series.
[Return]
------
[Description]
Initializes a series of random number generated by "rand" function.
- 164 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.7 Allocate memory block initialized by 0. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
calloc
[Syntax]
#include <stdlib.h>
void *calloc( size_t num, size_t size ) ;
[Arguments]
num Number of elements.
size Byte size of element.
[Return]
Returns pointer to the allocated space. To get other type pointer than (void *), cast
the return value. If insufficient memory, returns NULL.
[Description]
Allocates a memory block initialized by zero. That memory block is composed of "num"
elements whose size is "size" bytes. Each element is initialized by zero. Test always
the return value even if requested memory size is small.
- 165 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.8 Free memory block. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
free
[Syntax]
#include <stdlib.h>
void free( void *memblock ) ;
[Arguments]
memblock Memory block already allocated. If NULL, it is
ignored.
[Return]
------
[Description]
Frees allocated memory block. "memblock" is a memory block which was already allocated
by "calloc", "malloc" or "realloc" function. Byte size to be freed is one which was
specified at memory allocation. Deallocated memory block will be used for the next memory
allocations. If any invalid pointer is specified, any error may occur in the future
allocations. "Invalid pointer" is one which was set without correct allocations.
- 166 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.9 Allocate memory block. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
malloc
[Syntax]
#include <stdlib.h>
void *malloc( size_t size ) ;
[Arguments]
size Byte size to be allocated.
[Return]
Returns a void pointer to the allocated memory block. A return value can align with any
object type. To get other type pointer than (void *), cast the return value. If
insufficient memory, returns NULL.
[Description]
Allocates a memory block whose size is "size" bytes at least. More free space than "size"
bytes is used for allocation because of a alignment and management information. Test
always the return value even if requested memory size is small.
- 167 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.10 Reallocate memory block. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
realloc
[Syntax]
#include <stdlib.h>
void *realloc( void *memblock, size_t size ) ;
[Arguments]
memblock Memory block already allocated.
size Byte size to be allocated.
[Return]
Returns a void pointer to the reallocated memory block. A return value can align with
any object type. To get other type pointer than (void *), cast the return value. If "size"
is zero and "memblock" is not NULL, the current block is freed and the return value is
NULL. If insufficient memory for reallocation, the current block is kept and the return
value is NULL.
[Description]
Reallocates the memory block. This changes size of already allocated memory block. If
a new block is placed in the other position, contents in the original block is kept.
If "memblock" is NULL, "realloc" function works as same as "malloc" function, allocates
a new block of "size" bytes. If "size" is not NULL, it must be a pointer which was returned
by "calloc", "malloc" or "realloc" function before. If any invalid pointer is specified,
any errors may occur by incorrect allocation.
- 168 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.11 Perform binary search. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
bsearch
[Syntax]
#include <stdlib.h>
void *bsearch( const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)( const void *, const void *) ) ;
[Arguments]
key Data to be searched.
base Pointer to the top of the array.
nmemb Element number of the array.
size Size of an element of the array.
compar Pointer to the user definition function which compares two elements.
[Return]
Returns a pointer to the matching element. If not found, returns NULL.
[Description]
Searches the specified data in the specified array. The array must be already sorted.
"bsearch" function calls "compar" function for searching. The return value of "compar"
function must follow the following rule.
- 169 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.12 Perform quick sort. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
qsort
[Syntax]
#include <stdlib.h>
void qsort( const void *base, size_t nmemb, size_t size,
int (*compar)( const void *, const void *) ) ;
[Arguments]
base Pointer to the top of the array (its order will be
changed by sorting.)
nmemb Element number of the array.
size Size of an element of the array.
compar Pointer to the user definition function which
compares two elements.
[Return]
------
[Description]
Performs quick sorting of the specified array. "qsort" function calls "compar" function
for searching. The return value of "compar" function must follow the following rule.
- 170 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.13 Get absolute value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
abs
[Syntax]
#include <stdlib.h>
int abs( int j ) ;
[Arguments]
j Value which is converted to absolute.
[Return]
Returns the absolute value of "j".
[Description]
Returns the absolute value of integer "j".
- 171 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.14 Get quotient and remainder. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
div
[Syntax]
#include <stdlib.h>
struct div_t {
int quot ;
int rem ;
} *div( int numer, int denum ) ;
[Arguments]
numer Dividend.
denum Divisor.
[Return]
Returns a structure "div_t".
[Description]
Divides integer value "number" by integer value "denum", and returns the quotient and
reminder. Zero value as "denum" causes a system error. Check values before calling this.
- 172 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.15 Get absolute value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
labs
[Syntax]
#include <stdlib.h>
long labs( long j ) ;
[Arguments]
j Value which is converted to absolute.
[Return]
Returns the absolute value of "j".
[Description]
Returns the absolute value of long integer "j".
- 173 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.16 Get quotient and remainder. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ldiv
[Syntax]
#include <stdlib.h>
struct ldiv_t {
long quot ;
long rem ;
} *ldiv( long numer, long denum ) ;
[Arguments]
numer Dividend.
denum Divisor.
[Return]
Returns a structure "ldiv_t".
[Description]
Divides long integer value "number" by long integer value "denum", and returns the
quotient and remander. Zero value as "denum" causes a system error. Check values before
calling this.
- 174 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
7.17 Convert string to double value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
atof
[Syntax]
#include <stdlib.h>
double atof( const char *nptr ) ;
[Arguments]
nptr Pointer to a string.
[Return]
Returns a converted value of double type.
[Description]
Converts a strings pointed by "nptr" to double type value.
Format of strings is as follows.
(whitespaces)(+,-)num(.num)((d,D,e,E )(+,-)num)
num: numeric_characters
- 175 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
7.18 Convert string to double value. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strtod
[Syntax]
#include <stdlib.h>
double strtod( const char *nptr, char **endptr ) ;
[Arguments]
nptr Pointer to a string.
endptr Pointer which points the position where reading is stopped.
[Return]
Returns a converted value of double type. If overflow, returns +/-HUGE_VAL. If underflow,
returns 0. In both case, sets ERANGE in a global variable "errno".
[Description]
Converts a string pointed by "nptr" to double type value.
Format of strings is as follows.
(whitespaces)(+,-)num(.num)((d,D,e,E )(+,-)num)
num: numeric_characters
A pointer which points the position where reading is stopped is stored in "endptr". If
"endptr" is NULL, nothing is stored.
- 176 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.1 Copy a memory block. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
memcpy
[Syntax]
#include <string.h>
void *memcpy( void *s1, const void *s2, size_t n ) ;
[Arguments]
s1 Pointer to the destination.
s2 Pointer to the source.
n Byte count.
[Return]
Returns a pointer as same as "s1".
[Description]
Copies "n" byte data from the location specified by "s2" to the location specified by
"s1". If the source and the destination are overlapped, the result is undefined. In this
case, use "memmove" function.
- 177 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.2 Move a memory block. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
memmove
[Syntax]
#include <string.h>
void *memmove( void *s1, void *s2, size_t n ) ;
[Arguments]
s1 Pointer to the destination.
s2 Pointer to the source.
n Byte count.
[Return]
Returns a pointer as same as "s1".
[Description]
Moves "n" byte data from the location specified by "s2" to the location specified by
"s1". The memory block is copied correctly even if the source and the destination are
overlapped.
- 178 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.3 Copy a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strcpy
[Syntax]
#include <string.h>
char *strcpy( char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to the destination.
s2 Pointer to the source.
[Return]
Returns a pointer as same as "s1".
[Description]
Copies a string pointed by "s2" to the location pointed by "s1". If the source and the
destination are overlapped, the result is undefined.
- 179 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.4 Copy a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strncpy
[Syntax]
#include <string.h>
char *strncpy( char *s1, const char *s2, size_t n ) ;
[Arguments]
s1 Pointer to the destination.
s2 Pointer to the source.
n Character count.
[Return]
Returns a pointer as same as "s1".
[Description]
Copies a string of "n" characters pointed by "s2" to the location pointed by "s1". If
the length of "s2" string is longer than "n", a NULL character is not added to the copied
string. If the length of "s2" is shorter than "n", NULL characters are added to the copied
string until "n" bytes in total. If the source and the destination are overlapped, the
result is undefined.
- 180 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.5 Concatenate a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strcat
[Syntax]
#include <string.h>
char *strcat( char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to the destination string.
s2 Pointer to the string to be concatenated.
[Return]
Returns a pointer as same as "s1".
[Description]
Concatenates a strings pointed by "s2" to the last of a string pointed by "s1". A NULL
character is added at last.
- 181 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.6 Concatenate a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strncat
[Syntax]
#include <string.h>
char *strncat( char *s1, const char *s2, size_t n ) ;
[Arguments]
s1 Pointer to the destination string.
s2 Pointer to the string to be concatenated.
n Character count to be concatenated.
[Return]
Returns a pointer as same as "s1".
[Description]
The strncat function adds as many characters as specified by argument n of the string
specified by argument s2 to the end of the string specified by argument s1. When the
number of characters in the string specified by argument s2 is greater than the number
specified by argument n, the copied characters is followed by the NULL character. When
the number of characters in the string specified by argument s2 is less than the number
specified by argument n, all characters in the string specified by s2 are added and the
characters are followed by the NULL character. The pointer specified by s1 is returned.
- 182 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.7 Compare two memory blocks. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
memcmp
[Syntax]
#include <string.h>
int memcmp( const void *s1, const void *s2, size_t n ) ;
[Arguments]
s1 Pointer to a memory block to be compared.
s2 Pointer to a memory block to be compared.
n Byte count to be compared.
[Return]
Returns the comparison result.
[Description]
Compare "n" byte data in the location pointed by "s1" with one by "s2".
- 183 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.8 Compare two strings. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strcmp
[Syntax]
#include <string.h>
int strcmp( const char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to a string to be compared.
s2 Pointer to a string to be compared.
[Return]
Returns the comparison result.
[Description]
Compares a string pointed by "s1" with one by "s2".
- 184 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.9 Compare two strings. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strncmp
[Syntax]
#include <string.h>
int strncmp( const char *s1, const char *s2, size_t n ) ;
[Arguments]
s1 Pointer to a string to be compared.
s2 Pointer to a string to be compared.
n Character count to be compared.
[Return]
Returns the comparison result.
- 185 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.10 Find a character in a memory block. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
memchr
[Syntax]
#include <string.h>
void *memchr( const void *s, int c, size_t n ) ;
[Arguments]
s Pointer to a memory block in which data is searched.
c Data to be searched.
n Character count to be searched.
[Return]
Returns a pointer to the first matching data. If not found, returns NULL.
[Description]
Searches "c" in "n" bytes of the memory block specified by "s", and returns the location
of the first matching data. "c" is converted to "unsigned char".
- 186 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.11 Find a character in a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strchr
[Syntax]
#include <string.h>
char *strchr( const char *s, int c ) ;
[Arguments]
s Pointer to a string in which a character is searched.
c Character to be searched.
[Return]
Returns a pointer to the first matching location. If not found, returns NULL.
[Description]
Searches "c" in a string pointed by "s", and returns the location of the first matching
character. "c" is converted to "char".
- 187 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.12 Get string length which doesn't include a character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strcspn
[Syntax]
#include <string.h>
size_t strcspn( const char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to a string.
s2 Pointer to a string.
[Return]
Returns length from the top of "s1" to the part in which any characters of "s2" are not
contained.
[Description]
Returns length from the top of string "s1" to the part of "s1" in which any characters
included in "s2" are not contained.
- 188 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.13 Find a character position in a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strpbrk
[Syntax]
#include <string.h>
char *strpbrk( const char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to a string.
s2 Pointer to a string.
[Return]
Returns a pointer to the first position matching to the one of characters included in
string "s2". If not matching character, returns NULL.
[Description]
Searches one of characters included in string "s2" from the top of the string "s1", and
returns the first matching position.
- 189 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.14 Find the last character in a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strrchr
[Syntax]
#include <string.h>
char *strrchr( const char *s, int c ) ;
[Arguments]
s Pointer to a string in which a character is searched.
c Character to be searched.
[Return]
Returns a pointer to the last matching location. If not found, returns NULL.
[Description]
Searches "c" in a string pointed by "s", and returns the location of the last matching
character. "c" is converted to "char".
- 190 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.15 Get string length composed by specified character. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strspn
[Syntax]
#include <string.h>
size_t strspn( const char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to a string.
s2 Pointer to a string.
[Return]
Returns length from the top of "s1" to the part in which one of characters of "s2" is
contained.
[Description]
Returns length from the top of string "s1" to the part of "s1" in which one of characters
included in "s2" is contained.
- 191 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.16 Find a string in a string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strstr
[Syntax]
#include <string.h>
char *strstr( const char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to a string.
s2 Pointer to a string.
[Return]
Returns a pointer to the first matching location in the string "s1".
If not found, returns NULL.
[Description]
Searches a string "s1" in a string "s1", and returns the pointer to the first matching
location.
- 192 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.17 Get a token. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strtok
[Syntax]
#include <string.h>
char *strtok( char *s1, const char *s2 ) ;
[Arguments]
s1 Pointer to a string. (is changed by processing)
s2 Pointer to a string.
[Return]
Returns a pointer to the token. The token is a string terminated by a NULL character.
If no token, returns NULL.
[Description]
Divide a string "s1" into tokens using each characters of a string "s2" as delimiters.
At the first call, "strtok" searches the first token, and returns a pointer to it. If
the first character of the string is any token, "strtok" ignores it. At the following
calls, specify NULL as the argument "s1". Note that "strtok" function changes a string
"s1".
- 193 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
8.18 Fill data in a memory block. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
memset
[Syntax]
#include <string.h>
void *memset( void *s, int c, size_t n ) ;
[Arguments]
s Pointer to a memory block in where "c" is filled.
c Data to be filled.
n Byte count.
[Return]
Returns a pointer as same as "s".
[Description]
Fills "c" in the "n" byte space from "s".
- 194 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
8.19 Get string length. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
strlen
[Syntax]
#include <string.h>
size_t strlen( const char *s ) ;
[Arguments]
s Pointer to a string.
[Return]
Returns length of string "s".
[Description]
Returns length of string "s".
- 195 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
9.1 Get the current time. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
clock
[Syntax]
#include <time.h>
clock_t clock( void ) ;
[Arguments]
------
[Return]
Returns the current system time counter.
[Description]
Returns the value of the current system time counter. The system time counter is the
accumulated count from the system start-up which is counted up every 8 msec.
(Note) The clock_t type of a return value is the long type, and the return value may
be negative depending on the time accumulated from the system start-up. The return
value must therefore be cast to the unsigned long type before an operation such
as a comparison can be performed on the value.
- 196 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
9.2 Convert local time to calendar time. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
mktime
[Syntax]
#include <time.h>
time_t mktime( struct tm *timeptr ) ;
[Arguments]
timeptr Pointer to a structure "tm".
[Return]
Returns a calendar time.
[Description]
Converts the local time data pointed by *timeptr to a calendar time.
The specified structure "tm" is converted to the standard setting.
- 197 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
9.3 Get the current time. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
time
[Syntax]
#include <time.h>
time_t time( time_t *timer ) ;
[Arguments]
timer Pointer to a time.
[Return]
Returns the current time.
[Description]
Returns the current time as the accumulated second from 1/1/1970 00:00:00. If "timer"
is not NULL, also stores the current time in "*timer".
The time returned by this function is read from the calendar clock of the CNC device.
If the calendar clock is not set correctly, -1L is returned.
- 198 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
9.4 Convert time to string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
asctime
[Syntax]
#include <time.h>
char *asctime( const struct tm *timeptr ) ;
[Arguments]
timeptr Pointer to a structure "tm".
[Return]
Returns a pointer to a converted string.
[Description]
Converts a time data pointed by "timeptr" to a string. The format of string is as follows.
Stored buffer for a converted string is the same static buffer as "ctime" function.
- 199 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
9.5 Convert time to string. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
ctime
[Syntax]
#include <time.h>
char *ctime( const time_t *timer ) ;
[Arguments]
timer Pointer to a timer.
[Return]
Returns a pointer to a converted string.
[Description]
Converts a time data pointed by "timer" to a string as the local time. The format of
string is as follows.
- 200 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
9.6 Convert time to Greenwich mean time. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
gmtime
[Syntax]
#include <time.h>
struct tm *gmtime( const time_t *timer ) ;
[Arguments]
timer Pointer to a timer.
[Return]
Returns a pointer to a converted structure "tm".
[Description]
Converts a timer pointed by "*timer" to a structure "tm" which represents the Greenwich
Mean Time. The second from 1/1/1970 00:00:00 is stored in "*timer". This value is usually
the return value of "time" function. The static buffer for the structure "tm" is shared
by "localtime" function.
- 201 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------
9.7 Convert time to local time. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
localtime
[Syntax]
#include <time.h>
struct tm *localtime( const time_t *timer ) ;
[Arguments]
timer Pointer to a timer.
[Return]
Returns a pointer to a converted structure "tm".
[Description]
Converts a timer pointed by "*timer" to a structure "tm" which represents the local time.
The second from 1/1/1970 00:00:00 is stored in "*timer". This value is usually the return
value of "time" function. The static buffer for the structure "tm" is shared by "gmtime"
function.
- 202 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------
9.8 Compute the difference between the two times. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
difftime
[Syntax]
#include <time.h>
double difftime( time_t time1, time_t time2 ) ;
[Arguments]
time_1 Beginning time.
time_2 Ending time.
[Return]
Returns elapsed time in second between "time2" through "time1".
[Description]
Calculates the difference of time by subtracting "time1" from "time2".
- 203 -
3.Function References PROGRAMMING B-64303EN-3/01
NAME FUNCTION
_chdrive Change the current drive.
_dos_findfirst Find the first file whose attributes match the specified ones.
_dos_findnext Find the next file whose attributes match the specified ones.
_dos_getdiskfree Get disk information’s.
_expand Change a memory block size.
_fcalloc Allocate an array initialized by 0 in memory.
_fexpand Change a memory block size.
_ffree Free a memory block.
_fmalloc Allocate a memory block.
_fmemchr Find a character in a memory block.
_fmemcmp Compare two memory blocks.
_fmemcpy Copy a memory block.
_fmemicmp Compare two memory blocks ignoring cases.
_fmemmove Move a memory block.
_fmemset Fill a memory block with a character.
_fmsize Get memory block size in heap.
_frealloc Reallocate memory block.
_fstrcat Concatenate a string.
_fstrchr Find a character in a string.
_fstrcmp Compare two strings.
_fstrcpy Copy a string.
_fstrcspn Get string length which doesn't include a character.
_fstricmp Compare two strings ignoring cases.
_fstrlen Get string length.
_fstrlwr Convert string to lowercase.
_fstrncat Concatenate a string.
_fstrncmp Compare two strings.
_fstrncpy Copy a string.
_fstrnicmp Compare two strings ignoring cases.
_fstrnset Fill a string with a character.
_fstrpbrk Find a character position in a string.
_fstrrchr Find the last character in a string.
_fstrrev Reverse characters in a string.
_fstrset Fill a string with a character.
_fstrspn Get string length composed by specified character.
_fstrstr Find a string in a string.
_fstrtok Get a token.
- 204 -
B-64303EN-3/01 PROGRAMMING 3.Function References
NAME FUNCTION
_fstrupr Convert string to uppercase.
_getdrive Get the current drive.
_lrotl Rotate an unsigned long left.
_lrotr Rotate an unsigned long right.
_msize Get memory block size in heap.
_rotl Rotate unsigned int left.
_rotr Rotate unsigned int right.
_tolower Convert to lowercase.
_toupper Convert to uppercase.
alloca Allocate a memory block in stack.
cabs Calculate the absolute value of complex number.
chdir Change the current directory.
close Close a file.
creat Create a file.
ecvt Convert double value to string.
eof Test the end of file.
fcvt Convert floating point value to string.
gcvt Convert floating point value and store it in a buffer.
getch Get a character from the console.
getcwd Get the current directory.
hypot Calculate the square root of the sum of two squares.
isascii Test for ASCII character.
itoa Convert an int value to a string.
kbhit Check inputting status of keyboard.
lseek Move the current file pointer.
ltoa Convert a long value to a string.
memicmp Compare two memory blocks ignoring cases.
mkdir Create a new directory.
open Open a file.
read Read data from a file.
rmdir Delete a directory.
stackavail Get available stack size.
strcmpi Compare two strings ignoring cases.
stricmp Compare two strings ignoring cases.
strlwr Convert string to lowercase.
strnicmp Compare two strings ignoring cases.
strnset Fill a string with a character.
strrev Reverse characters in a string.
strset Fill a string with a character.
strupr Convert string to uppercase.
swab Swap two bytes.
tell Get the current position of a file.
- 205 -
3.Function References PROGRAMMING B-64303EN-3/01
NAME FUNCTION
toascii Convert to a ASCII character.
ultoa Convert an unsigned long value to a string.
write Write data to a file.
Determine whether the character of interest is a half-size alphanumeric or katakana
btom
character.
chkctype Count characters.
hantozen Determine what the character type of the character of interest is.
isalkana Convert a 1-byte character to the corresponding 2-byte character.
Determine whether the character of interest is a half-size alphanumeric
isalnmkana
or katakana character
Determine whether the character of interest is a printable ASCII character (except a
isgrkana
half-size space).
Determine whether the character of interest is a printable half-size kana character (except
iskana
a half-size space).
iskanji Determine whether the character of interest is byte 1 of a 2-byte character.
iskanji2 Determine whether the character of interest is byte 2 of a 2-byte character.
iskmoji Determine whether the character of interest is a half-size katakana character.
iskpun Determine whether the character of interest is a half-size kana symbol.
ispnkana Determine whether the character of interest is a half-size symbol.
isprkana Determine whether the character of interest is a printable character.
jisalpha Determine whether the character of interest is a full-size alphabetic character.
jisdigit Determine whether the character of interest is a full-size numeric character.
jishira Determine whether the character of interest is a full-size hiragana character.
jiskata Determine whether the character of interest is a full-size katakana character.
jiskigou Determine whether the character of interest is a full-size symbol.
jisl0 Determine whether the character of interest is a JIS non-kanji character.
jisl1 Determine whether the character of interest is a JIS level 1 kanji character.
jisl2 Determine whether the character of interest is a JIS level 2 kanji character.
jislower Determine whether the character of interest is a full-size lowercase alphabetic character.
jisprint Determine whether the character of interest is a printable character.
jisspace Determine whether the character of interest is a full-size space.
jistojms Convert a JIS kanji code to the corresponding shifted JIS kanji code.
jisupper Determine whether the character of interest is a full-size uppercase alphabetic character.
jiszen Determine whether the character of interest is a 2-byte character.
jmstojis Convert a shifted JIS kanji code to the corresponding JIS kanji code.
jtohira Convert a full-size katakana character to the corresponding full-size hiragana character.
jtokata Convert a full-size hiragana character to the corresponding full-size katakana character.
Convert a full-size uppercase alphabetic character to the corresponding full-size
jtolower
lowercase alphabetic character.
Convert a full-size lowercase alphabetic character to the corresponding full-size
jtoupper
uppercase alphabetic character.
mtob Determine how many bytes are in a character string.
- 206 -
B-64303EN-3/01 PROGRAMMING 3.Function References
NAME FUNCTION
nthctype Determine what the character type of a character in a character string is.
zentohan Convert a 2-byte character to the corresponding 1-byte character.
"getch" and "kbhit" functions are available in the Main task. The other functions are available
in the Main, the Alarm and the Communication tasks.
- 207 -
3.Function References PROGRAMMING B-64303EN-3/01
C Language Executor for Series 0i-D supports the following graphic display device.
For details about the display device, see also Section 3.6, "CRT operation library" below
in Part II, "PROGRAMMING".
This is the display device that is equipped with Series 0i-D.This name is derived from the
display control LSI (VGA compatible accelerator chip for PC) used for them.
The following 4 display modes are supported.
A. 640×400 dots, 16 colors for each dot, overlapped with the character screen
(80-column × 25-line).
B. 640×400 dots, 256 colors for each dot, not overlapped with the character screen.
C. 640×480 dots, 16 colors for each dot, overlapped with the character screen
(80-column × 30-line).
D. 640×480 dots, 256 colors for each dot, not overlapped with the character screen.
The application program can specify the graphic mode by calling"_setvideomode" function.
For details about the function, see "52. _setvideomode" below in Subsection 3.3.3, "Function
reference".
C Language Library provides the following two kinds of the graphic functions.
- 208 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Call the crt_opengr function before calling of the other graphic functions in the user
application.Call the crt_closegr function after a series of graphic drawings. The flow of
the processing is as follows.
:
if ( crt_opengr() ) { /* open graphics */
/* initialize graphic screen */
_setvideomode( _98RESSCOLOR ) ;
:
}
:
: /* graphic drawings */
:
crt_closegr() ; /* close graphic */
:
The graphic drawings are not done without execution of the crt_opengr function.(_GRNOOUTPUT
status will be returned.) The screen switching is inhibited during opening graphics. It is
enabled to switch the screen by the execution of the crt_setswt( CRT_SWT_GREN ) function
before opening graphics, however, the graphics is closed by the screen switching during
opening graphics and graphic drawings are not done until the crt_opengr function will be
called again even if graphic functions are called.
The screen switching request during opening graphics (such as the screen selection by MDI
key) is being pending state until the graphics will be closed, and the pending screen switching
will be performed when the crt_closegr function is called.
(*) For an explanation of the crt_opengr, crt_closegr, and crt_setswt functions, see Section
3.6, "CRT operation library" below in Part II, "PROGRAMMING".
4. Multi-window display.
The multi-window displaying is not available for graphics. The graphic screen is always
displayed on the full screen even if the multi-windows of character are being displayed.
- 209 -
3.Function References PROGRAMMING B-64303EN-3/01
- 210 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 211 -
3.Function References PROGRAMMING B-64303EN-3/01
In the following section, the differences from the graphic functions of MS-C are mainly explained.
Refer the function reference manual of MS-C for the details of each functions. The concrete
behaviors of each functions which are not clearly mentioned in the reference manual of MS-C are
described in "<MS-C Compatible Specification>" part of "[Compatibility]" section.
------------------------------------------------------------------------------------------
1. Draw an arc or an elliptic arc. <Main>
------------------------------------------------------------------------------------------
[Name]
_arc
[Syntax]
#include <graph.h>
short _arc( short rsx, short rsy, short rex, short rey,
short vsx, short vsy, short vex, short vey ) ;
[Description]
Draws an arc or an elliptic arc.
[Compatibility]
(1) The following status is not returned by "_grstatus" function after the execution of this
function.
In this case, the same graphic status is return as _GRNOOUTPUT, and the return value of this
function is always "0". (Could not draw normally)
(2) There may be the difference from specified rectangle by the drawing precision of this
function.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 212 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
2. Clear screen. <Main>
-------------------------------------------------------------------------------------------
[Name]
_clearscreen
[Syntax]
#include <graph.h>
void _clearscreen( short area ) ;
[Description]
Clears specified region and paint it by the current back ground color.
[Compatibility]
(1) "_GWINDOW" is not supported for screen specification because MS-C graphic functions for
window are not supported.
- 213 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
3. Draw a circle or an ellipse. <Main>
-------------------------------------------------------------------------------------------
[Name]
_ellipse
[Syntax]
#include <graph.h>
short _ellipse( short fill, short rsx, short rsy,
short rex, short rey ) ;
[Description]
Draws a circle or an ellipse.
[Compatibility]
(1) The following status is not returned by "_grstatus" function after the execution of this
function.
In this case, the same graphic status is return as _GRNOOUTPUT, and the return value
of this function is always "0".(Could not draw normally) However, the right value is
not returned in case of the _GFILLINTERIOR attribute is specified.
(2) The logical operation of "_setwritemode" is not effective to this function in MS-C, but
effective in C Language Executor. Therefore, the outline (border line) may not be drawn
by specified logical color in case that _GFILLINTERIOR is specified and _GPSET is not
specified in this function.
(3) There may be the difference from specified rectangle by the drawing precision of this
function.
(4) The painting operation may not be done correctly in case that _GFILLINTERIOR is specified
in this function.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 214 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
4. Paint the closed region. <Main>
------------------------------------------------------------------------------------------
[Name]
_floodfill
[Syntax]
#include <graph.h>
short _floodfill( short sx, short sy, short boundary ) ;
[Description]
Paints the region, where is enclosed by specified border color, by the current fill mask
pattern.
[Compatibility]
(1) The error status is not returned in case that the start point is specified out of clipping
region.
(2) The painting may not be executed correctly in case that the same color region as the
current color exists in the enclosed region.
- 215 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
5. Get the current active page number. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getactivepage
[Syntax]
#include <graph.h>
short _getactivepage( void ) ;
[Description]
Gets the page number of the plane to be drawn.
[Compatibility]
This function is compatible with the "_getactivepage" function of MS-C.
- 216 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
6. Get the information of the previous arc or pie. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getarcinfo
[Syntax]
#include <graph.h>
short _getarcinfo( struct _xycoord *start, struct _xycoord *end,
struct _xycoord *fillpoint ) ;
[Description]
Gets the view port coordinates of the arc or pie which has been drawn just previously,
and gets the start coordinate to paint a pie.
[Compatibility]
(1) This function gets the actual drawing start and end coordinates.
(2) The painting start coordinate may be different from what MS-C calculates because the
calculation method is different between C Language Executor and MS-C.
(1) The start point to paint a pie is calculated by supposing the closed region of the arc
which is drawn by the start and end points as same as MS-C.
- 217 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
7. Get the current back ground color. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getbkcolor
[Syntax]
#include <graph.h>
long _getbkcolor( void ) ;
[Description]
Gets the current back ground color.
[Compatibility]
(2) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 218 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
8. Get the current fore ground color. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getcolor
[Syntax]
#include <graph.h>
short _getcolor( void ) ;
[Description]
Gets the palette number of the current fore ground color.
[Compatibility]
This function is compatible with the "_getcolor" function of MS-C.
- 219 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
9. Get the current position in the view coordinate. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getcurrentposition
[Syntax]
#include <graph.h>
struct _xycoord _getcurrentposition( void ) ;
[Description]
Gets the current position in the view coordinate.
[Compatibility]
This function is compatible with the "_getcurrentposition" function of MS-C.
- 220 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
10. Get the current fill mask pattern. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getfillmask
[Syntax]
#include <graph.h>
unsigned char *_getfillmask( unsigned char *mask ) ;
[Description]
Gets the current fill mask pattern.
[Compatibility]
(1) In C Language Executor, "_setfillmask" sets the fill mask pattern as the default status
when the mask data is "full(-1)" for the painting performance. Therefore, this function
may return NULL as the return value if any fill mask pattern is registered.
- 221 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
11. Get the current font information. <Main>
------------------------------------------------------------------------------------------
[Name]
_getfontinfo
[Syntax]
#include <graph.h>
short _getfontinfo( struct _fontinfo *fontbuffer ) ;
[Description]
Gets the current font information and stores it in the buffer.
[Compatibility]
- 222 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
12. Get the text extent by pixel unit. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getgtextextent
[Syntax]
#include <graph.h>
short _getgtextextent( unsigned char *text ) ;
[Description]
Gets the extent of the specified font by pixel unit on the current font information
[Compatibility]
This function is compatible with the "_getgtextextent" function of MS-C.
- 223 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
13. Get the output vector of text. <Main>
------------------------------------------------------------------------------------------
[Name]
_getgtextvector
[Syntax]
#include <graph.h>
struct _xycoord _getgtextvector( void ) ;
[Description]
Gets the output vector of the font text.
[Compatibility]
This function is compatible with the "_getgtextvector" function of MS-C.
- 224 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
14. Get screen image. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getimage
[Syntax]
#include <graph.h>
void _getimage( short rsx, short rsy,
short rex, short rey, char *image ) ;
[Description]
Gets the screen image and stores it in memory.
[Compatibility]
(1) The maximum image size is 64K bytes because "huge" data is unavailable in C Language
Executor.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 225 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
15. Get the font pattern of Kanji character. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getkanji
[Syntax]
#include <graph.h>
short _getkanji( unsigned short code, unsigned char *image ) ;
[Description]
Gets the font pattern of the specified Kanji character.
[Compatibility]
The character pattern format of MS-C for PC-9800 series and for PC-AT are different each
other. This function adopts the PC-9800 format.
The storing order of the character pattern array is as follows.
First the left half is stored, and then the right half is stored.
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
□□□□□□□□ □□□□□□□□
□□□□□□□■ □□□■□□□□
□■■□□■■■ ■■■■■■□□
□□□■□□□■ □□□■□□□□
□□□□□□■■ ■■■■■□□□
□■■□□□■□ □■□□■□□□
□□□■□□■■ ■■■■■□□□
□□□□□□□□ □■□□□□□□
□□□■□□■■ ■■■■■□□□
□□□■□□□□ □■□□□□□□
□□□■□■■■ ■■■■■■□□
□□■□□□□□ ■□■□□□□□
□□■□□□□■ □□□■□□□□
□■■□□■■□ □□□□■■□□
□□□□□□□□ □□□□□□□□
□□□□□□□□ □□□□□□□□
- 226 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 227 -
3.Function References PROGRAMMING B-64303EN-3/01
[Remarks]
(1) Use "crt_reguserchar" function to register the font pattern.
(2) With a 8.4-inch color LCD, there is a limit on character types for which font patterns
can be read in reduced display mode.
Only 128 one-byte characters of character codes 0x20 to 0x5F and 0xA0 to 0xDF can be
handled in reduced display mode.
- 228 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
16. Get the current line style. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getlinestyle
[Syntax]
#include <graph.h>
unsigned short _getlinestyle( void ) ;
[Description]
Gets the current line style.
[Compatibility]
This function is compatible with the "_getlinestyle" function of MS-C.
- 229 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
17. Convert view coordinate into physical. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getphyscoord
[Syntax]
#include <graph.h>
struct _xycoord _getphyscoord( short x, short y ) ;
[Description]
Converts the view coordinate into the physical coordinate.
[Compatibility]
This function is compatible with the "_getphyscoord" function of MS-C.
- 230 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
18. Get color number the pixel. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getpixel
[Syntax]
#include <graph.h>
short _getpixel( short x, short y ) ;
[Description]
Gets the color number of the specified pixel.
[Compatibility]
This function is compatible with the "_getpixel" function of MS-C.
- 231 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
19. Get the current output position of text. <Main>
-------------------------------------------------------------------------------------------
[Name]
_gettextposition
[Syntax]
#include <graph.h>
struct _rccoord _gettextposition( void ) ;
[Description]
Gets the current output position of the text.
[Compatibility]
This function is compatible with the "_gettextposition" function of MS-C.
- 232 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
20. Get the text window border. <Main>
-------------------------------------------------------------------------------------------
[Name]
_gettextwindow
[Syntax]
#include <graph.h>
void _gettextwindow( short *r1, short *c1, short *r2, short *c2 ) ;
[Description]
Gets the window border of the current text window.
[Compatibility]
This function is compatible with the "_gettextwindow" function of MS-C.
- 233 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
21. Get the graphic configuration. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getvideoconfig
[Syntax]
#include <graph.h>
struct videoconfig *_getvideoconfig(
struct videoconfig *config ) ;
[Description]
Gets the information of the hardware about the graphic environment.
[Compatibility]
- 234 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
22. Convert physical coordinate into view. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getviewcoord
[Syntax]
#include <graph.h>
struct _xycoord _getviewcoord( short x, short y ) ;
[Description]
Converts the physical coordinate into the view coordinate.
[Compatibility]
This function is compatible with the "_getviewcoord" function of MS-C.
- 235 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
23. Get the current visual page number. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getvisualpage
[Syntax]
#include <graph.h>
short _getvisualpage( void ) ;
[Description]
Gets the page number of the currently displayed page.
[Compatibility]
This function is compatible with the "_getvisualpage" function of MS-C.
- 236 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
24. Get the current writing mode. <Main>
-------------------------------------------------------------------------------------------
[Name]
_getwritemode
[Syntax]
#include <graph.h>
short _getwritemode( void ) ;
[Description]
Gets the current logical writing mode.
[Compatibility]
This function is compatible with the "_getwritemode" function of MS-C.
- 237 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
25. Get the return status of graphic function. <Main>
------------------------------------------------------------------------------------------
[Name]
_grstatus
[Syntax]
#include <graph.h>
short _grstatus( void ) ;
[Description]
Gets the status of the graphic function which has been executed just before.
[Compatibility]
This function is compatible with the "_grstatus" function of MS-C.
- 238 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
26. Get image buffer size. <Main>
-------------------------------------------------------------------------------------------
[Name]
_imagesize
[Syntax]
#include <graph.h>
long _imagesize( short rsx, short rsy, short rex, short rey ) ;
[Description]
Returns the required buffer size for storing the specified image data by byte unit.
[Compatibility]
This function is compatible with the "_imagesize" function of MS-C.
- 239 -
3.Function References PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
27. Get font pattern size of Kanji character. <Main>
-------------------------------------------------------------------------------------------
[Name]
_kanjisize
[Syntax]
#include <graph.h>
short _kanjisize( short code ) ;
[Description]
Returns the required buffer size for storing the specified font pattern by byte unit.
[Compatibility]
This function is compatible with the "_kanjisize" function of MS-C.
- 240 -
B-64303EN-3/01 PROGRAMMING 3.Function References
-------------------------------------------------------------------------------------------
28. Draw a line. <Main>
-------------------------------------------------------------------------------------------
[Name]
_lineto
[Syntax]
#include <graph.h>
short _lineto( short x, short y ) ;
[Description]
Draws a line from the current pixel cursor to the specified coordinate.
[Compatibility]
(1) The following status is not returned by "_grstatus" function after the execution of this
function.
In this case, the same graphic status is return as _GRNOOUTPUT, and the return value
of this function is always "0". (Could not draw normally)
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 241 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
29. Move the current graphic output position. <Main>
------------------------------------------------------------------------------------------
[Name]
_moveto
[Syntax]
#include <graph.h>
struct xycoord _moveto( short x, short y ) ;
[Description]
Moves the current graphic output position to the specified coordinate.
[Compatibility]
This function is compatible with the "_moveto" function of MS-C.
- 242 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
30. Draw a text string using the current font. <Main>
------------------------------------------------------------------------------------------
[Name]
_outgtext
[Syntax]
#include <graph.h>
void _outgtext( unsigned char *text ) ;
[Description]
Draws a text string on the specified pixel position of the screen using the current font.
[Compatibility]
This function is compatible with the "_outgtext" function of MS-C.
- 243 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
31. Draw a text string in a memory. <Main>
------------------------------------------------------------------------------------------
[Name]
_outmem
[Syntax]
#include <graph.h>
void _outmem( char *text, short length ) ;
[Description]
Draws a text string of the specified length stored in the specified memory buffer.
[Compatibility]
(1) The text string is displayed using text character. The graphic output is not used.
(2) The control code for only '\n' is processed in the text window. The other control code
such as '\t' is not processed.
- 244 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
32. Output a text string on the current position. <Main>
------------------------------------------------------------------------------------------
[Name]
_outtext
[Syntax]
#include <graph.h>
void _outtext( char *text ) ;
[Description]
Outputs a text string on the current text position.
[Compatibility]
(1) The text string is displayed using text character. The graphic output is not used.
(2) The control code for only '\n' is processed in the text window. The other control code
such as '\t' is not processed.
- 245 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
33. Draw a pie figure. <Main>
------------------------------------------------------------------------------------------
[Name]
_pie
[Syntax]
#include <graph.h>
short _pie( short fill, short rsx, short rsy, short rex, short rey,
short vsx, short vsy, short vex, short vey ) ;
[Description]
Draws a pie figure.
[Compatibility]
(1) The following status is not returned by "_grstatus" function after the execution of this
function.
In this case, the same graphic status is return as _GRNOOUTPUT, and the return value
of this function is always "0". (Could not draw normally) However, the right value is
not returned in case of the _GFILLINTERIOR attribute is specified.
(2) The logical operation of "_setwritemode" is not effective to this function in MS-C, but
effective in C Language Executor.Therefore, the outline (border line) may not be drawn
by specified logical color in case that _GFILLINTERIOR is specified and _GPSET is not
specified in this function.
(3) There may be the difference from specified rectangle by the drawing precision of this
function.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 246 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
34. Draw a polygon. <Main>
------------------------------------------------------------------------------------------
[Name]
_polygon
[Syntax]
#include <graph.h>
short _polygon( short fill, struct xycoord *points,
short numpoints ) ;
[Description]
Draws a polygon or paints it.
[Compatibility]
(1) The following status is not returned by "_grstatus" function after the execution of this
function.
In this case, the same graphic status is return as _GRNOOUTPUT, and the return value
of this function is always "0". (Could not draw normally) However, the right value is
not returned in case of the _GFILLINTERIOR attribute is specified.
(2) The maximum number of apexes which is available in this function is 1024.
(3) The painting operation is not performed even if _GFILLINTERIOR is specified in this
function.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 247 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
35. Put image data on the screen. <Main>
------------------------------------------------------------------------------------------
[Name]
_putimage
[Syntax]
#include <graph.h>
void _putimage( short sx, short sy, char *image, short action ) ;
[Description]
Reads image data from the memory and draws it on the screen.
[Compatibility]
(1) The following status is not returned by "_grstatus" function after the execution of this
function.
In this case, the same graphic status is return as _GRNOOUTPUT, and the return value
of this function is always "0". (Could not draw normally)
(2) If a part of the specified graphic image protrudes out of the clipping region, this
function draws only image data in the clipping region.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 248 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
36. Draw a rectangle. <Main>
------------------------------------------------------------------------------------------
[Name]
_rectangle
[Syntax]
#include <graph.h>
short _rectangle( short fill, short rsx, short rsy,
short rex, short rey ) ;
[Description]
Draws a rectangle or paints it.
[Compatibility]
(1) The following status is not returned by "_grstatus" function after the execution of this
function.
In this case, the same graphic status is return as _GRNOOUTPUT, and the return value
of this function is always "0". (Could not draw normally) However, the right value is
not returned in case of the _GFILLINTERIOR attribute is specified.
(2) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 249 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
37. Register font file. <Main>
------------------------------------------------------------------------------------------
[Name]
_registerfonts
[Syntax]
#include <graph.h>
short _registerfonts( unsigned char *pathname ) ;
[Description]
Registers font file and initializes the font library.
[Compatibility]
(1) This function doesn't check the specified file pathname. Therefore, the return value
of the "_grstatus" function is always "_GROK". The return value of this function is always
"1".
(1) It is required to call this function before outputting text strings using "_outgtext"
function. If this function has not been called, "_outgtext" output nothing.
- 250 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
38. Map colors into all color palette. <Main>
------------------------------------------------------------------------------------------
[Name]
_remapallpalette
[Syntax]
#include <graph.h>
short _remapallpalette( long *colors ) ;
[Description]
Changes color values of all color palettes.
[Compatibility]
(1) In MS-C, "Abnormal ended" never occurred. This function sets the suitable number of the
color palettes provided on the current video mode.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
[Remarks]
When the video mode is "_98RES16COLOR(101)", the number of the color palette is 256 in
C Language Executor, but this function changes only 16 palettes for compatibility with
MS-C.
- 251 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
39. Map a color into a color palette. <Main>
------------------------------------------------------------------------------------------
[Name]
_remappalette
[Syntax]
#include <graph.h>
long _remappalette( short index, long color ) ;
[Description]
Changes color value of the specified color palette.
[Compatibility]
(1) Actual operation does not match a description in the MS-C reference manual. When the
value of pallet 0 is changed by the back color setting, this function returns the value.
(2) In MS-C, the return value for successfully execution is always previous set color value
regardless of the current video mode, but this function always returns the color value
just before execution of this function in C Language Executor. That is, this function
doesn't return 0 but the initial setting value for the 1st calling.
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 252 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
40. Set the current active page number. <Main>
------------------------------------------------------------------------------------------
[Name]
_setactivepage
[Syntax]
#include <graph.h>
short _setactivepage( short page ) ;
[Description]
Sets the graphic plane to be drawn.
[Compatibility]
This function is compatible with the "_setactivepage" function of MS-C.
- 253 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
41. Set the current back ground color. <Main>
------------------------------------------------------------------------------------------
[Name]
_setbkcolor
[Syntax]
#include <graph.h>
long _setbkcolor( long color ) ;
[Description]
Sets the current back ground color.
[Compatibility]
(1) Actual operation does not match a description in the MS-C reference manual. When the
value of pallet 0 is changed by the back color setting, this function returns the value.
(2) The following status is not returned by "_grstatus" function after the execution of this
function.
_GRPARAMETERALTERED
(1) The following graphic statuses are returned by the "_grstatus" function after the
execution of this function.
- 254 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
42. Set the clipping region. <Main>
------------------------------------------------------------------------------------------
[Name]
_setcliprgn
[Syntax]
#include <graph.h>
void _setcliprgn( short rsx, short rsy, short rex, short rey ) ;
[Description]
Sets the clipping region for the graphic output.
[Compatibility]
This function is compatible with the "_setcliprgn" function of MS-C.
- 255 -
3.Function References PROGRAMMING B-64303EN-3/01
-----------------------------------------------------------------------------------------
43. Set the current fore ground color. <Main>
-----------------------------------------------------------------------------------------
[Name]
_setcolor
[Syntax]
#include <graph.h>
short _setcolor( short color ) ;
[Description]
Sets the color which is corresponding to the specified palette number
as the current color.
[Compatibility]
This function is compatible with the "_setcolor" function of MS-C.
- 256 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
44. Set the current fill mask pattern. <Main>
------------------------------------------------------------------------------------------
[Name]
_setfillmask
[Syntax]
#include <graph.h>
void _setfillmask( unsigned char *mask ) ;
[Description]
Sets the current fill mask pattern.
[Compatibility]
(1) In C Language Executor, this function sets the fill mask pattern as the default status
when the mask data is "full(-1)" for the painting performance.
- 257 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
45. Set the current font. <Main>
------------------------------------------------------------------------------------------
[Name]
_setfont
[Syntax]
#include <graph.h>
short _setfont( unsigned char *options ) ;
[Description]
Sets the current font for "_outgtext" function.
[Compatibility]
(2) Specify the typename placed in single quotation marks ('') after the option "t".
- 258 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
46. Set the current output vector of text. <Main>
------------------------------------------------------------------------------------------
[Name]
_setgtextvector
[Syntax]
#include <graph.h>
struct _xycoord _setgtextvector( short x, short y ) ;
[Description]
Sets the current output vector of the font text.
[Compatibility]
( x, y ) Output direction
( 0, 0 ) Not changed.
( 1, 0 ) Horizontal. (default)
( 0, 1 ) Rotated 90[deg] to CCW.
(-1, 0 ) Rotated 180[deg].
( 0,-1 ) Rotated 247[deg] to CCW.
- 259 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
47. Set the current line style. <Main>
------------------------------------------------------------------------------------------
[Name]
_setlinestyle
[Syntax]
#include <graph.h>
void _setlinestyle( unsigned short mask ) ;
[Description]
Sets the current line style.
[Compatibility]
This function is compatible with the "_setlinestyle" function of MS-C.
- 260 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
48. Draw a pixel. <Main>
------------------------------------------------------------------------------------------
[Name]
_setpixel
[Syntax]
#include <graph.h>
short _setpixel( short x, short y ) ;
[Description]
Draws a pixel in specified position by the current color.
[Compatibility]
This function is compatible with the "_setpixel" function of MS-C.
- 261 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
49. Set the current output position of text. <Main>
------------------------------------------------------------------------------------------
[Name]
_settextposition
[Syntax]
#include <graph.h>
struct _rccoord _settextposition( short row, short column ) ;
[Description]
Move the current position for outputting text.
[Compatibility]
This function is compatible with the "_settextposition" function of MS-C.
- 262 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
50. Set the text row number. <Main>
------------------------------------------------------------------------------------------
[Name]
_settextrows
[Syntax]
#include <graph.h>
short _settextrows( short rows ) ;
[Description]
Sets the text row number.
[Compatibility]
(1) The maximum line number of each video mode is set for every specification.
(1) The maximum line number of the video mode is set by specifying "_MAXTEXTROWS(-1)".
- 263 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
51. Set the text window. <Main>
------------------------------------------------------------------------------------------
[Name]
_settextwindow
[Syntax]
#include <graph.h>
void _settextwindow( short r1, short c1, short r2, short c2 ) ;
[Description]
Sets the current text window.
[Compatibility]
[Remarks]
The "crt_setmode" function makes the current text window ineffective.
- 264 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
52. Set the screen video mode. <Main>
------------------------------------------------------------------------------------------
[Name]
_setvideomode
[Syntax]
#include <graph.h>
short _setvideomode( short mode ) ;
[Description]
Selects the display mode of the screen.
[Compatibility]
When any mode including parentheses is specified, this function returns "0" (error),
but the initialization of graphic screen is done correctly. (In this case, the
"_grstatus()" function returns "_GRMODENOTSUPPORTED".)
VGA Graphic
Mode Size(Text) Palette (Color mode)
_98RESS16COLOR
_98RESS8COLOR 640×400 (80×25) 16 colors (PC-98)
(_98RESSCOLOR)
_98RES16COLOR
_98RES8COLOR 640×400 256 colors (PC-98)
(_98RESCOLOR)
_VRES16COLOR
640×480 (80×30) 16 colors (PC-AT)
_VRES16EXCOLOR
_VRES256COLOR 640×480 256 colors (PC-AT)
_98TEXT80
Text mode (80×25) 16 colors
_TEXTC80
- 265 -
3.Function References PROGRAMMING B-64303EN-3/01
When a mode shown in parentheses is specified, this function returns "0" (error), but
the initialization of a graphic screen is done correctly. (In this case, the "_grstatus"
function returns "_GRMODENOTSUPPORTED".)
VGA Graphic
Mode Size (Text) Palette (Color mode)
_98RESS16COLOR
_98RESS8COLOR 640×400 (40×16) 16 colors (PC-98)
(_98RESSCOLOR)
_98RES16COLOR
_98RES8COLOR 640×400 256 colors (PC-98)
(_98RESCOLOR)
_VRES16COLOR
640×480 (40×19) 16 colors (PC-AT)
_VRES16EXCOLOR
_VRES256COLOR 640×480 256 colors (PC-AT)
_98TEXT80
Text mode (40×16) 16 colors
_TEXTC80
(2) Use "_CEXERES16COLOR" mode for arbitrary plane size and text mode.
Symbol "_CEXERES16COLOR" is defined in "graph.h".
For the setting of this mode, the function syntax is changed as follows.
#include <crt.h>
#include <graph.h>
short _setvideomode( _CEXERES16COLOR, short origin,
short height, short TXmode ) ;
- 266 -
B-64303EN-3/01 PROGRAMMING 3.Function References
MODE SIZE
CRT_MODE_V25_0 80-column × 25-line (starting line: 1)
CRT_MODE_V25_1 80-column × 25-line (starting line: 2)
CRT_MODE_V25_2 80-column × 25-line (starting line: 3)
CRT_MODE_V25_3 80-column × 25-line (starting line: 4)
CRT_MODE_V25_4 80-column × 25-line (starting line: 5)
CRT_MODE_V25_5 80-column × 25-line (starting line: 6)
CRT_MODE_V30 80-column × 30-line
MODE SIZE
CRT_MODE_V16_0 40-column × 16-line (starting line: 1)
CRT_MODE_V16_1 40-column × 16-line (starting line: 2)
CRT_MODE_V16_2 40-column × 16-line (starting line: 3)
CRT_MODE_V16_3 40-column × 16-line (starting line: 4)
CRT_MODE_V19 40-column × 19-line
(4) The cursor current position is initialized and moved to the home position after the
execution of this function.
If the text screen mode (column or line number in the screen) is changed by this function,
the text screen environment is initialized (as same as "crt_setmode" does), and all
setting about text screen are set as initial state. Set the text screen environment
(cursor display mode, character set, etc.) if necessary.
[Remarks]
(1) Use "crt_setmode" function or "_setvideomode( _CEXRES16COLOR,.. )" to change the
text mode.
(2) With a 8.4-inch color LCD, there is a limit on character types that can be displayed
in reduced display mode.
Only 128 one-byte characters of character codes 0x20 to 0x5F and 0xA0 to 0xdf can
be displayed in reduced display mode. When a lowercase letter is output to a screen,
it is converted to an uppercase letter on the screen display.
- 267 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
53. Set the screen video mode and text row number. <Main>
------------------------------------------------------------------------------------------
[Name]
_setvideomoderows
[Syntax]
#include <graph.h>
short _setvideomoderows( short mode, short rows ) ;
[Description]
Sets the video mode for the text operation and sets the text row
number.
[Compatibility]
(1) The details of the video mode are different from MS-C's. Refer "_setvideomode" function
for more information. "_CEXERES16COLOR" mode is not allowed in this function.
(2) The text row number is always set as the maximum line number of the specified video mode
even if any "rows" is specified.
(4) The cursor current position is initialized and moved to the home position after the
execution of this function.
[Remarks]
Use "crt_setmode" function to change the text mode.
- 268 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
54. Set the origin of the view port. <Main>
------------------------------------------------------------------------------------------
[Name]
_setvieworg
[Syntax]
#include <graph.h>
struct xycoord _setvieworg( short x, short y ) ;
[Description]
Moves the origin of the view port to the specified physical position.
[Compatibility]
This function is compatible with the "_setvieworg" function of MS-C.
- 269 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
55. Set the clipping region and the view coordinate. <Main>
------------------------------------------------------------------------------------------
[Name]
_setviewport
[Syntax]
#include <graph.h>
void _setviewport( short rsx, short rsy, short rex, short rey ) ;
[Description]
Restricts to the graphic output in the specified region on the
screen and sets the origin of the viewport coordinate on its
left-upper corner.
[Compatibility]
This function is compatible with the "_setviewport" function of MS-C.
- 270 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
56. Set the current visual page number. <Main>
------------------------------------------------------------------------------------------
[Name]
_setvisualpage
[Syntax]
#include <graph.h>
short _setvisualpage( short page ) ;
[Description]
Set the page number of the currently displayed page.
[Compatibility]
This function is compatible with the "_setvisualpage" function of MS-C.
- 271 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
57. Set the current writing mode. <Main>
------------------------------------------------------------------------------------------
[Name]
_setwritemode
[Syntax]
#include <graph.h>
short _setwritemode( short action ) ;
[Description]
Sets the current logical writing mode.
[Compatibility]
(1) The effectivity of the logical writing mode is different between PC-98's MS-C and PC-AT's.
In C Language Executor, the effectivity of the logical writing mode is as follows.
- 272 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
58. Delete registered font file. <Main>
------------------------------------------------------------------------------------------
[Name]
_unregisterfonts
[Syntax]
#include <graph.h>
void _unregisterfonts( void ) ;
[Description]
Delete registered font file and free the font library memory.
[Compatibility]
- 273 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
59. Enable/disable line wrapping. <Main>
------------------------------------------------------------------------------------------
[Name]
_wrapon
[Syntax]
#include <graph.h>
short _wrapon( short option ) ;
[Description]
Enable or disable wrapping of the text line.
[Compatibility]
This function is compatible with the "_wrapon" function of MS-C.
- 274 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 275 -
3.Function References PROGRAMMING B-64303EN-3/01
- 276 -
B-64303EN-3/01 PROGRAMMING 3.Function References
C Language Executor graphic library supports the following original graphic functions in addition
to MS-C compatible functions.
- 277 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1. Draw a standard size character. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_displaychar
[Syntax]
#include <graph.h>
void gr_displaychar( int code, short cx, short cy,
short fg, short bg ) ;
[Arguments]
code Character code to be drawn.
cx, cy Coordinate of the left-upper corner at where the
character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws the specified character whose size is same as the text's one (i.e. 8 × 16 dots,
16 x 16 dots for Kanji character) on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color.
When specifying a 2-byte character code with the argument code, store the first byte
in the upper byte. When drawing, for example, (SHIFT-JIS code 8ABF), specify as
follows.gr_displaychar (0x8ABF, ...)
- 278 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2. Draw a quad size character. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_displayfourlarge
[Syntax]
#include <graph.h>
void gr_displayfourlarge( int code, short cx, short cy,
short fg, short bg ) ;
[Arguments]
code Character code to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws the specified character whose dot matrix is 16 × 32 dots on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color. This function
can't draw 2-byte characters such as Japanese Kanji characters. It can draw only half-size
characters whose codes are 0x20 to 0x7F.
- 279 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
3. Draw a hex size character. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_displaysixlarge
[Syntax]
#include <graph.h>
void gr_displaysixlarge( int code, short cx, short cy,
short fg, short bg ) ;
[Arguments]
code Character code to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws the specified hex size character whose dot matrix is 24 × 32 dots on the graphic
screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color. This function
can draw only 'SPACE','0'-'9', 'A'-'Z', '.' and '-'.
- 280 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
4. Put monochrome image data. <Main>
------------------------------------------------------------------------------------------
[Name]
_putpattern
[Syntax]
#include <graph.h>
void _putpattern( short x, short y, void *image, short action,
short fg, short bg ) ;
[Arguments]
x, y Coordinate of the left-upper corner at where the monochrome image is
put.
image Buffer in where monochrome image is stored.
action Logical writing mode.
fg Foreground color.
bg Background color.
[Return]
------
[Description]
Puts the monochrome image pattern stored in "image" in the rectangle regtion whose
left-upper corner is "x,y" on the graphic screen.
Specify the logical writing mode, monochrome image data in buffer and image data on the
screen are operated according to this command, in "action". The logical writing mode
is defined in "graph.h".
Specify the character color and the background color using palette index number. Only
image data is drawn if -32768 (0x8000) is specified as the background color.
Size(byte) = ([WIDTH]+15)/16×2×[HEIGHT]+4
The maximum image size that is available for this function is 4K bytes.
- 281 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
19 dots
f e d c b a 9 8 7 6 5 4 3 2 1 0 7 6 5
0 □□□□□□□□□□□□□□□□ □□□
1 □■■■■□□■■■■□□■□□ □■□
2 □■□□□■□■□□□■□■■□ ■■□
3 □■□□□■□■□□□■□■□■ □■□ 8 dots
4 □■■■■□□■■■■□□■□□ □■□
5 □■□□□□□■□□□□□■□□ □■□
6 □■□□□□□■□□□□□■□□ □■□
7 □□□□□□□□□□□□□□□□ □□□
#include <graph.h>
#define Blue 1
#define White 7
- 282 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
5. Get monochrome image data. <Main>
------------------------------------------------------------------------------------------
[Name]
_getpattern
[Syntax]
#include <graph.h>
void _getpattern( short rsx, short rsy, short rex, short rey,
void *image, short color ) ;
[Arguments]
rsx, rsy, Coordinate of the rectangle region from where the
rex, rey monochrome image data is got.
image Buffer in where the monochrome image data is stored.
color Color to be searched.
[Return]
------
[Description]
Gets the monochrome image data, whose color is same as the specified color palette index
number, in the specified rectangle region. And stores it in the "image".
The buffer size muse be enough big to store the image data.
The buffer size is calculated by the next equation.
Size(byte) = ([WIDTH]+15)/16×2×[HEIGHT]+4
The maximum image size that is available for this function is 4K bytes.
- 283 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program displays a cursor.
#include <graph.h>
#include <malloc.h>
void example( short rsx, short rsy, short ch_num, short OldColor,
short ForColor, short BakColor )
{
char *image ;
long image_size ;
short w, h ;
w = ch_num*8 ;
h = 16 ;
image_size = ( w+15 ) / 16 * 2 * h + 4 ;
if ( image_size > 4096L ) return ;
image = malloc( (short)image_size ) ;
if ( image == NULL ) return ;
_getpattern( rsx, rsy, rsx+w-1, rsy+h-1, image, OldColor ) ;
_putpattern( rsx, rsy, image, _GPSET, ForColor, BakColor ) ;
free( image ) ;
return ;
}
- 284 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
6. Draw a standard size string. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_dispstr
[Syntax]
#include <graph.h>
void gr_dispstr( char *str, short cx, short cy,
short fg, short bg ) ;
[Arguments]
str Character string to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws character string (also Kanji character is available) on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color.
- 285 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
7. Draw a hex size string. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_disp6str
[Syntax]
#include <graph.h>
void gr_disp6str( char *str, short cx, short cy,
short fg, short bg ) ;
[Arguments]
str Character string to be drawn.
cx, cy Coordinate of the left-upper corner at where the
character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws large-size character (24x32 dots) string on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color. This function
can draw only 'SPACE','0'-'9', 'A'-'Z', '.' and '-'.
- 286 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
8. Copy image data. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_bitblt
[Syntax]
#include <graph.h>
void gr_bitblt( short rsx, short rsy, short rex, short rey,
short cx, short cy ) ;
[Arguments]
rsx, rsy, Coordinate of the source rectangle.
rex, rey
cx, cy Destination (upper-left) coordinate.
[Return]
------
[Description]
Copys the image data in the specified rectangle region to the specified destination on
the screen.
- 287 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
9. Draw a quad size string. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_disp4str
[Syntax]
#include <graph.h>
void gr_disp4str( char *str, short cx, short cy,
short fg, short bg ) ;
[Arguments]
str Character string to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws quad-size (16×32 dots) character string on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color. This function
can't draw 2-byte characters such as Japanese Kanji characters. It can draw only half-size
characters whose codes are 0x20 to 0x7F.
- 288 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
10. Draw a small size character. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_displaysmlchar
[Syntax]
#include <graph.h>
void gr_displaysmlchar( int code, short cx, short cy,
short fg, short bg ) ;
[Arguments]
code Character code to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws small size (8×8 dots) character on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color. This function
draws only characters whose codes are 0x20 - 0x5F. If lowercase character is specified,
the converted uppercase character is drawn instead.
- 289 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
11. Draw a small size string. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_dispsstr
[Syntax]
#include <graph.h>
void gr_dispsstr( char *str, short cx, short cy,
short fg, short bg ) ;
[Arguments]
str Character string to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws small size (8×8 dots) character string on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color. This function
draws only characters whose codes are 0x20 - 0x5F.If lowercase character is specified,
the converted uppercase character is drawn instead.
- 290 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
12. Draw a FANUC character. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_displayfchar
[Syntax]
#include <graph.h>
void gr_displayfchar( unsigned int code, short cx, short cy,
short fg, short bg ) ;
[Arguments]
code Character code to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws a character which is specified by FANUC character code on the graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color.
- 291 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
13. Draw a FANUC character string. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_dispfstr
[Syntax]
#include <graph.h>
void gr_dispfstr( unsigned int *code, unsigned int len,
short cx, short cy, short fg, short bg ) ;
[Arguments]
code Array of FANUC character code (0x0000 - 0xFFFF).
len Length of character string.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws a character string which is specified by FANUC character code on the graphic screen.
Store FANUC code (16-bit) of drawn character in each element of the array "code".
Store character length in "len".
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color.
- 292 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
14. Draw 9-inch font character. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_disp9ifchar
[Syntax]
#include <graph.h>
void gr_disp9ifchar( int code, short cx, short cy,
short fg, short bg) ;
[Arguments]
code Character code to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws 8.4-inch font character (16×25 dots or 32×25 dots for Kanji character) on the
graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color.
[Remarks]
Specified character is drawn using FANUC character-generator and FANUC Kanji-set.
- 293 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
15. Draw 9-inch font character string. <Main>
------------------------------------------------------------------------------------------
[Name]
gr_disp9ifstr
[Syntax]
#include <graph.h>
void gr_disp9ifstr( unsigned char *str, short cx, short cy,
short fg, short bg) ;
[Arguments]
str Character string to be drawn.
cx, cy Coordinate of the left-upper corner at where the character is drawn.
fg Character color.
bg Background color.
[Return]
------
[Description]
Draws 8.4-inch font character (16×25 dots or 32×25 dots for Kanji character) on the
graphic screen.
Specify the character color and the background color using palette index number. Only
character is drawn if -32768 (0x8000) is specified as the background color.
[Remarks]
Specified character is drawn using FANUC character-generator and FANUC Kanji-set.
- 294 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
16. Draw a line between specified two points. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_line_b
[Syntax]
#include <fgraph.h>
short mmc_line_b( short x1, short y1, short x2, short y2 ) ;
[Arguments]
x1, y1 View port coordinates of line start point.
x2, y2 View port coordinates of line end point.
[Return]
Returns non-0 value if successful, or 0 if any error.
[Description]
Draws a line between specified two points.
- 295 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
17. Draw a polyline. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_polyline
[Syntax]
#include <fgraph.h>
void mmc_polyline( const struct _xycoord *points, short numpoints ) ;
[Arguments]
points Array of view port coordinates of apexes.
numpoints Number of apexes of polyline.
[Return]
------
[Description]
Draws a polyline.
- 296 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
18. Draw a circle. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_circle_b
[Syntax]
#include <fgraph.h>
short mmc_circle_b( short control, short xc, short yc, short r ) ;
[Arguments]
control Control flag.
xc, yc View port coordinates of the circle center.
r Radius.
[Return]
Returns non-0 value if successful, or 0 if any error.
[Description]
Draws a circle.
Symbol Purpose
_GFILLINTERIOR Fills inside of the object with the current fill mask pattern.
_GBORDER Draws only border line, not fills inside.
- 297 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
19. Draw an ellipse. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_ellipse_b
[Syntax]
#include <fgraph.h>
short mmc_ellipse_b( short control, short xc, short yc, short xr,
short yr ) ;
[Arguments]
control Control flag.
xc, yc View port coordinate of the ellipse center.
xr X-directional radius.
yr Y-directional radius.
[Return]
Returns non-0 value if successful, or 0 if any error.
[Description]
Draws an ellipse.
Symbol Purpose
_GFILLINTERIOR Fills inside of the object with the current fill mask pattern.
_GBORDER Draws only border line, not fills inside.
- 298 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
20. Draw a pie figure. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_pie_b
[Syntax]
#include <fgraph.h>
short mmc_pie_b( short control, short xc, short yc, short xr,
short yr, short d1, short d2 ) ;
[Arguments]
control Control flag.
xc, yc View port coordinate of the circle center.
xr X-directional radius.
yr Y-directional radius.
d1 Angle of drawing start point (-3600..3600 [0.1 deg])
d2 Angle of drawing end point (-3600..3600 [0.1 deg])
[Return]
Returns non-0 value if successful, or 0 if any error.
[Description]
Draws a pie figure.
Symbol Purpose
_GFILLINTERIOR Fills inside of the object with the current fill mask pattern.
_GBORDER Draws only border line, not fills inside.
- 299 -
3.Function References PROGRAMMING B-64303EN-3/01
(Y) (Y)
90[deg] -270[deg]
0[deg] -360[deg]
(X) (X)
180[deg] 360[deg] -180[deg] 0[deg]
270[deg] -90[deg]
Pie figure is drawn counter clock wise (CCW) from the start point to the end point. When
the start point is same as the end point, pie figure is not drawn but only a line which
connects the circle center and start/end point is drawn.
- 300 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
21. Draw an arc. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_arc_b
[Syntax]
#include <fgraph.h>
short mmc_arc_b( short xc, short yc, short xr, short yr, short d1,
short d2 ) ;
[Arguments]
xc, yc View port coordinate of the circle center.
xr X-directional radius.
yr Y-directional radius.
d1 Angle of drawing start point (-3600..3600 [0.1 deg])
d2 Angle of drawing end point (-3600..3600 [0.1 deg])
[Return]
Returns non-0 value if successful, or 0 if any error.
[Description]
Draws an arc.
(Y) (Y)
90[deg] -270[deg]
0[deg] -360[deg]
(X) (X)
180[deg] 360[deg] -180[deg] 0[deg]
270[deg] -90[deg]
Arc is drawn counter clock wise (CCW) from the start point to the end point. When the
start point is same as the end point, arc is not drawn but only a pixel is drawn at the
start/end point.
- 301 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
22. Get character in the specified area. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_gettext
[Syntax]
#include <fgraph.h>
short mmc_gettext( short x1, short y1, short x2, short y2,
_MCHRBUF *chr_buf ) ;
[Arguments]
x1,y1,x2,y2 Screen area (left-upper, right-lower)
chr_buf Buffer memory in where data are stored.
[Return]
0 Successful.
-1 Warning. (Out of screen)
2 Error. (No work memory)
- 302 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads characters in the specified screen area to the memory.
Specify screen area to read as left-upper point of screen (Home position) is (1,1).The
first character is read at the start point (left-upper position),and continuously reads
rightward, jumps to the next line at the right end, the last character is read at the
right-lower position. The required byte size to read is calculated by "mmc_textsize()"
function. Character code and attribute are stored by internal format. The structure of
output buffer is as follows.
0 Column size
2 Line size
If the specified area overruns the screen like below, SPACE character and WHITE attribute
is stored in the overruned region and "Warning" is returned as result.
(1,1)
Screen
Area to be read
(x1,y1)
(80,30)
(x2,y2)
If the start position is at the right-half of double-sized character, only lower byte
of the character code is read. If the end position is at the left-half of double-sized
character, only upper byte of the character code is read. In these case, operation is
done successfully.
- 303 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
23. Put character data on memory to text screen. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_puttext
[Syntax]
#include <fgraph.h>
short mmc_puttext( short x, short y, _MCHRBUF *chr_buf ) ;
[Arguments]
x, y Start position to write.
chr_buf Buffer memory in where data are stored.
[Return]
0 Successful.
-1 Warning. (Out of screen)
2 Error. (No work memory)
[Description]
Writes characters stored on memory to the text screen.
This function writes character data on memory which has been read by "mmc_gettext()"
function. Specify screen area to write as left-upper point of screen (Home position)
is (1,1). If the specified area overruns the screen, the overruned region is not written.
- 304 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
24. Get required byte size for getting character. <Main>
------------------------------------------------------------------------------------------
[Name]
mmc_textsize
[Syntax]
#include <fgraph.h>
short mmc_textsize( short x1, short y1, short x2, short y2 ) ;
[Arguments]
x1,y1,x2,y2 Screen area (left-upper, right-lower)
[Return]
Required byte size to read the specified area.
[Description]
Returns the required byte size to read the specified area.
- 305 -
3.Function References PROGRAMMING B-64303EN-3/01
- 306 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 307 -
3.Function References PROGRAMMING B-64303EN-3/01
- 308 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 309 -
3.Function References PROGRAMMING B-64303EN-3/01
- 310 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 311 -
3.Function References PROGRAMMING B-64303EN-3/01
- 312 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 313 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.1 Read CNC system information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_sysinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_sysinfo( struct odbsys *buf ) ;
struct odbsys {
int dummy[2] ; /* Not used. */
char cnc_type[2] ; /* Kind of CNC (ASCII string). */
char mt_type[2] ; /* Kind of M/T/TT (ASCII string). */
char series[4] ; /* Series number (ASCII string). */
char version[4] ; /* Version number (ASCII string). */
char axes[2] ; /* Amount of controllable axes */
} ; /* (ASCII string). */
[Arguments]
buf Buffer in which system information is stored.
[Return]
A main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads system information such as kind of CNC (for example, "0" as series name), kind
of CNC system such as Machining(M) or Turning(T)/Turning with 2-path control(TT), series
and version number of CNC system software in ROM and an amount of controllable axes.
Use this function to confirm compatibility of CNC's system software and PMC's software
or to get an amount of controllable axes before reading axis coordinate data such as
absolute, machine or skipped position.
Note that a null character ('\x00') is not added at the end of each strings.
- 314 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following informations are gotten by execution of this function on Series 0i-D
(D4F1-01) system with 5-axis.
buf.cnc_type = "0"
buf.mt_type = " M"
buf.series = "D4F1"
buf.version = "0001"
buf.axes = "5 "
- 315 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.2 Start output of NC program to be registered. <Main,Alarm>
-------------------------------------------------------------------------------------------
[Name]
cnc_dwnstart
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_dwnstart( void ) ;
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_PROT( 7) Tape memory of CNC is protected.
EW_BUSY(-1) Start command for output of NC program to be registered has been
rejected.
This code is returned if any of the following conditions exists when
this command is executed.
- The CNC is performing other command processing
(downloading, collating, uploading, or program number list reading).
- Background editing is in progress or the MDI mode has been entered.
- Alarm PW0000 or alarm PS0101 is issued.
[Description]
Requests CNC to start registering of NC program (downloading).
[Example]
See example of "Output NC program to be registered(cnc_download)".
- 316 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.3 Output NC program to be registered. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_download
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_download( char *data, short number ) ;
[Arguments]
data NC program data (ASCII string).
number Character number of NC program data (1 - 256).
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The start-up procedure of CNC for registering NC program has not been
completed, or no start-up command has been commanded.
EW_LENGTH( 2) Incorrect character number "number".
EW_DATA( 5) Incorrect NC program data. This code is returned under one of following
conditions.
- The same program number is already registered.
- A character which is unavailable for NC program is detected.
- When TV check is effective, a block which includes odd characters
(including 'LF' at the end of the block) is detected.
- No more programs can be registered because there is no space for them.
EW_PROT( 7) Write protection.
Any of CNC parameters No. 8000 to No. 8999 or No. 9000 to No. 9999 for
protection or encryption is write-protected.
EW_OVRFLOW( 8) No more NC program can be stored because program memory of CNC is full.
- 317 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Yes
Is there data yet to be output?
No
NC program format
LF 0x0A ('\n').
Oxxxx Program number.
Mxx M code at the end of the program (M02,M30,etc.).
'LF' must be placed at the top of the whole program, and '%' at the end. Data before
'LF' at the top are ignored. Address 'O' and program number must be placed in the program
to be registered.
For example, to register a program such as
O1234 ;
G1 F0.3 W10. ;
M30 ;
%
"\nO1234\nG1F0.3W10.\nM30\n%"
- 318 -
B-64303EN-3/01 PROGRAMMING 3.Function References
"\n"
"O1234\n"
"G1F0.3W10.\n"
"M30\n"
"%"
"\n"
"O1234\nG1F0.3W10.\nM30\n"
"O5678\nM3S1200\nT11\nG0X10.Z0\nM30\n"
"%"
[Example]
The following program registers the next NC program to CNC.
O1234 ;
M3 S1200 ;
G0 Z0 ;
G0 X0 Y0 ;
G1 F500 X120. Y-30. ;
M30 ;
#include <data.h>
#include <fwindow.h>
- 319 -
3.Function References PROGRAMMING B-64303EN-3/01
cnc_dwnend() ;
return ( ret ) ;
}
}
ret = cnc_dwnend() ;
return ( ret ) ;
}
- 320 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.4 Stop output NC program to be registered. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_dwnend
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_dwnend( void ) ;
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The start-up procedure of CNC for registering NC program has not been
completed, or no start-up command has been commanded.
EW_DATA( 5) Incorrect NC program data in previous output.
This code is returned under one of following conditions.
- The same program number is already registered.
- A character which is unavailable for NC program is detected.
- When TV check is effective, a block which includes odd characters
(including 'LF' at the end of the block) is detected.
- No more programs can be registered because there is no space for them.
EW_PROT( 7) Write protection. Any of CNC parameters No. 8000 to No. 8999 or No. 9000
to No. 9999 for protection or encryption is write-protected.
EW_OVRFLOW( 8) NC programs which have been output previously could not registered
because program memory of CNC is full.
[Description]
Notifies the CNC of the completion of NC program registration.
(This function must always be used after downloading has been completed.)
This function may return a cnc_download function error (such as EW_DATA or EW_OVRFLOW).
Control is not returned from this function until registration of data output by the
cnc_download function has been completed.
[Example]
See example of "Output NC program to be registered(cnc_download)".
- 321 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.5 Start output NC program to be compared. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_vrfstart
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_vrfstart( void ) ;
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_BUSY(-1) Start command for output of NC program to be compared has been rejected.
This code is returned if any of the following conditions exists when
this command is executed.
- The CNC is performing other command processing
(downloading, collating, uploading, or program number list reading).
- Background editing is in progress or the MDI mode has been entered.
- Alarm PW0000 or alarm PS0101 is issued.
[Description]
Requests CNC to start comparing of NC program.
[Example]
See example of "Output NC program to be compared(cnc_verify)".
- 322 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.6 Output NC program to be compared. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_verify
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_verify( char *data, int number ) ;
[Arguments]
data NC program data (ASCII string).
number Character number of NC program data (1 - 256).
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The start-up procedure of CNC for comparing NC program
has not been completed, or no start-up command has been
commanded.
EW_LENGTH( 2) Incorrect character number "number".
EW_DATA( 5) Incorrect NC program data. This code is returned under one of following
conditions.
- Any difference has been detected during comparing process.
- A CNC-side program to be compared has been selected in foreground
processing.
- A character which is unavailable for NC program is detected.
- When TV check is effective, a block which includes odd characters
(including 'LF' at the end of the block) is detected.
[Description]
Outputs NC program to be compared with already registered one to CNC.
- 323 -
3.Function References PROGRAMMING B-64303EN-3/01
Yes
Is there data yet to be output?
No
[Example]
The following program compares the next NC program and "O1234" which is already
registered in CNC.
O1234 ;
M3 S1200 ;
G0 Z0 ;
G0 X0 Y0 ;
G1 F500 X120. Y-30. ;
M30 ;
#include <data.h>
#include <fwindow.h>
- 324 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 325 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.7 Stop output NC program to be compared. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_vrfend
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_vrfend( void ) ;
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The start-up procedure of CNC for comparing NC program has not been
completed, or no start-up command has been commanded.
EW_DATA( 5) The previously output NC program data is incorrect.
This code is returned under one of following conditions.
- Any difference has been detected during comparing process.
- A CNC-side program to be compared has been selected in foreground
processing.
- A character which is unavailable for NC program is detected.
- When TV check is effective, a block which includes odd characters
(including 'LF' at the end of the block) is detected.
[Description]
Notices the end of comparison of NC program to CNC.
'%' must be output as NC program data before calling this function.
5 or 8 which has been issued during processing of "Output NC program to be compared"
may be returned.
This function doesn't return until the comparing process of CNC is completed.
The comparing process is completed even if the return code is not "0".
[Example]
See example of "Output NC program to be compared(cnc_verify)".
- 326 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.8 Start input NC program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_upstart
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_upstart( long number ) ;
[Arguments]
number Program number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 1) Unavailable.
EW_DATA( 5) The specified NC program is not registered in CNC.
EW_BUSY(-1) Start command for input of NC program to be uploaded has been rejected.
This code is returned under one of following conditions.
- CNC is executing other requested command (downloading, comparing,
uploading or reading program directory).
- An NC program is running (automatic operation signal OP<F000#7> is
on).
- Background editing is in progress or the MDI mode has been selected.
- Alarm PW0000 or alarm PS0101 is issued.
[Description]
Requests CNC to start reading of NC program (uploading).
(This function must always be executed before uploading can be performed.)
[Example]
See example of "Input NC program(cnc_upload)".
- 327 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.9 Input NC program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_upload
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_upload( struct odbup *buf, short *number ) ;
struct odbup {
short dummy[2] ; /* Not used. */
char data[N] ; /* NC program data (ASCII string). */
} ; /* N: max 256 */
[Arguments]
buf Buffer in which NC program data are stored.
number Size of the above buffer, amount of characters included in input NC
command data characters.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The start-up procedure of CNC for reading NC program has not been
completed, or no start-up command has been commanded.
EW_LENGTH( 2) Incorrect buffer size "number".
- 328 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads (uploads) NC command data registered in the CNC program memory.
No
Is last character '%' reached?
Yes
NC program which is read from CNC is a string composed of ASCII characters as following
format.
LF 0x0A ('\n').
Oxxxx Program number.
Mxx M code at the end of the program (M02,M30, etc.).
A null character ('\x00') is not added at the end of each strings stored in the buffer.
The last character of read NC program is '%'.
Only '%' can be read by attempting to read more data beyond this last '%'.
For example, when you read the following NC program using this function,
O1234 ;
G1 F0.3 W10. ;
M30 ;
%
- 329 -
3.Function References PROGRAMMING B-64303EN-3/01
And in case that the buffer size is less than 24 bytes, you will get the following strings.
[Example]
The following program reads the specified NC program registered in CNC, and displays
its contents on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#define BUFSIZE 40
- 330 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.10 Stop input NC program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_upend
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_upend( void ) ;
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The start-up procedure of CNC for reading NC program
has not been completed, or no start-up command has been commanded.
[Description]
Notifies the library of the completion of NC program reading (uploading).
(This function must always be executed after uploading has been completed.)
[Example]
See example of "Input NC program(cnc_upload)".
- 331 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.11 Search specified program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_search
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_search( long number ) ;
[Arguments]
number Program number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) Unavailable.
EW_DATA( 5) The specified NC program is not registered in CNC.
EW_PROT( 7) Tape memory of CNC is protected.
EW_BUSY(-1) The program search command was rejected.
This code is returned if any of the following conditions exists when
this command is executed.
- The CNC is performing other window command processing
(downloading, collating, uploading, or program number list reading).
- In the EDIT or memory mode, the automatic operation signal
OP<F000 #7> is on.
- In the EDIT or memory mode, alarm PW0000 or alarm PS0101 is issued.
[Description]
Searches the NC program already registered in CNC.
- 332 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program searches the program whose program number is same as specified
one, and displays the result.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 333 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.12 Delete all programs. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_delall
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_delall( void ) ;
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_PROT( 7) Tape memory of CNC is protected, or the target program is protected.
EW_BUSY(-1) In the CNC, the all-program delete command was rejected.
This code is returned if any of the following conditions exists when
this command is executed.
- The CNC is performing other window command processing
(downloading, collating, uploading, or program number list reading).
- An NC program is running (automatic operation signal OP<F000#7>
is on).
- Alarm PW0000, alarm PS0101, or BG alarm is issued.
[Description]
Deletes all NC programs registered in CNC.
This function is equivalent to deletion by "O-9999" in a CNC operation.
Protected programs are not deleted.
- 334 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program deletes all programs and displays the result.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 335 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.13 Delete specified program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_delete
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_delete( long number ) ;
[Arguments]
number Program number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) Unavailable.
EW_DATA( 5) The specified NC program is not registered in CNC.
EW_PROT( 7) Tape memory of CNC is protected, or the target program is protected.
EW_BUSY(-1) In the CNC, the specified-program delete command was rejected.
This code is returned if any of the following conditions exists when
this command is executed.
- The CNC is performing other window command processing
(downloading, collating, uploading, or program number list reading).
- An NC program is running (automatic operation signal OP<F000#7>
is on).
- Alarm PW0000, alarm PS0101, or BG alarm is issued.
[Description]
Deletes the specified NC program registered in CNC.
If the specified program is used for the current automatic operation, it can't be deleted.
The program cannot also be deleted if it is protected.
- 336 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program deletes the program whose program number is same as specified one,
and displays the result.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 337 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.14 Read program directory. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdprogdir
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdprogdir( short type, long datano_s, long datano_e,
short length, struct prgdir *buf ) ;
struct prgdir {
char prg_data[N] ; /* Contents of directory (ASCII */
} ; /* string). N: max 256 */
[Arguments]
type Format of program list (0,1,2).
datano_s Start program number to be read.
datano_e End program number to be read.
length Size of the following buffer for the program directory.
buf Buffer in which the program directory list is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect buffer size "length".
EW_NUMBER( 3) Data number error.
Incorrect program number "datano_s" or "datano_e".
EW_ATTRIB( 4) Incorrect format "type".
- 338 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the list of program numbers (program directory) of all NC programs registered in
CNC.
Program numbers, comments and character numbers of programs included in specified program
number range are read with ASCII string format.
Specify the start program number to be read in "datano_s" and the end one in "datano_e".
Store "datano_s=1" and "datano_e"=9999 to read all programs. Specify the format of
program list in "type".
The program directory list which is read from CNC is a string composed of ASCII characters
as following format.
LF 0x0A ('\n')
Oxxxx Program number. This is a ASCII string
without the leading '0' of numeric
part sorted in numeric order. ("O1" -"O9999")
CHAR_NUMBER Character number of the program.
This is a ASCII string without the leading '0'.
The number is raised to 80-character unit.
COMMENT The comment which is written just after the program
number is stored.
The maximum character number of the comment body is
48. (50 for the body and the before and the behind
parentheses.)
Only beginning 48 characters are stored for the comment
which is longer than 48 characters.
If the program has no comment, only parentheses ("()")
are stored.
- 339 -
3.Function References PROGRAMMING B-64303EN-3/01
For all cases, when no program is registered or there is no program in the specified
range, only '%' is stored.
A null character ('\x00') is not added at the end of each strings stored in the buffer.
For example, when the next programs are registered in CNC, the result of this function,
in case that datano_s=1 and datano_e=9999, is as follows.
- 340 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program reads the registration information of NC program included specified
by the arguments, and displays program number list.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <string.h>
#define BUFSIZE 256
- 341 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.15 Read program information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdproginfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdproginfo( short type, short length, struct odbnc *buf ) ;
struct odbnc {
union {
struct {
short reg_prg ; /* Number of registered programs. */
short unreg_prg ;/* Number of unregistered programs. */
long used_mem ; /* Used memory area (number of characters). */
long unused_mem ;/* Unused memory area (number of characters). */
} bin ;
char asc[31] ; /* Buffer for ASCII string format. */
} u ;
} ;
[Arguments]
type Data type ( =0(binary), 1(ASCII) ).
length Data block length ( =16(binary), 35(ASCII) ).
buf Buffer in which the program information is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect data type "type".
[Description]
Reads the management data of NC programs already registered in CNC.
- 342 -
B-64303EN-3/01 PROGRAMMING 3.Function References
This function returns these data with binary format or ASCII string format. These
informations are same as ones which are displayed in PROGRAM/LIB screen (in EDIT mode)
of CNC.
Output format
type = 0:
Values are stored in "buf" members in binary format.
buf.bin.reg_prg Number of registered programs.
buf.bin.unreg_prg Number of unregistered programs.
buf.bin.used_mem Used memory area (number of characters).
buf.bin.unused_mem Unused memory area (number of characters).
type = 1:
ASCII strings are stored in "buf.u.asc" in the following format.
% LF d1 LF d2 LF d3 LF d4 LF %
LF 0x0A ('\n').
d1 Number of registered programs.
d2 Number of unregistered programs (number of remaining
registerable programs).
d3 Used memory area (number of characters).
d4 Unused memory area (remaining available memory area) (number
of characters).
d1 - d4 are ASCII strings without the leading '0'.
[Example]
The following program reads the management data of NC program, and displays them.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 343 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.16 Read program number in executing. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdprgnum
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdprgnum( struct odbpro *buf ) ;
struct odbpro {
short dummy[2] ; /* Not used. */
long data ; /* Program number in executing. */
long mdata ; /* Program number of the main
program. */
} ;
[Arguments]
buf Buffer in which program numbers are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) Unavailable.
[Description]
Reads program number of the program which is being currently executed in CNC.
If that program is a sub-program, the program number of the main program of it is also
read. The program number which can be read is one of the root program. If the program
in executing is not a sub-program, the main program number is set as 0.
This function is used for management of NC programs in CNC by the application program,
etc.
The program numbers are stored in "buf.data" and 'buf.mdata" with unsigned binary format.
- 344 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The next program displays "CURRENT(O9876) MAIN(O1234)" while the block "O9876/N210"
of the following NC program is being executed.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 345 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.17 Read sequence number in executing. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdseqnum
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdseqnum( struct odbact *buf ) ;
struct odbact {
short dummy[2] ; /* Not used. */
long data ; /* Sequence number in executing. */
} ;
[Arguments]
buf Buffer in which sequence number is stored.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the sequence number of the NC program which is being currently executed in CNC.
If the NC program has no sequence numbers in its all blocks, the sequence number of the
last executed block is read.
This function is used for watch the block being executed or the current process by the
application program, or only displaying the current sequence number.
- 346 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program displays "CURRENT N30" while the block "O1234/N30" of the following
NC program is being executed.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
O1234 ;
N10 M3 S1500 ;
N20 T12 ;
N30 G0 X110. ;
N40 ...
- 347 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.18 Read actual feed rate of controlled axes. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_actf
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_actf( struct odbact *buf ) ;
struct odbact {
short dummy[2] ; /* Not used. */
long data ; /* Actual feed rate (F). */
} ;
[Arguments]
buf Buffer in which the actual feed rate (F) is stored.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the actual feed rate of the controlled axes of CNC.
[Example]
The message "CURRENT F=1200" is displayed if the following program is executed while
the O1234/N20 block in the following NC program is being executed (on the assumption
that the lathe is running in the metric input mode).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
O1234 ;
N10 G98 F1200 ;
N20 G1 U10. W200.
N30 ...
- 348 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.19 Read actual spindle speed. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_acts
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_acts( struct odbact *buf ) ;
struct odbact {
short dummy[2] ; /* Not used. */
long data ; /* Actual spindle speed. */
} ;
[Arguments]
buf Buffer in which the actual spindle speed is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_PARAM( 9) CNC parameter error.
[Description]
Reads the actual rotational speed of the spindle connected to CNC.
The actual spindle speed data is stored in "buf.data" with unsigned binary format.
[Example]
The following program displays "CURRENT S=2470" while the actual rotational speed of
the main spindle is 2470.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 349 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.20 Read absolute position. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_absolute
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_absolute( short axis, short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Absolute position data of */
} ; /* controlled axis. */
/* N is a maximum controlled axis number.*/
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(Number of axes for which data
is to be read) ).
buf Buffer in which the absolute position data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
- 350 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the absolute position data of the controlled axis of CNC.
This function is used for displaying the absolute positions of the controlled axes of
CNC by the application program, etc. Specify one of (1,..,amount of controlled axes)
for each axis or –1 for all axes as axis number in "axis".
The absolute position data is stored in "buf.data" with signed binary format. (The
negative value is represented as 2's complement.) The absolute position data of specified
axis is stored in "buf.data[0]" in case of reading one axis's data.
- 351 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program displays
1: 120005
2: -50119
3: 80
while the absolute position data for each axes are
The 1st axis 120.005
The 2nd axis -50.119
The 3rd axis 0.080
in 3-axis system.
(in case of "mm input" and "IS-B".)
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 352 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.21 Read machine position. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_machine
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_machine( short axis, short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Machine position data of */
} ; /* controlled axis. */
/* N is a maximum controlled axis number.*/
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(Number of axes for which data
is to be read) ).
buf Buffer in which the machine position data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
- 353 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the machine position data of the controlled axis of CNC.
This machine position data is identical to that in the machine coordinate system displayed
on the current position display screen of the CNC.
Therefore, the data is affected by the setting of bit 0 (MCN) of CNC parameter No. 3104.
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the parameter.
This function is used for displaying the machine positions of the controlled axes of
CNC by the application program, etc.
Specify one of (1,..,amount of controlled axes) for each axis or –1 for all axes as axis
number in "axis".
The machine position data is stored in "buf.data" with signed binary format. (The negative
value is represented as 2's complement.) The machine position data of specified axis
is stored in "buf.data[0]"in case of reading one axis's data.
- 354 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program displays "MACHINE 2: -265593" while the machine position data of
the 2nd axis is -26.5593. (in case of "inch output" and "IS-B".)
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 355 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.22 Read relative position. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_relative
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_relative( short axis, short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Relative position data of */
} ; /* controlled axis. */
/* N is a maximum controlled axis number.*/
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(Number of axes for which data
is to be read) ).
buf Buffer in which the relative position data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
- 356 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the relative position data of the controlled axis of CNC.
This relative position data is identical to that in the relative coordinate system
displayed on the current position display screen of the CNC.
The position data is identical to the relative position data in the relative coordinate
system displayed on the current position display screen of the CNC. Therefore, the data
is affected by the settings of bit 4 (DRL) and bit 5 (DRC) of CNC parameter No. 3104
for the M series. The data is affected by the settings of bit 0 (DRP) of CNC parameter
No. 3104 (M series) / the settings of bits 0 (DRP) of No. 3129 and bits 5 (DRC) of No.
3104 (T series). Refer to "Parameter Manual" (B-64310EN) of the CNC for details about
the parameter.
This function is used for displaying the relative positions of the controlled axes of
CNC by the application program, etc.
Specify one of (1,..,amount of controlled axes) for each axis or –1 for all axes as axis
number in "axis".
The relative position data is stored in "buf.data" with signed binary format. (The
negative value is represented as 2's complement.) The relative position data of specified
axis is stored in "buf.data[0]" in case of reading one axis's data.
- 357 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program displays "RELATIVE 4: 900051" while the relative position data
of the 4th axis(rotation axis) is 90.0051.(in case of "IS-C".)
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 358 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.23 Read distance to go. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_distance
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_distance( short axis, short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Amount of distance to go of */
} ; /* controlled axis. */
/* N is a maximum controlled axis number.*/
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(Number of axes for which data
is to be read) ).
buf Buffer in which the amounts of distance to go are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads the amount of distance to go of the controlled axis of CNC.
This amount of distance to go is same as one which is displayed on the current position
screen of CNC.
This function is used for displaying the amount of distance to go of the controlled axes
of CNC by the application program, etc.
Specify one of (1,..,amount of controlled axes) for each axis or –1 for all axes as axis
number in "axis".
The amount of distance to go is stored in "buf.data" with signed binary format. (The
negative value is represented as 2's complement.) The amount of distance to go of
specified axis is stored in "buf.data[0]" in case of reading one axis's data.
- 359 -
3.Function References PROGRAMMING B-64303EN-3/01
- 360 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.24 Read skipped position. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_skip
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_skip( short axis, short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Skipped position data of */
} ; /* controlled axis. */
/* N is a maximum controlled axis number.*/
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(Number of axes for which data
is to be read) ).
buf Buffer in which the skipped position data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads the skipped position of the axis specified by "axis".
- 361 -
3.Function References PROGRAMMING B-64303EN-3/01
The skipped position data of specified axis is stored in "buf.data[0]" in case of reading
one axis's data.
[Example]
The following program displays the skipped position of the 1st and 2nd axes.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 362 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.25 Read servo delay amount. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_srvdelay
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_srvdelay( short axis, short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short dummy ; /* Not used. */
hort type ; /* Axis number. */
long data[N] ; /* Servo delay amount of */
} ; /* controlled axis. */
/* N is a maximum controlled axis number.*/
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(Number of axes for which data
is to be read) ).
buf Buffer in which the servo delay amounts are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads the servo delay amount of the axis specified by "axis".
The decimal point position in the servo delay amount data can be obtained with the “1.67
cnc_getfigure function”.
As an axis number in "axis", specify one of the values in the range from 1 to the number
of controlled axes for reading data of one axis or -1 for reading data of all axes.
- 363 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program displays the servo delay amount of all axes (amount of axes = MAX).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 364 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.26 Read acceleration/deceleration delay amount. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_accdecdly
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_accdecdly( short axis, short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Acceleration/deceleration delay */
} ; /* amount of controlled axis. */
/* N is a maximum controlled axis number.*/
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(Number of axes for which data
is to be read) ).
buf Buffer in which the acceleration/deceleration delay
amounts are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
- 365 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the acceleration/deceleration delay amount of the axis specified by "axis".
The decimal point position in the acceleration/deceleration delay amount data can be
obtained with the “1.67 cnc_getfigure function”.
As an axis number in "axis", specify one of the values in the range from 1 to the number
of controlled axes for reading data of one axis or -1 for reading data of all axes.
[Example]
The following program displays the acceleration/deceleration delay amount of all axes
(amount of axes = MAX).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 366 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.27 Read dynamic data. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rddynamic
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rddynamic( short axis, short length, struct odbdy *buf ) ;
struct odbdy {
short dummy ; /* Not used. */
short axis ; /* Axis number. */
short alarm ; /* Alarm status. */
long prgnum ; /* Program number in executing. */
long prgmnum ; /* Program number of the main prog. */
long seqnum ; /* Sequence number. */
long actf ; /* Actual feed rate. */
long acts ; /* Actual spindle speed. */
union {
struct {
long absolute[32] ; /* Absolute position */
/* data of controlled axis.*/
long machine[32] ; /* Machine position */
/* data of controlled axis.*/
long relative[32] ; /* Relative position */
/* data of controlled axis. */
long distance[32] ; /* Amount of distance*/
/* to go of */
/* controlled axis. */
} faxis ; /* For all axes. */
struct {
long absolute ; /* Absolute position */
/* data of controlled axis. */
long machine ; /* Machine position */
/* data of controlled axis. */
long relative ; /* Relative position */
/* data of controlled axis. */
long distance ; /* Amount of distance*/
/* to go of */
/* controlled axis. */
} oaxis ; /* For one axis. */
} pos ;
} ;
- 367 -
3.Function References PROGRAMMING B-64303EN-3/01
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
(This is effective to only data who have axis attribute.)
length Data block length ( =22+4×4×(Number of axes for which
data is to be read) ).
buf Buffer in which the dynamic data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads various data which are changing every second while NC program is executing at the
same time.
This function is used for getting data to display the current position screen or the
monitoring screen, etc.
The formats of each data are same as "Function used for reading individually". Refer
each functions for formats of data, etc.
Specify one of (1,..,amount of controlled axes) for each axis or –1 for all axes as axis
number in "axis".
The array size of each member of odbdy.pos.faxis, which is used to read data related
to all axes at a time, is fixed at 32 no matter how high the maximum controlled-axis
number is. If the maximum controlled-axis number is lower than 32, no data is stored
to the members that correspond to axis Nos. "maximum controlled-axis number + 1" to 32.
- 368 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 369 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads the dynamic data of all axes (amount of axes = MAX) and
displays them on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 370 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.28 Read CNC status information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_statinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_statinfo( struct odbst *buf ) ;
struct odbst {
short dummy[2]; /* Not used */
short aut; /* OPERATION mode selection */
short run; /* Status of automatic operation */
short motion; /* Status of axis movement, dwell */
short mstb; /* Status of M,S,T,B function */
short emergency; /* Status of emergency stop, rest */
short alarm; /* Status of alarm */
short edit; /* Status of program editing */
} ;
[Arguments]
buf For a 2-path system (T series (2-path control)), all statuses are
provided for each path.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the status informations of CNC which are displayed in the bottom of the NC's screen.
- 371 -
3.Function References PROGRAMMING B-64303EN-3/01
- 372 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 373 -
3.Function References PROGRAMMING B-64303EN-3/01
- Lathe system
- 374 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.29 Read alarm status. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_alarm
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_alarm( struct odbapb *buf ) ;
struct odbapb {
short dummy[2] ; /* Not used. */
short data ; /* Alarm status. */
} ;
[Arguments]
buf Buffer in which the alarm status is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_PARAM( 9) CNC parameter error.
[Description]
Reads the alarm status of CNC. Various types of information items are stored in
"buf.data".
This function is used for watching CNC's alarm status, displaying he maintenance
information or guidance of how to reset the alarm, etc.
- 375 -
3.Function References PROGRAMMING B-64303EN-3/01
- 376 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.30 Read alarm information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdalminfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdalminfo( short type, short alm_type, short length,
struct alminfo *buf ) ;
struct alminfo {
union {
struct {
struct {
long axis ; /* Axis information. */
short alm_no ; /* Alarm number. */
} alm[N] ; /* N is number of messages to be read. */
long data_end ;
} alm1 ;
struct {
struct {
long axis ; /* Axis information. */
short alm_no ; /* Alarm number. */
short msg_len ; /* Message length. */
char alm_msg[32] ; /* Alarm message. */
} alm[N] ; /* N is number of messages to be read. */
long data_end ;
}alm2 ;
} u ;
} ;
[Arguments]
type Data format ( =0(without message), 1(with message) ).
alm_type Kind of alarm ( =0,..,31 ).
length Data block length ( =4+6*N(without message),
4+40*N(with message) ).
buf Buffer in which the alarm information is stored.
- 377 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect data format type "type".
EW_ATTRIB( 4) Incorrect alarm type "alm_type".
[Description]
Reads the detail informations of currently arising CNC alarms.
- 378 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 379 -
3.Function References PROGRAMMING B-64303EN-3/01
Axis information is set in "axis". Occurrence of an alarm for each axis is indicated
by turning on or off the corresponding bit. For an alarm that is not of axis-type, all
bits are turned off.
"1" of each bit indicates any alarm is arising the corresponding axis. When all
bits are "0", the alarm is not axis-type one but any ordinary one. When the same
alarm is arising for the multiple axes, the corresponding multiple bits of the
axis information are set as "1".
"Message length" is a length of the alarm message. A value between 0 and 32 is stored
with binary format.
"Alarm message" the alarm message. It is ASCII string which is same as one displayed
in the CNC's alarm screen.
When no alarms which belong to specified kind arise, only "End of data" is stored.
- 380 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.31 Read tool offset amount. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtofs
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtofs( short number, short type, short length,
struct odbtool *buf ) ;
struct odbtool {
short datano ; /* Offset number. */
short type ; /* Offset type. */
long data ; /* Offset data. */
} ;
[Arguments]
number Offset number.
type Offset type.
length Data block length ( =8 ).
buf Buffer in which the offset amount is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect offset number "number".
(This return code is returned in case that any value except 1,.,(maximum
number of offset) was specified in offset number "number".
EW_ATTRIB( 4) Incorrect offset type "type".
- 381 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the tool offset amount of the number specified by "number" having the type specified
by "type".
The offset amount data is stored in "data" in "buf" in signed binary format.
The unit of the offset amount can be obtained with "1.67 cnc_getfigure function".
"type" specifies the type of an offset to be read (see the table below).
- Lathe system
- 382 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program reads the wear offset amount for an axis related to each specified
tool number. (Lathe series)
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 383 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.32 Write tool offset amount. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrtofs
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrtofs( short number, short type, short length, long data ) ;
[Arguments]
number Offset number.
type Offset type.
length Data block length ( =8 ).
data Offset data.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect offset number "number".
(This return code is returned in case that any valueexcept 1,
,(maximum number of offset) was specified in offset number "number".
EW_ATTRIB( 4) Incorrect offset type "type".
- 384 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Rewrites the tool offset amount of the number specified by "number" having the type
specified by "type", with the value specified by "data".
The offset amount data is stored in "data" in signed binary format.
The unit of the offset amount can be obtained with “1.67 cnc_getfigure function”.
If no distinction is made between tool radius compensation and tool length compensation,
specify tool radius compensation. If no distinction is made between wear compensation
and geometry compensation, specify wear compensation.
- Lathe system
[Example]
The following program rewrites an offset amount having a specified number.
(Machining center series)
#include <data.h>
#include <fwindow.h>
- 385 -
3.Function References PROGRAMMING B-64303EN-3/01
short ret ;
ret = cnc_wrtofs( tidx, 0, 8, offset ) ;
return ( ret ) ;
- 386 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.33 Read tool offset amount (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtofsr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtofsr( short s_number, short type, short e_number,
short length, struct iodbto *buf ) ;
struct iodbto {
short datano_s; /* Start offset number. */
short type; /* Offset type. */
short datano_e; /* End offset number. */
union {
long m_ofs[N]; /* M Series individual. */
long m_ofs_a[N]; /* M Series Memory A all. */
long m_ofs_b[2*N]; /* Unused. */
long m_ofs_c[4*N]; /* M Series Memory C all. */
struct {
short tip ;
long data[1] ;
} m_ofs_at[N] ; /* M Series Memory A all + virtual tool tip direction */
struct {
short tip ;
long data[2] ;
} m_ofs_bt[N] ; /* Unused. */
struct {
short tip ;
long data[4] ;
} m_ofs_ct[5] ; /* M Series Memory C all + virtual tool tip direction */
short t_tip[N]; /* T Series individual, */
/* direction of imaginary */
/* tool nose. */
long t_ofs[N]; /* T Series individual. */
struct {
short tip;
long data[4];
} t_ofs_a[N]; /* T Series Memory A all. */
struct {
short tip;
long data[8];
} t_ofs_b[N]; /* Unused. */
long t_ofs_2g[3*N]; /* T Series second figure all */
struct {
long data[2];
- 387 -
3.Function References PROGRAMMING B-64303EN-3/01
} t_ofs_ex[N];
} u ;
} ; /* N is number of the offset amounts to be read. */
* Memory C is assumed when bit 6 (NGW) of parameter No. 8136 is 0 or Memory A is assumed when
bit 6 is 1.
* "Memory A" in the T series indicates that tool geometry/wear compensation is disabled (bit
6 (NGW) of parameter No. 8136 is 1).
"Memory B" indicates that tool geometry/wear compensation is enabled (bit 6 (NGW) of parameter
No. 8136 is 0).
[Arguments]
s_number Start offset number.
type Offset type.
e_number End offset number.
length Data block length.
buf Buffer in which the offset amounts are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect offset number "s_number" or "e_number".
(This return code is returned in case that any valueexcept 1,
(maximum number of offset) was specified in offset number "s_number"
or "e_number".
EW_ATTRIB( 4) Incorrect offset type "type".
- 388 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the tool offset amounts in the range specified by "s_number" and "e_number" having
the type specified by "type".
The following lists the values for "type", the values for "length" (data block length),
the types of compensation amounts to be read, and the storage locations."
- 389 -
3.Function References PROGRAMMING B-64303EN-3/01
- 390 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program reads and displays the tool offset amounts for all tools on a lathe
(memory B/64 sets).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
#define MAXTOOL 64
- 391 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.34 Write tool offset amount (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrtofsr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrtofsr( short length, struct iodbto *buf ) ;
struct iodbto {
short datano_s; /* Start offset number. */
short type; /* Offset type. */
short datano_e; /* End offset number. */
union {
long m_ofs[N]; /* M Series individual. */
long m_ofs_a[N]; /* M Series Memory A all. */
long m_ofs_b[2*N]; /* Unused. */
long m_ofs_c[4*N]; /* M Series Memory C all. */
struct {
short tip ;
long data[1] ;
} m_ofs_at[N] ; /* M Series Memory A all + virtual tool tip direction */
struct {
short tip ;
long data[2] ;
} m_ofs_bt[N] ; /* Unused. */
struct {
short tip ;
long data[4] ;
} m_ofs_ct[5] ; /* M Series Memory C all + virtual tool tip direction */
short t_tip[N]; /* T Series individual, */
/* direction of imaginary */
/* tool nose. */
long t_ofs[N]; /* T Series individual. */
struct {
short tip;
long data[4];
} t_ofs_a[N]; /* T Series Memory A all. */
struct {
short tip;
long data[8];
} t_ofs_b[N]; /* Unused. */
long t_ofs_2g[3*N]; /* T Series second figure all */
struct {
long data[2];
} t_ofs_ex[N];
- 392 -
B-64303EN-3/01 PROGRAMMING 3.Function References
} u ;
} ; /* N is number of the offset amounts to be read. */
* Memory C is assumed when bit 6 (NGW) of parameter No. 8136 is 0 or Memory A is assumed when
bit 6 is 1.
* “Memory A” in the T series indicates that tool geometry/wear compensation is disabled (bit
6 (NGW) of parameter No. 8136 is 1).
“Memory B” indicates that tool geometry/wear compensation is enabled (bit 6 (NGW) of parameter
No. 8136 is 0).
[Arguments]
length Data block length.
buf Buffer in which the offset amounts are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect offset number "buf.datano_s" or "buf.datano_e".
(This return code is returned in case that any value except 1,
,(maximum number of offset) was specified in offset number "s_number"
or "e_number".
EW_ATTRIB( 4) Incorrect offset type "buf.type".
[Description]
Rewrites the tool offset amounts in the range specified by "datano_s" and "datano_e"
having the type specified by "type".
[Example]
The following program stores all tool offset amounts of Machining-Series(Memory A/64
sets).
#include <data.h>
#include <fwindow.h>
#include <stdlib.h>
#include <string.h>
#define MAXTOOL 64
- 393 -
3.Function References PROGRAMMING B-64303EN-3/01
- 394 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.35 Read work origin offset. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdzofs
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdzofs( short number, short axis, short length,
struct iodbaxis *buf ) ;
struct iodbaxis {
short datano ; /* Offset number. */
short type ; /* Axis number. */
long data[N] ; /* Offset data. */
} ; /* N is a maximum controlled axis number.*/
[Arguments]
number Offset number ( 0, 1,..,6, 7,..,54 ).
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
length Data block length ( =4+4×(amount of axes to be read)).
buf Buffer in which the offset amount is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect of offset number "number". (Any data other
than 0,..,6 or 7,..,54 has been specified.)
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled
axes) has been specified.
EW_NOOPT( 6) There are no required functions.
The related functions;
- Work coordinate system ( G54 to G59 ) (Parameter NWZ(No.8136#0)="0")
- Work coordinate system 48 sets ( G54.1P1-P48 ) (M series only:
Parameter NWN(No.8136#2)="0")
- 395 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the workpiece origin offset amount of the number specified by "number" and the
axis specified by "axis".
The decimal point position can be obtained with the cnc_getfigure function.
The decimal point position can be obtained with the "1.67 cnc_getfigure function".
- 396 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program displays the work origin offset amounts of the specified number
for all axes ( MAX (amount of axes = 32) ).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 397 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.36 Write work origin offset. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrzofs
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrzofs( short length, struct iodbaxis *buf ) ;
struct iodbaxis {
short datano ; /* Offset number. */
short type ; /* Axis number. */
long data[N] ; /* Offset data. */
} ; /* N is a maximum controlled axis number.*/
[Arguments]
length Data block length ( =4+4×(amount of axes to be read)).
buf Buffer in which the offset amount is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect of offset number "number".
(Any data other than 0,..,6 or 7,..,54 has been specified.)
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
EW_DATA( 5) The data in "data" is beyond a settable data range.
EW_NOOPT( 6) There are no required functions.
(See "Read work origin offset(cnc_rdzofs)" for details.)
- 398 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Rewrites the workpiece origin offset amount of the number specified by "datano" and the
axis specified by "type", with the value specified by "data".
The offset amount data is stored in "data[0]" in "buf" in signed binary format.
The offset amount units are the same as those of the cnc_rdzofs function. See an
explanation of that function.
"type" specifies the number of an axis for which the data is to be rewritten.
-1 : All axes
1 to m: One axis (m: number of currently controlled axes)
- 399 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program alters the work origin offset amount of the specified offset number
and axis number.
#include <data.h>
#include <fwindow.h>
- 400 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.37 Read work origin offset (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdzofsr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdzofsr( short s_number, short axis, short e_number,
short length, struct iodbzo *buf ) ;
struct iodbzo {
short datano_s ; /* Start offset number. */
short type ; /* Axis number. */
short datano_e ; /* End offset number. */
long data[32*M] ; /* Offset data. */
} ; /* M is number of work origin */
/* offset amounts to be read. */
[Arguments]
s_number Start offset number ( 0, 1,..,6, 7,..,54 ).
axis Axis number ( =(1,..,amount of controlled axes),or -1 ).
e_number End offset number
length Data block length ( =6+4×(amount of axes to be read)*
(number of offset to be read) ).
buf Buffer in which the offset amounts are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect of offset number "s_number" or "e_number".
(Any data other than 0,..,6 or 7,..,54 has been specified.)
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
EW_NOOPT( 6) There are no required functions.
(See "Read work origin offset(cnc_rdzofs)" for details.)
- 401 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the workpiece origin offset amounts of the axis specified by "axis" in the range
specified by "s_number" and "e_number".
The offset amount data is stored in the "data" array in "buf" in signed binary format.
"s_number" specifies the workpiece origin offset number at which reading starts.
0 : External workpiece origin offset amount
1 to 6 : Workpiece origin offset amount of G54 to G59
7 to 54: Workpiece origin offset amount of G54.1P1 to G54.1P48
- 402 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program reads and displays the work origin offset amounts of G54 to G59
for all the axes (up to 8 axes).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
- 403 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.38 Write work origin offset (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrzofsr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrzofsr( short length, struct iodbzo *buf ) ;
struct iodbzo {
short datano_s ; /* Start offset number. */
short type ; /* Axis number. */
short datano_e ; /* End offset number. */
long data[N*M] ; /* Offset data. */
} ; /* N is a maximum controlled axis number. */
/* M is number of work origin offset amounts */
/* to be written. */
[Arguments]
length Data block length ( =6+4×(amount of axes to be read)*
(number of offset to be written) ).
buf Buffer in which the offset amounts are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect of offset number "datano_s" or "datano_e".
(Any data other than 0,..,6 or 7,..,54 has been specified.)
EW_ATTRIB( 4) Incorrect axis number "type".
Any data other than -1 or (1,..,amount of controlled axes) has been
specified.
EW_DATA( 5) The data in "data" is beyond a settable data range.
EW_NOOPT( 6) There are no required functions.
(See "Read work origin offset(cnc_rdzofs)" for details.)
- 404 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Rewrites the workpiece origin offset amounts of the axis specified by "type" in the range
specified by "datano_s" and "datano_e". The offset amount data is stored in the "data"
array in "buf" in signed binary format.
"datano_s" specifies the workpiece origin offset number at which rewriting starts.
0 : External workpiece origin offset amount
1 to 6 : Workpiece origin offset amount of G54 to G59
7 to 54: Workpiece origin offset amount of G54.1P1 to G54.1P48
"datano_e" specifies the workpiece origin offset number at which rewriting ends.
"type" specifies the number of an axis for which the data is to be rewritten.
-1 : All axes
1 to m: One axis (m: number of currently controlled axes)
- 405 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program alters the work origin offset amount of G54
through G59 for the specified axis.
#include <data.h>
#include <fwindow.h>
#include <string.h>
- 406 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.39 Read parameter. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdparam
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdparam( short number, short axis, short length,
struct iodbpsd *buf ) ;
struct iodbpsd {
short datano; /* parameter number */
short type; /* axis number */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
number Parameter number.
axis Axis number ( =(1,..,amount of controlled axes), or -1, 0 ).
length Data block length ( =4+(byte size of the parameter)×(MAX_AXIS) )
buf Buffer in which the parameter is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect parameter number "number".
EW_ATTRIB( 4) Incorrect axis number "axis".
- 407 -
3.Function References PROGRAMMING B-64303EN-3/01
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads the parameter of the number specified by "number" and the axis specified by "axis"
(only for an axis parameter).
Parameters each have their own data format. Byte, word, and 2-word parameters are
generally in signed binary format.
The data of all axes can be read at once by setting -1 in "axis". The parameter data
of each axis is stored in the "data" array in "buf".
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the parameters.
- 408 -
B-64303EN-3/01 PROGRAMMING 3.Function References
The following shows the data blocks for the parameter size of 4 bytes.
For the parameter size of 1, 2, or 8 bytes, the data size for each parameter (one axis)
is 1, 2, or 8 bytes.
Spindle-related parameters are handled as axis parameters, and the data of the current
number of spindles is valid.
"type" stores the axis number of a parameter that has been read.
"rdata" or "rdatas" stores a real parameter. "prm_val" stores the data and "dec_val"
stores the number of decimal places.
- 409 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads axis names of all controlled axes and displays them.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
- 410 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.40 Write parameter. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrparam
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrparam( short length, struct iodbpsd *buf ) ;
struct iodbpsd {
short datano; /* parameter number */
short type; /* axis number */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
length Data block length ( =4+(byte size of the parameter)×(MAX_AXIS) )
buf Buffer in which the parameter is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect parameter number "datano".
EW_ATTRIB( 4) Incorrect axis number "type".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
EW_PROT( 7 ) Write operation is prohibited.
- 411 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Rewrites the parameter of the number specified by "datano" and the axis specified by
"type" (only for an axis parameter).
Parameters each have their own data format. Byte, word, and 2-word parameters are
generally in signed binary format.
The data of all axes can be rewritten at once by setting -1 in "type". The parameter
data of each axis is stored in the array in "buf".
Note that a bit parameter cannot be read bit by bit. The 8 bits (or 1 byte) that belong
to the same parameter number are read at once, the desired bit or bits are changed, and
the 8-bit data is rewritten.
For some parameters, alarm PW0000 "POWER MUST BE OFF" may be issued when the data is
rewritten.
- 412 -
B-64303EN-3/01 PROGRAMMING 3.Function References
If you try to rewrite a write-protected parameter, such as any of parameters No. 9000
to 9999, an error is returned (return value: EW_PROT).
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the parameters.
The following shows the data blocks for the parameter size of 4 bytes.
For the parameter size of 1, 2, or 8 bytes, the data size for each parameter
(one axis) is 1, 2, or 8 bytes.
Spindle-related parameters are handled as axis parameters, and the data of the current
number of spindles is valid.
(Example) To rewrite a real parameter 12.345, specify prm_val of 12345 and dec_val of
3.
- 413 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program rewrites the stroke limit setting for a specified axis.
#include <data.h>
#include <fwindow.h>
- 414 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.41 Read parameters (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdparar
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdparar( short s_number, short axis, short e_number,
short length, struct iodbpsdr *buf ) ;
struct iodbpsdr {
short datano; /* parameter number */
short type; /* upper byte:type */
/* lower byte:axis */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
s_number Start parameter number.
axis Axis number ( =(1,..,amount of controlled axes), or -1, 0 ).
e_number End parameter number.
length Data block length ( = Sum of [4+(byte size of the parameter)×
(MAX_AXIS)] )
buf Buffer in which the parameters are stored.
- 415 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect parameter number "s_number" or "e_number".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads the parameters of the axis specified by "axis" (only for axis parameters) in the
range specified by "s_number" and "e_number".
Parameters each have their own data format. Byte, word, and 2-word parameters are
generally in signed binary format.
The axis parameters of all axes in the specified range are read by setting -1 in "axis".
There are the following types of parameters with different type and axis attributes for
different parameter numbers.
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the parameters.
- 416 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Refer to "Parameter Manual" (B-64310EN) of the CNC for information about the parameter
numbers that can be specified.
Parameters may be added because of, for example, addition of CNC software functions.
For example, if a parameter is added within the read range, an error may occur (return
value: EW_LENGTH) or the application program may not perform processing correctly. To
prevent these problems, specify a read range containing only a set of consecutive
parameter numbers.
"axis" specifies the number of an axis for which the data is to be read.
A non-axis parameter is read regardless of which value is specified for "axis". When
an axis parameter is included within the specified range, however, an error occurs (return
value: EW_ATTRIB) if 0 is specified for "axis".
"length" specifies the length of a data block needed to store the specified range of
parameters.
The data block for each parameter is as shown below. The specified number of data blocks
are arranged in order (ascending) of parameter number. "length" is the total length of
the data blocks.
The function returns the size of parameters that have actually been read. You can specify
a larger value for "length" than needed.
- 417 -
3.Function References PROGRAMMING B-64303EN-3/01
The following shows the data blocks for the parameter size of 2 bytes. If the parameter
size is 1 to 2 bytes and "length" for each parameter is not a multiple of 4, a dummy
area is required at the end. For the parameter size of 4 or 8 bytes, the data size for
each parameter (one axis) is 4 or 8 bytes, and no dummy area is required.
Spindle-related parameters are handled as axis parameters, and the data of the current
number of spindles is valid.
"rdata" or "rdatas" stores a real parameter. "prm_val" stores the data and "dec_val"
stores the number of decimal places.
- 418 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program reads parameters in a specified range for a specified axis and
displays them on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
- 419 -
3.Function References PROGRAMMING B-64303EN-3/01
}
}
putchar( '\n' ) ;
ptr = (struct iodbpsdr *)(((char *)ptr)+4+8*inc) ;
break ;
/* to be continued on the next page... */
default :
printf( " #%d:", ptr->type & 0xff ) ;
case 0 :
switch ( ptr->type >> 8 ) {
case 0:
printf( " 0x%02X\n",
(unsigned char)(ptr->u.cdata) ) ;
inc = 1+1 ; break ;
case 1:
printf( " %d\n", ptr->u.cdata ) ;
inc = 1+1 ; break ;
case 2:
printf( " %d\n", ptr->u.idata ) ;
inc = 2 ; break ;
case 3:
printf( " %ld\n", ptr->u.ldata ) ;
inc = 4 ; break ;
}
ptr = (struct iodbpsdr *)(((char *)ptr)+4+inc) ;
break ;
}
}
}
else
printf( "ERROR!(%d)\n", ret ) ;
free( buf ) ;
return ( ret ) ;
}
- 420 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.42 Write parameters (multiple output). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrparas
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrparas( short length, struct iodbpsdr *buf ) ;
struct iodbpsdr {
short datano; /* parameter number */
short type; /* upper byte:type */
/* lower byte:axis */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
length Data block length ( = Sum of [4+(byte size of the parameter)×
(MAX_AXIS)] )
buf Buffer in which the parameters are stored.
- 421 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect parameter number "buf.datano".
EW_ATTRIB( 4) Incorrect axis number "buf.type".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
EW_PROT( 7 ) Write operation is prohibited.
[Description]
Rewrites multiple parameters stored in "param".
Parameters each have their own data format. Byte, word, and 2-word parameters are
generally in signed binary format.
There are the following types of parameters with different type and axis attributes for
different parameter numbers.
- 422 -
B-64303EN-3/01 PROGRAMMING 3.Function References
For some parameters, alarm PW0000 "POWER MUST BE OFF" may be issued when the data is
rewritten.
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the parameters.
"length" specifies the length of data blocks that store parameters to be rewritten.
The data block for each parameter is as shown below. The data blocks are arranged in
order (ascending) of parameter number. "length" is the total length of the data blocks.
The following shows the data blocks for the parameter size of 2 bytes. If the parameter
size is 1 to 2 bytes and "length" for each parameter is not a multiple of 4, a dummy
area is required at the end. For the parameter size of 4 or 8 bytes, the data size for
each parameter (one axis) is 4 or 8 bytes, and no dummy area is required.
Spindle-related parameters are handled as axis parameters, and the data of the current
number of spindles is valid.
- 423 -
3.Function References PROGRAMMING B-64303EN-3/01
(Example) To rewrite a real parameter 12.345, specify prm_val of 12345 and dec_val of
3.
[Example]
The following program specifies that M code Nos. 6080 to 6089 be subjected to a macro
call.
#include <data.h>
#include <fwindow.h>
#include <stdlib.h>
- 424 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.43 Read setting parameter. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdset
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdset( short number, short axis, short length,
struct iodbpsd *buf ) ;
struct iodbpsd {
short datano; /* setting data number */
short type; /* axis number */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
number Setting parameter number.
axis Axis number ( =(1,..,amount of controlled axes), or -1, 0 ).
length Data block length ( =4+(byte size of the setting parameter)×
(MAX_AXIS) )
buf Buffer in which the setting parameter is stored.
- 425 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect setting parameter number "number".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads the setting parameter of the number specified by "number" and the axis specified
by "axis" (only for an axis setting parameter).
Setting parameters each have their own data format. Byte, word, and 2-word setting
parameters are generally in signed binary format.
There are the following types of setting parameters with different type and axis
attributes for different setting parameter numbers.
- 426 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the setting
parameters.
"axis" specifies the number of an axis for which the data is to be read.
0 : Non-axis setting parameter
1 to m: Axis setting parameter, one axis (m: maximum number of controlled axes)
-1 : Axis setting parameter, all axes
The following shows the data blocks for the setting parameter size of 4 bytes. For the
setting parameter size of 1, 2, or 8 bytes, the data size for each setting parameter
(one axis) is 1, 2, or 8 bytes.
Spindle-related setting parameters are handled as axis setting parameters, and the data
of the current number of spindles is valid.
"datano" stores the number of a setting parameter that has been read.
"type" stores the axis number of a setting parameter that has been read.
- 427 -
3.Function References PROGRAMMING B-64303EN-3/01
"rdata" or "rdatas" stores a real setting parameter. "prm_val" stores the data and
"dec_val" stores the number of decimal places.
(Example) When prm_val is 12345 and dec_val is 3, a real setting parameter is 12.345.
[Example]
The following program changes the input unit to inch.
#include <data.h>
#include <fwindow.h>
- 428 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.44 Write setting parameter. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrset
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrset( short length, struct iodbpsd *buf ) ;
struct iodbpsd {
short datano; /* setting data number */
short type; /* axis number */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
length Data block length ( =4+(byte size of the setting parameter)×
(MAX_AXIS) )
buf Buffer in which the setting parameter is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect setting parameter number "datano".
EW_ATTRIB( 4) Incorrect axis number "type".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
- 429 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Rewrites the setting parameter of the number specified by "datano" and the axis specified
by "type" (only for an axis setting parameter). Setting parameters each have their own
data format. Byte, word, and 2-word setting parameters are generally in signed binary
format.
The data of all axes can be rewritten at once by setting -1 in "type". The setting parameter
data of each axis is stored in the array in "buf".
There are the following types of setting parameters with different type and axis
attributes for different setting parameter numbers.
This function is the same as the cnc_wrparam function, except that parameters for which
setting input is disabled cannot be rewritten.
- 430 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the setting
parameters.
The following shows the data blocks for the setting parameter size of 4 bytes. For the
setting parameter size of 1, 2, or 8 bytes, the data size for each setting parameter
(one axis) is 1, 2, or 8 bytes.
Spindle-related parameters are handled as axis parameters, and the data of the current
number of spindles is valid.
(Example) To rewrite a real parameter 12.345, specify prm_val of 12345 and dec_val of
3.
[Example]
See [Example] in "Read setting parameter (cnc_rdset)."
- 431 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.45 Read setting parameters (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdsetr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdsetr( short s_number, short axis, short e_number,
short length, struct iodbpsdr *buf ) ;
struct iodbpsdr {
short datano; /* setting data number */
short type; /* upper byte:type */
/* lower byte:axis */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
s_number Start setting parameter number.
axis Axis number ( =(1,..,amount of controlled axes), or -1, 0 ).
e_number End setting parameter number.
length Data block length (= Sum of [4+(byte size of the parameter)×
(MAX_AXIS)])
buf Buffer in which the setting parameters are stored.
- 432 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect setting parameter number "s_number" or "e_number".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
[Description]
Reads the setting parameters of the axis specified by "axis" (only for axis setting
parameters) in the range specified by "s_number" and "e_number".
Setting parameters each have their own data format. Byte, word, and 2-word setting
parameters are generally in signed binary format.
The axis setting parameters of all axes in the specified range are read by setting -1
in "axis".
There are the following types of setting parameters with different type and axis
attributes for different setting parameter numbers.
This function is the same as the cnc_rdparar function described in "Read parameters (range
specified)," except that parameters for which setting input is disabled cannot be read.
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the parameters.
- 433 -
3.Function References PROGRAMMING B-64303EN-3/01
"s_number" is a pointer to the variable that specifies the setting parameter number at
which reading starts. The function returns the number of the first setting parameter
that has actually been read.
Refer to "Parameter Manual" (B-64310EN) of the CNC for information about the setting
parameter numbers that can be specified.
"e_number" is a pointer to the variable that specifies the setting parameter number at
which reading ends. The function returns the number of the last setting parameter that
has actually been read.
Setting parameters may be added because of, for example, addition of CNC software
functions. For example, if a setting parameter is added within the read range, an error
may occur (return value: EW_LENGTH) or the application program may not perform processing
correctly. To prevent these problems, specify a read range containing only a set of
consecutive setting parameter numbers.
"axis" specifies the number of an axis for which the data is to be read.
0 : Non-axis setting parameter
1 to m : Axis setting parameter, one axis (m: maximum number of controlled axes)
-1 : All axes
A non-axis setting parameter is read regardless of which value is specified for "axis".
When an axis setting parameter is included within the specified range, however, an error
occurs (return value: EW_ATTRIB) if 0 is specified for "axis".
"length" is a pointer to the variable that specifies the length of a data block needed
to store the specified range of setting parameters.
The data block for each setting parameter is as shown below. The specified number of
data blocks are arranged in order (ascending) of setting parameter number. "length" is
the total length of the data blocks.
The function returns the size of setting parameters that have actually been read. You
can specify a larger value for "length" than needed.
The following shows the data blocks for the setting parameter size of 2 bytes. If the
setting parameter size is 1 to 2 bytes and "length" for each setting parameter is not
a multiple of 4, a dummy area is required at the end.
- 434 -
B-64303EN-3/01 PROGRAMMING 3.Function References
For the setting parameter size of 4 or 8 bytes, the data size for each setting parameter
(one axis) is 4 or 8 bytes, and no dummy area is required.
Spindle-related setting parameters are handled as axis setting parameters, and the data
of the current number of spindles is valid.
"datano" stores the number of a setting parameter that has been read.
"type" stores the attribute of a setting parameter that has been read.
Upper byte: Type attribute
0 : Bit
1 : Byte
2 : Word
3 : 2-word
4 : Real
Lower byte : Axis number
0 : Non-axis setting parameter
1 to m: Axis setting parameter, one axis
(m: maximum number of controlled axes)
-1 : Axis setting parameter, all axes
"rdata" or "rdatas" stores a real setting parameter. "prm_val" stores the data and
"dec_val" stores the number of decimal places.
(Example) When prm_val is 12345 and dec_val is 3, a real setting parameter is 12.345.
[Example]
This function can be used in the same manner as described in "Read parameters (range
specified) (cnc_rdparar)." See [Example] in this section.
- 435 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.46 Write setting parameters (multiple output). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrsets
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrsets( short length, struct iodbpsdr *buf ) ;
struct iodbpsdr {
short datano; /* setting data number */
short type; /* upper byte:type */
/* lower byte:axis */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[N]; /* bit/byte set. data with axis */
short idatas[N]; /* word set. data with axis */
long ldatas[N]; /* 2-word set. data with axis */
REALPRM rdatas[N]; /* real set. data with axis */
} u;
} ; N is a maximum controlled axis number.
[Arguments]
length Data block length ( = Sum of [4+(byte size of the setting parameter)
×(MAX_AXIS)] )
buf Buffer in which the setting parameters are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect setting parameter number "buf.datano".
- 436 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Rewrites multiple setting parameters stored in "set".
Setting parameters each have their own data format. Byte, word, and 2-word setting
parameters are generally in signed binary format.
The data of all axes can be rewritten at once by setting -1 in "type". The setting parameter
data of each axis is stored in the array in "buf".
There are the following types of setting parameters with different type and axis
attributes for different setting parameter numbers.
This function is the same as the cnc_wrparas function, except that parameters for which
setting input is disabled cannot be rewritten.
- 437 -
3.Function References PROGRAMMING B-64303EN-3/01
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the setting
parameters.
"length" specifies the length of data blocks that store setting parameters to be
rewritten.
The data block for each setting parameter is as shown below. The data blocks are arranged
in order (ascending) of setting parameter number. "length" is the total length of the
data blocks.
The following shows the data blocks for the setting parameter size of 2 bytes. If the
setting parameter size is 1 to 2 bytes and "length" for each setting parameter is not
a multiple of 4, a dummy area is required at the end. For the setting parameter size
of 4 or 8 bytes, the data size for each setting parameter (one axis) is 4 or 8 bytes,
and no dummy area is required.
No axis/one axis All axes
buf 0┌───┐ ─ 0┌───┐ ─
│datano│ ↑ │datano│ ↑
2├───┤ │ 2├───┤ │
│type │length per │type │ length per
4├───┤setting parameter 4├───┤ setting parameter
│idata │ │ │idatas[0]:Axis 1 │
6├───┤ │ 6├───┤ │
│dummy │ ↓ ~ ~ │
8└───┘ ─ 4+2×(n-1)├───┤ │
│idatas[n-1]:Axis n│
4+2×n├───┤ │
│dummy(n is odd) ↓
└───┘ ─
n = maximum number of controlled axes
Spindle-related setting parameters are handled as axis setting parameters, and the data
of the current number of spindles is valid.
- 438 -
B-64303EN-3/01 PROGRAMMING 3.Function References
(Example) To rewrite a real parameter 12.345, specify prm_val of 12345 and dec_val
of 3.
[Example]
This function can be used in the same manner as described in "Write parameters (multiple
output) (cnc_wrparas)." See [Example] in this section.
- 439 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.47 Read pitch error compensation data (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpitchr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdpitchr( short s_number, short e_number, short length,
struct iodbpi *buf ) ;
struct iodbpi {
short datano_s ; /* Start pitch error compensation */
/* data number. */
short dummy ; /* Not used. */
short datano_e ; /* End pitch error compensation */
/* data number. */
char data[N] ; /* Pitch error compensation data. */
} ; /* N is the amount of compensation */
/* data to be read. */
[Arguments]
s_number Start pitch error compensation number.
e_number End pitch error compensation number.
length Data block length ( =6+(number of compensation data to be read) )
buf Buffer in which the pitch error compensation data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect pitch error compensation number "s_number" or "e_number".
EW_NOOPT( 6) The stored pitch error compensation function is not added.
Enabled the stored pitch error compensation function (bit 0 (NPE) of
parameter No. 8135 is 0).
[Description]
Reads the pitch error compensation data in the range specified by "s_number" and
"e_number".
- 440 -
B-64303EN-3/01 PROGRAMMING 3.Function References
The compensation data is stored in the "data" array in "buf" in signed binary format.
[Example]
The following program reads the pitch error compensation data within
the specified number range and displays them.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
- 441 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.48 Write pitch error compensation data (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrpitchr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrpitchr( short length, struct iodbpi *buf ) ;
struct iodbpi {
short datano_s ; /* Start pitch error compensation */
/* number. */
short dummy ; /* Not used. */
short datano_e ; /* End pitch error compensation */
/* number. */
char data[N] ; /* Pitch error compensation data. */
} ; /* N is number of compensation data */
/* to be written. */
[Arguments]
length Data block length ( =6+(number of compensation data to be written) )
buf Buffer in which the pitch error compensation data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect pitch error compensation number "buf.datano_s" or
"buf.datano_e".
EW_DATA( 5) Data number error.
The pitch error compensation data in "data" is out of a settable data
range.
EW_NOOPT( 6) The stored pitch error compensation function is not added.
Enabled the stored pitch error compensation function (bit 0 (NPE) of
parameter No. 8135 is 0).
[Description]
Rewrites the pitch error compensation data in the range specified by "datano_s" and
"datano_e".
- 442 -
B-64303EN-3/01 PROGRAMMING 3.Function References
The compensation data is stored in the "data" array in "buf" in signed binary format.
"datano_s" specifies the pitch error compensation data number at which rewriting starts.
"datano_e" specifies the pitch error compensation data number at which rewriting ends.
[Example]
The following program alters the pitch error compensation data within the specified
number range.
#include <data.h>
#include <fwindow.h>
#include <stdlib.h>
- 443 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.49 Read custom macro variable. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmacro
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdmacro( short number, short length, struct odbm *buf ) ;
struct odbm {
short dummy ; /* Not used. */
short datano ; /* Custom macro variable number. */
long mcr_val ; /* Custom macro variable value. */
short dec_val ; /* Digit number after decimal point.*/
} ;
[Arguments]
number Custom macro variable number.
length Data block length ( =10 ).
buf Buffer in which the custom macro variable data is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect custom macro variable number "number".
EW_NOOPT( 6) There are no required functions.
The related functions;
- Custom macro. (Enabled when bit 5 (NMC) of parameter No. 8135 is 0.)
- Custom macro common variable addition (#100 to #199 and #500 to #999)
(Enabled when bit 6 (NCV) of parameter No. 8135 is 0.)
- 444 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the custom macro variable of the number specified by "number".
The types of custom macro variables that can be read are as follows.
"mcr_val" is always returned with 9 digits, which are adjusted by the value of
"dec_val".
A custom macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
buf 0┌─────┐ ─
│datano │ ↑
2├─────┤ │
│dummy │ │
4├─────┴─────┐length
│mcr_val │ │
8├─────┬─────┘ │
│dec_val │ ↓
10└─────┘ ─
- 445 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads the custom macro variable data of specified number and
displays it.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <string.h>
- 446 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.50 Write custom macro variable. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrmacro
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrmacro( short number, short length, long mcr_val
, short dec_val ) ;
[Arguments]
number Custom macro variable number.
length Data block length ( =10 ).
mcr_val Custom macro variable value.
dec_val Digit number after decimal point.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect custom macro variable number "number".
EW_DATA( 5) Value of the custom macro variable is out of the limit.
EW_NOOPT( 6) There are no required functions.
The related functions;
- Custom macro. (Enabled when bit 5 (NMC) of parameter No. 8135 is 0.))
- Custom macro common variable addition (#100 to #199 and #500 to #999)
(Enabled when bit 6 (NCV) of parameter No. 8135 is 0.)
[Description]
Rewrites the custom macro variable of the number specified by "number".
The data is stored in "mcr_val" and "dec_val buf" in signed binary format.
The types of custom macro variables that can be rewritten are as follows. Local variables
cannot be rewritten.
- 447 -
3.Function References PROGRAMMING B-64303EN-3/01
A custom macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
[Example]
The following program writes the specified value in the specified
custom macro variable.
#include <data.h>
#include <fwindow.h>
- 448 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.51 Read custom macro variables (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmacror
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdmacror( short s_number, short e_number, short length,
struct iodbmr *buf ) ;
struct iodbmr {
short datano_s ; /* Start custom macro variable number.*/
short dummy ; /* Not used. */
short datano_e ; /* End custom macro variable number.*/
struct {
long mcr_val ; /* Custom macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} data[N] ; /* N is number of variables to be read. */
} ;
[Arguments]
s_number Start custom macro variable number.
e_number End custom macro variable number.
length Data block length ( =6+6×(number of variables to be read) )
buf Buffer in which the custom macro variable data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect custom macro variable number "datano_s" or "datano_e".
EW_NOOPT( 6) There are no required functions.
The related functions;
- Custom macro. (Enabled when bit 5 (NMC) of parameter No. 8135 is 0.))
- Custom macro common variable addition (#100 to #199 and #500 to #999)
(Enabled when bit 6 (NCV) of parameter No. 8135 is 0.)
[Description]
Reads the custom macro variables in the range specified by "s_number" and "e_number".
- 449 -
3.Function References PROGRAMMING B-64303EN-3/01
The types of custom macro variables that can be read are as follows.
"mcr_val" is always returned with 9 digits, which are adjusted by the value of
"dec_val".
A custom macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
- 450 -
B-64303EN-3/01 PROGRAMMING 3.Function References
buf 0┌─────┐ ─
│datano_s │ ↑
2├─────┤ │
│dummy │ │
4├─────┤ │
│datano_e │ │
6├─────┤ │
│ │ │
8├─────┴─────┐ │
│data[0].mcr_val │length
12├─────┬─────┘ │
│data[0].dec_val │
14├─────┤ │
│ │ │
16├─────┴─────┐ │
~ ~ │
8+8×(N-1)├─────┴─────┐ │
│data[N-1].mcr_val │ │
├─────┬─────┘ │
│data[N-1].dec_val │
├─────┤ │
│ │ ↓
8+8×N└─────┘ ─
[Example]
The following program reads the custom macro variables within the specified range and
displays them.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
- 451 -
3.Function References PROGRAMMING B-64303EN-3/01
buf->data[idx].mcr_val ) ;
if ( strbuf[1] == '0' ) strbuf[1] = ' ' ;
strncpy( &strbuf[0], &strbuf[1],
9 - buf->data[idx].dec_val ) ;
strbuf[9-buf->data[idx].dec_val] = '.' ;
printf( "#%04d %s\n", start+idx, strbuf ) ;
}
else
printf( "ERROR!(%d)\n", ret ) ;
free( buf ) ;
return ( ret ) ;
}
- 452 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.52 Write custom macro variables (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrmacror
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrmacror( short length, struct iodbmr *buf ) ;
struct iodbmr {
short datano_s ; /* Start custom macro variable number. */
short dummy ; /* Not used. */
short datano_e ; /* End custom macro variable number. */
struct {
long mcr_val ; /* Custom macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} data[N] ; /* N is number of variables to be written. */
} ;
[Arguments]
length Data block length ( =6+6*(number of variables to be written) )
buf Buffer in which the custom macro variable data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect custom macro variable number "datano_s" or "datano_e".
EW_DATA( 5) Value of the custom macro variable is out of the limit.
EW_NOOPT( 6) There are no required functions.
The related functions;
- Custom macro. (Enabled when bit 5 (NMC) of parameter No. 8135 is 0.))
- Custom macro common variable addition (#100 to #199 and #500 to #999)
(Enabled when bit 6 (NCV) of parameter No. 8135 is 0.)
[Description]
Rewrites the custom macro variables in the range specified by "datano_s" and "datano_e".
- 453 -
3.Function References PROGRAMMING B-64303EN-3/01
The types of custom macro variables that can be rewritten are as follows. Local variables
cannot be rewritten.
A custom macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
buf 0┌─────┐ ─
│datano_s │ ↑
2├─────┤ │
│dummy │ │
4├─────┤ │
│datano_e │ │
6├─────┤ │
│ │ │
8├─────┴─────┐ │
│data[0].mcr_val │length
12├─────┬─────┘ │
│data[0].dec_val │
14├─────┤ │
│ │ │
16├─────┴─────┐ │
~ ~ │
8+8×(N-1)├─────┴─────┐ │
│data[N-1].mcr_val │ │
├─────┬─────┘ │
│data[N-1].dec_val │
├─────┤ │
│ │ ↓
8+8×N└─────┘ ─
N is the number of custom macro variables to be rewritten.
- 454 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program writes the integer values into the custom macro variables within
the specified range.
#include <data.h>
#include <fwindow.h>
#include <stdlib.h>
- 455 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.53 Read P-code macro variable. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpmacro
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdpmacro( long number, struct odbpm *buf ) ;
struct odbpm {
long datano ; /* P-code macro variable number. */
short dummy ; /* Not used. */
union {
struct {
long mcr_val ; /* P-code macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} p6 ;
struct {
short mcr_val ; /* P-code macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} p2 ;
} u ;
} ;
[Arguments]
number P-code macro variable number. ( >= 10000 )
buf Buffer in which the P-code macro variable data is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Incorrect P-code macro variable number "number".
EW_NOOPT( 6) Macro executor option isn't added, or macro module isn't loaded.
- 456 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the P-code macro variable (macro executor variable) of the number specified by
"number".
"mcr_val" is always returned with 9 digits, which are adjusted by the value of "dec_val".
(Example) A variable value of 12.345 is read as shown below.
mcr_val = 123450000
dec_val = 7
A P-code macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
[Example]
The following program reads and displays a P-code macro variable having a specified
number.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <string.h>
- 457 -
3.Function References PROGRAMMING B-64303EN-3/01
strbuf[9-buf.u.p6.dec_val] = '.' ;
printf( "%s\n", strbuf ) ;
}
else
printf( "**********\n" ) ;
return ( ret ) ;
}
- 458 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.54 Write P-code macro variable. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrpmacro
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrpmacro( long number, long mcr_val, short dec_val ) ;
[Arguments]
number P-code macro variable number. ( >= 10000 )
mcr_val P-code macro variable value.
dec_val Digit number after decimal point.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Incorrect P-code macro variable number "number".
EW_DATA( 5) Data error.
The P-code macro variable value is beyond a valid range.
EW_NOOPT( 6) Macro executor option isn't added, or macro module isn't loaded.
[Description]
Rewrites the P-code macro variable (macro executor variable) of the number specified
by "number".
A P-code macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
- 459 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program writes the specified value in the specified P-code macro variable.
#include <data.h>
#include <fwindow.h>
- 460 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.55 Read P-code macro variables (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpmacror
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdpmacror( long s_number, long e_number, short length,
struct iodbpr *buf ) ;
struct iodbpr {
long datano_s ; /* Start P-code macro variable number. */
short dummy ; /* Not used. */
long datano_e ; /* End P-code macro variable number. */
union {
struct {
long mcr_val ; /* P-code macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} p6_r ;
struct {
short mcr_val ; /* P-code macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} p2_r ;
} pm_r[N] ; /* N is number of variables to be read. */
} ;
[Arguments]
s_number Start P-code macro variable number.
e_number End P-code macro variable number.
length Data block length ( =10+6*(number of variables to be read) )
buf Buffer in which the P-code macro variable data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect P-code macro variable number "s_number" or "e_number".
EW_NOOPT( 6) Macro executor option isn't added, or macro module isn't loaded.
- 461 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the P-code macro variables (macro executor variables) in the range specified by
"s_number" and "e_number".
"mcr_val" is always returned with 9 digits, which are adjusted by the value of
"dec_val".
A P-code macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
buf 0┌───────────┐ ─
│datano_s │ ↑
4├─────┬─────┘ │
│dummy │ │
6├─────┤ │
│ │ │
8├─────┴─────┐ │
│datano_e │ │
12├───────────┤ │
│pm_r[0].p6_r.mcr_val │ │length
16├─────┬─────┘ │
│pm_r[0].p6_r.dec_val │
18├─────┤ │
│ │ │
20├─────┴─────┐ │
~ ~ │
- 462 -
B-64303EN-3/01 PROGRAMMING 3.Function References
12+8×(N-1)├─────┴─────┐ │
│pm_r[N-1].p6_r.mcr_val│ │
├─────┬─────┘ │
│pm_r[N-1].p6_r.dec_val │
├─────┤ │
│ │ ↓
12+8×N└─────┘ ─
"datano_s" stores the number of the first P-code macro variable that has actually been
read.
"datano_e" stores the number of the last P-code macro variable that has actually been
read.
[Example]
The following program reads and displays P code macro variables in a specified range.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
- 463 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.56 Write P-code macro variables (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrpmacror
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrpmacror( short length, struct iodbpr *buf ) ;
struct iodbpr {
long datano_s ; /* Start P-code macro variable number. */
short dummy ; /* Not used. */
long datano_e ; /* End P-code macro variable number. */
union {
struct {
long mcr_val ; /* P-code macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} p6_r ;
struct {
short mcr_val ; /* P-code macro variable value. */
short dec_val ; /* Digit number after decimal */
/* point. */
} p2_r ;
} pm_r[N] ; /* N is number of variables to be read. */
} ;
[Arguments]
length Data block length ( =10+6*(number of variables to be written) )
datano_s Start P-code macro variable number. ( >= 10000 )
datano_e End P-code macro variable number.
mcr_val P-code macro variable value.
dec_val Digit number after decimal point.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect P-code macro variable number "s_number"or "e_number".
EW_DATA( 5) Data error.
The P-code macro variable value is beyond a valid range.
EW_NOOPT( 6) Macro executor option isn't added, or macro module isn't loaded.
- 464 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Rewrites the P-code macro variables (macro executor variables) in the range specified
by "datano_s" and "datano_e".
A P-code macro variable may have a special value "blank", which is represented as shown
below.
mcr_val = 0
dec_val = -1
buf 0┌───────────┐ ─
│datano_s │ ↑
4├─────┬─────┘ │
│dummy │ │
6├─────┤ │
│ │ │
8├─────┴─────┐ │
│datano_e │ │
12├───────────┤ │
│pm_r[0].p6_r.mcr_val │ │length
16├─────┬─────┘ │
│pm_r[0].p6_r.dec_val │
18├─────┤ │
│ │ │
20├─────┴─────┐ │
~ ~ │
12+8×(N-1)├─────┴─────┐ │
│pm_r[N-1].p6_r.mcr_val│ │
├─────┬─────┘ │
│pm_r[N-1].p6_r.dec_val │
├─────┤ │
│ │ ↓
12+8×N└─────┘ ─
- 465 -
3.Function References PROGRAMMING B-64303EN-3/01
"datano_s" specifies the P-code macro variable number at which rewriting starts.
"datano_e" specifies the P-code macro variable number at which rewriting ends.
"mcr_val" specifies the variable value (mantissa) of the P-code macro variable.
"dec_val" specifies the number of decimal places (exponent) of the P-code macro variable.
[Example]
The following program writes the integer values into the P-code macro variables within
the specified range.
#include <data.h>
#include <fwindow.h>
#include <stdlib.h>
- 466 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.57 Read diagnostics data. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_diagnoss
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_diagnoss( short number, short axis, short length,
struct iodbpsd *buf ) ;
struct iodbpsd {
short datano; /* diagnosis number */
short type; /* axis number */
union {
char cdata; /* bit/byte diagnosis */
short idata; /* word diagnosis */
long ldata; /* 2-word diagnosis */
char cdatas[N]; /*bit/byte diagnosis with axis*/
short idatas[N]; /* word diagnosis with axis */
long ldatas[N]; /* 2-word diagnosis with axis */
} u ; /* N : max. controlled axes */
} ;
[Arguments]
number Diagnostic number.
axis Axis number ( =(1,..,amount of controlled axes), or -1, 0 ).
length Data block length
( =4+(byte size of the diagnostics data)×(amount of axes to be read) )
buf Buffer in which the diagnostics data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect diagnostic number "number".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
EW_NOOPT( 6) A function required to use data having a specified diagnose data
number has not been added.
- 467 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the diagnostics data of the number specified by "number" and the axis specified
by "axis" (only for axis diagnostics data).
Diagnostics data items each have their own data format. Byte, word, and 2-word diagnostics
data items are generally in signed binary format.
The data of all axes can be read at once by setting -1 in "axis". The diagnostics data
of each axis is stored in the array in "buf".
There are the following types of diagnostics data items with different type and axis
attributes for different diagnostics data numbers.
Note that bit diagnostics data cannot be read bit by bit. The 8 bits (or 1 byte) that
belong to the same diagnostics data number are read at once.
Refer to "Maintenance Manual" (B-64305EN) of the CNC for details about the diagnostics
data items.
- 468 -
B-64303EN-3/01 PROGRAMMING 3.Function References
"datano" stores the number of diagnostics data that has been read.
"type" stores the axis number of diagnostics data that has been read.
In "rdatas", "dgn_val" stores the data and "dec_val" stores the number of decimal places.
- 469 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads information about what operation status the CNC is in and
displays the information on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 470 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.58 Read diagnostics data (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_diagnosr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_diagnosr( short s_number, short axis, short e_number,
short length, struct iodbpsdr *buf ) ;
struct iodbpsdr {
short datano; /* diagnosis number */
short type; /* upper byte:type */
/* lower byte:axis */
union {
char cdata; /* bit/byte diagnosis */
short idata; /* word diagnosis */
long ldata; /* 2-word diagnosis */
char cdatas[N]; /*bit/byte diagnosis with axis*/
short idatas[N]; /* word diagnosis with axis */
long ldatas[N]; /* N is a maximum controlled axis number. */
} u ;
} ;
[Arguments]
s_number Start diagnostic number.
axis Axis number ( =(1,..,amount of controlled axes), or 1, 0 ).
e_num End diagnostic number.
length Data block length
( = Sum of [4+(byte size of the diagnostics data)×
(amount of axes to be read)] )
buf Buffer in which the diagnostics data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect diagnostic number "s_number" or "e_number".
EW_ATTRIB( 4) Incorrect axis number "axis".
Any data other than -1, 0 or (1,..,amount of controlled axes) has been
specified.
EW_NOOPT( 6) A function required to use data having a specified diagnose data
number has not been added.
- 471 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the diagnostics data of the axis specified by "axis" (only for axis diagnostics
data) in the range specified by "s_number" and "e_number".
Diagnostics data items each have their own data format. Byte, word, and 2-word diagnostics
data items are generally in signed binary format.
The diagnostics data of all axes in the specified range is read by setting -1 in "axis".
There are the following types of diagnostics data items with different type and axis
attributes for different diagnostics data numbers.
Note that bit diagnostics data cannot be read bit by bit. The 8 bits (or 1 byte) that
belong to the same diagnostics data number are read at once.
Refer to "Maintenance Manual" (B-64305EN) of the CNC for details about the diagnostics
data items.
"s_number" specifies the diagnostics data number at which reading starts. The function
returns the number of the first diagnostics data that has actually been read.
"e_number" specifies the diagnostics data number at which reading ends. The function
returns the number of the last diagnostics data that has actually been read.
Diagnostics data may be added because of, for example, addition of CNC software functions.
For example, if diagnostics data is added within the read range, an error may occur (return
value: EW_LENGTH) or the application program may not perform processing correctly. To
prevent these problems, specify a read range containing only a set of consecutive
diagnostics data numbers.
- 472 -
B-64303EN-3/01 PROGRAMMING 3.Function References
"axis" specifies the number of an axis for which the data is to be read.
0 : Non-axis diagnostics data
1 to m : Axis diagnostics data, one axis
(m: maximum number of controlled axes)
-1 : Axis diagnostics data, all axes
Non-diagnostics data is read regardless of which value is specified for "axis". When
axis diagnostics data is included within the specified range, however, an error occurs
(return value: EW_ATTRIB) if 0 is specified for "axis".
"length" specifies the length of a data block needed to store the specified range of
diagnostics data. The data block for each diagnostics data item is as shown below. The
specified number of data blocks are arranged in order (ascending) of diagnostics data
number. "length" is the total length of the data blocks.
The function returns the size of diagnostics data that has actually been read. You can
specify a larger value for "length" than needed.
The following shows the data blocks for the diagnostics data size of 2 bytes.
If the diagnostics data size is 1 to 2 bytes and "length" for each diagnostics data item
is not a multiple of 4, a dummy area is required at the end. For the diagnostics data
size of 4 or 8 bytes, the data size for each diagnostics data item (one axis) is 4 or
8 bytes, and no dummy area is required.
- 473 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads diagnose data in a specified range for a specified axis
and displays it on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
- 474 -
B-64303EN-3/01 PROGRAMMING 3.Function References
break ;
/* to be continued on the next page... */
default :
printf( " #%d:", ptr->type & 0xff ) ;
case 0:
switch ( ptr->type >> 8 ) {
case 0:
printf( " %02X\n", ptr->u.cdata ) ;
inc = 2 ; break ;
case 1:
printf( " %d\n", ptr->u.idata ) ;
inc = 2 ; break ;
case 2:
printf( " %ld\n", ptr->u.ldata ) ;
inc = 4 ; break ;
}
ptr = (struct iodbpsdr *)(((char *)ptr)+4+inc) ;
break ;
}
}
}
else
printf( "ERROR!(%d)\n", ret ) ;
free( buf ) ;
return ( ret ) ;
}
- 475 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.59 Read A/D conversion data. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_adcnv
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_adcnv( short inp_type, short av_type, struct odbad *buf ) ;
struct odbad {
short datano ; /* Kind of analog voltage. */
short type ; /* Input channel or controlled axis number. */
short data ; /* Voltage data. */
} ;
[Arguments]
inp_type Kind of analog voltage ( =0, 2 ).
av_type Controlled axis number of CNC.
( 1,..,(amount of controlled axes) )
buf Buffer in which the A/D conversion data is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Data number error.
Incorrect analog voltage input type "inp_type".
EW_ATTRIB( 4) Incorrect input channel or controlled axis number "av_type".
- 476 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reading the load information of the controlled axis of the CNC.
Reads the load current data of the controlled axis of the CNC which is converted into
analog voltage via A/D converter.
Specify digital voltage data converted from an analog voltage by the A/D converter in
"data".
The load current is converted into a digital value and then stored in binary format.
The load current (A) can be calculated from this value by the following expression.
- 477 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.60 Read operator's message. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdopmsg
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdopmsg( short type , short length, struct msg *buf ) ;
struct msg {
short datano0 ; /* Operator's message number. */
short type ; /* Kind of operator's message. */
short char_num ; /* Message length. */
char data[N] ; /* Operator's message. */
} ; /* N is maximum length of string. */
[Arguments]
type Kind of the operator's message ( =0,1,2,3 ).
length Data block length ( =6+(maximum length of string) )
buf Buffer in which the operator's message is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
EW_ATTRIB( 4) Incorrect kind of the operator's message "type".
EW_NOOPT( 6) External message or option of external data input isn't added.
[Description]
Reads the contents of the CNC operator's message.
- 478 -
B-64303EN-3/01 PROGRAMMING 3.Function References
0┌───────────┐ ──
│ datano │ ↑
2├───────────┤ │
│ type │ │
4├───────────┤ │
│ char_num │ │
6├─────┬─────┘length
│ data[0] │ │
7├─────┤ │
~ ~ │
6+255├─────┤ │
│ data[255]│ ↓
6+256└─────┘ ──
"data" sets the string of the operator's message. The string is terminated by '\0'.
The message is obtained with any of the following character codes.
English ASCII
Japanese Shifted JIS
Chinese (traditional) Shifted JIS
Chinese (simplified) GB2312
Russian Code page 1251
Turkish Code page 1254
Other European language European character code
- 479 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads the operator's message and displays it.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 480 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.61 Set path index (2-path system (T series)). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_setpath
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_setpath( int path_no ) ;
[Arguments]
path_no Path number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_PATH(11) Incorrect path number "path_no".
[Description]
Selects the path number which is the target path in the 2-path system (T series (2-path
control)).
All Data window library functions input from/output to the CNC's path selected by this
function. CNC module configuration information is read.
- 481 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program sets up a specified path and processing target path.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
else
printf( "ERROR!(%d)\n", ret ) ;
return ( ret ) ;
}
- 482 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.62 Get path index (2-path system (T series)). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_getpath
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_getpath( short *path_no, short *maxpath_no ) ;
[Arguments]
path_no Current selected path number.
maxpath_no Maximum path number.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the current selected path number which is the target path of the Data window
functions.
"maxpath_no" specifies the address of a variable for obtaining the maximum path number.
[Example]
The following program reads and displays information about the current processing target
path.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 483 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.63 Set calendar timer of CNC. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_settimer
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_settimer( struct iodbtimer *buf ) ;
struct iodbtimer {
short type ; /* Spec. of date or time. */
short dummy ; /* Not used. */
union {
struct {
short year ; /* Year. */
short month ; /* Month. */
short date ; /* Date. */
} date ;
struct {
short hour ; /* Hour. */
short minute ;/* Minute. */
short second ;/* Second. */
} time ;
} data ;
} ;
[Arguments]
buf Buffer in which the date or time data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Incorrect spec. of date or time "buf.type".
EW_DATA( 5) Incorrect date or time data.
EW_REJECT(13) Data could not be set in the calendar timer LSI.
The hardware may be defective.
- 484 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets the date or time data to the calendar timer device of the CNC unit.
CNC software and C Language Library read date and time from the calendar timer device
of the CNC unit. This function set the date and time data to that calendar timer device.
Specify one of following values in "buf.type". (It is impossible to set both date and
time simultaneously.)
Store the date value or time value in each member of "buf.data.date" or "buf.data.time"
with binary format as follows.
That is, the time "00:00:00, Jan. 1, 1987" through "23:59:59, Dec. 31, 2037" can be set.
[Example]
The following program sets the calendar/timer with the date and time entered using keys.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
printf( "Minute=" ) ;
scanf( "%d", &minute ) ;
printf( "Second=" ) ;
scanf( "%d", &second ) ;
buf.type = 0 ;
buf.data.date.year = year ;
buf.data.date.month = month ;
buf.data.date.date = date ;
ret = cnc_settimer( &buf ) ;
if ( ret == 5 ) printf( "Error while writing DATE.\n" ) ;
buf.type = 1 ;
buf.data.time.hour = hour ;
buf.data.time.minute = minute ;
buf.data.time.second = second ;
ret = cnc_settimer( &buf ) ;
if ( ret == 5 ) printf( "Error while writing TIME.\n" ) ;
}
- 486 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.64 Read load information of serial spindle. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdspload
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdspload( short sp_no, struct odbspn *buf ) ;
struct odbspn {
short datano ; /* Spindle number. */
short type ; /* Not used. */
short data[2] ; /* Spindle load data. */
} ;
[Arguments]
sp_no Spindle number.
buf Buffer in which the spindle load data are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Incorrect spindle number "sp_no".
EW_NOOPT( 6) The required function (Spindle serial output) is not added.
[Description]
Reads serial spindle load information.
"sp_no" specifies the number of a spidle for which the data is to be read.
- 487 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads information about the load on the first spindle and displays
the load ratio on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 488 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.65 Read executing program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdexecprog
[Syntax]
#include <fwindow.h>
short cnc_rdexecprog( unsigned short *length, short *blknum
, char *data ) ;
[Arguments]
length Size of the buffer for storing executing program,
character number of read executing program.
blknum Number of buffered blocks.
data Buffer in which executing program text is stored (ASCII string).
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect buffer size "length".
EW_NOOPT( 6) No option.
[Description]
Reads a specified number of characters from the contents of the program being executed.
"length" specifies the address of a variable for setting the number of characters to
be read.
In the variable specified by "length", set the number of characters to be read. After
reading has completed, the number of characters that have actually been read is set in
the variable specified by "length".
"blknum" specifies the address of a variable for storing the number of look-ahead blocks.
"data" specifies the address of a variable for storing the start address of the array
that stores the contents of the program being executed.
[Example]
The following program displays an NC program being currently executed on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <conio.h>
- 489 -
3.Function References PROGRAMMING B-64303EN-3/01
printf( "\033[2J\033[1;1H" ) ;
printf( "< cnc_rdexecprog > press [CAN] to exit" ) ;
for (;;) {
length = BUFLEN ;
ret = cnc_rdexecprog( &length, &blknum, data ) ;
printf( "\033[2;1Hret=%2d length=%3u blknum=%d\n\n",
ret, length, blknum ) ;
if ( length ) printf( "\033[33;7m" ) ;
lcount = num1 = num2 = 0 ;
for ( idx = 0 ; idx < length ; idx++ ) {
ch = data[idx] ;
if ( ( ch == '\n' ) || ( ch == '%' ) ) {
if ( ch == '\n' )
printf( " ;" ) ;
else
putchar( '%' ) ;
printf( "\033[0m\033[K\n" ) ;
lcount++ ;
if ( lcount < blknum ) printf( "\033[33m" ) ;
num1 = num2 = 0 ;
}
else {
if ( ( ( ch >= '0' ) && ( ch <= '9' ) )
|| ( ch == '.' ) || ( ch == '#' )
|| ( ch == '+' ) || ( ch == '-' )
|| ( ch == ']' ) )
num2 = 1 ;
else
num2 = 0 ;
if ( ( num1 == 1 ) && ( num2 == 0 ) )
putchar( ' ' ) ;
putchar( ch ) ;
num1 = num2 ;
}
}
if ( kbhit() ) {
ch = getch() ;
if ( ch == MDIKEY_CAN ) break ;
}
printf( "\033[J" ) ;
}
}
- 490 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.66 Read manual overlapped motion value. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmovrlap
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdmovrlap( short axis, short length, struct iodbovl *buf ) ;
struct iodbovl {
short datano ; /* Not used. */
short type ; /* Axis number. */
long data[2][N] ; /* Override amount. */
} ; /* N is a maximum controlled axis number. */
[Arguments]
axis Axis number ( =-1:for only all axes).
length Data block length ( =4+4×32×2 ).
buf Buffer in which the manual overlapped motion value are stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
EW_NOOPT( 6) There are no required functions (manual handle interrupt function).
[Description]
Reads the amount of a manual interruption move in input and output units.
The data of all axes can be read at once by setting -1 in "axis" (data of an individual
axis cannot be read). The manual interruption move amount of each axis is stored in the
"data" array in "buf".
The decimal point position in the manual interruption move amount data can be obtained
with the “1.67 cnc_getfigure function”.
"axis" specifies the number of an axis for which the data is to be read. You can only
specify all axes.
-1: All axes
- 491 -
3.Function References PROGRAMMING B-64303EN-3/01
All axes
struct iodbovl 0┌───┐ ─
│dummy │ ↑
2├───┤ │
│type │ length
4├───┴───┐│
│ data[0][0] ││
8├───────┤│
~ ~│
4+4×(n-1)├───────┤│
│ data[0][n-1]││
4+4×n├───────┤│
│ data[1][0] ││
4+4×(n+1)├───────┤│
~ ~│
4+4×(2n-1)├───────┤│
│ data[1][n-1]│↓
4+4×2n└───────┘─
n = maximum number of controlled axes (the data of the current number of axes is valid)
[Example]
In a 3-axis system, the manual interruption move amounts of the axes are set as shown
below.
Input unit Output unit
1st axis 4.7246 120.005
2nd axis -1.9732 -50.119
3rd axis 0.0031 0.080
Then, execute the following program.
0: 47246 120005
1: -19732 -50119
2: 31 80
The values shown above are displayed (assuming that the inch input, metric output, and
increment system of IS-B are used).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 492 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 493 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.67 Read the maximum number of significant figures and the number of decimal places. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_getfigure
[Syntax]
#include <fwindow.h>
short cnc_getfigure( short data_type, short *valid_fig,
short *dec_fig_in, short *dec_fig_out ) ;
[Arguments]
data_type Data type.
0: Axis data
1: Tool offset
2: Custom macro
valid_fig Buffer in which the maximum number of significant digits is stored.
dec_fig_in Buffer in which the number of decimal places in the input unit is stored.
The array must be large enough to cover the maximum number of controlled
axes.
Define dec_fig_in[CEX_MAXS].
(For data other than axis data, only the start of the array is valid.)
dec_fig_out Buffer in which the number of decimal places in the output unit is
stored.
The array must be large enough to cover the maximum number of controlled
axes.
Define dec_fig_out[CEX_MAXS].
(For data other than axis data, only the start of the array is valid.)
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_ATTRIB( 4) Incorrect data type "data_type".
[Description]
Reads the maximum number of significant digits and the number of decimal places in the
input and output units for various kinds of CNC data.
The values that can be read by the window library are the binary data in the increment
system in the CNC. You must therefore make settings for the display of the decimal point
position and other items with consideration given to the increment system.
- 494 -
B-64303EN-3/01 PROGRAMMING 3.Function References
1) Axis data
- 495 -
3.Function References PROGRAMMING B-64303EN-3/01
2) Tool offset
For the output unit, the number of decimal places is invalid.
3) Custom macro
For the input unit, only the number of decimal places for the first axis is valid.
For the output unit, the number of decimal places is invalid.
[mm] [inch]
IS-A 2 3
IS-B 3 4
IS-C 4 5
- 496 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.68 Read tool offset information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtofsinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtofsinfo( struct odbtlinf *buf ) ;
struct odbtlinf {
short ofs_type ; /* Memory type. */
short use_no ; /* Number of available offsets. */
} ;
[Arguments]
buf Buffer in which the tool offset information is stored.
[Return]
Main return value is as follows. For information about other return values, see Subsection
3.4.2, "Return values of data window functions" above in Part II, "PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the tool offset memory type and the number of available offsets.
- 497 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.69 Search for sequence number. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_seqsrch
[Syntax]
#include <fwindow.h>
short cnc_seqsrch( long seq_no ) ;
[Arguments]
seq_no Sequence number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) The specified sequence number does not exist.
EW_MODE(12) CNC mode error.
The function can be used only in MEM mode.
EW_REJECT(13) CNC processing is rejected.
- The CNC is in editing mode.
- No machining program is registered.
[Description]
Searches the machining program currently selected in the CNC for the sequence number
specified by "seq_no".
- 498 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.70 Clear or preset relative position of controlled axis. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrrelpos
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrrelpos( short length, struct idbwrr *buf ) ;
struct idbwrr {
short datano ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Preset data. */
} ; /* N is the maximum number of controlled axes. */
[Arguments]
length Data block length (= 4+4×(number of axes for which data is to be read)).
buf Buffer in which preset data of the controlled axis relative positions
is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_ATTRIB( 4) Incorrect axis number "type".
EW_DATA( 5) Data error.
The data is out of a range that can be specified.
EW_REJECT(13) NC processing is rejected.
- 499 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
"length" specifies the data block length (size of "buf").
When 0 is specified as the preset data, the origin is specified (the relative position
is cleared to 0).
type Specifies the number of an axis for which the data is to be preset.
1 to m: One axis (m: number of currently controlled axes)
-1 : All axes
- 500 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.71 Read actual spindle speed (S) (multiple spindles allowed, read of specified axis) (2).
<Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_acts2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_acts2( short sp_no, struct odbact2 *buf ) ;
struct odbact2 {
short datano ; /* Spindle number. */
short type ; /* Not used. */
long data[MAX_SPINDLES] ; /* Spindle data. */
} ; /* MAX_SPINDLES : Maximum number of spindles. */
[Arguments]
sp_no Number of a spindle for which the data is to be read.
ALL_SPINDLES : All spindles (ALL_SPINDLES: -1)
1 to MAX_SPINDLES: One spindle
MAX_SPINDLES is the maximum number of spindles.
buf Buffer in which the actual speed of each spindle is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER(3) Data number error.
Incorrect spindle number "sp_no".
[Description]
Reads the actual speed of a spindle in the CNC.
The data of all spindles can be read at once by setting -1 in "sp_no". The actual speed
data of each spindle is stored in the "buf.data" array.
The cnc_acts function allows you only to obtain the actual speed of the selected spindle.
With the cnc_acts2 function, however, you can specify the spindle for which the actual
speed is to be obtained, and can also obtain the data of all spindles.
- 501 -
3.Function References PROGRAMMING B-64303EN-3/01
Refer to "Parameter Manual" (B-64310EN) of the CNC for details about the parameters.
[Example]
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 502 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.72 Read workpiece coordinate system shift. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdwkcdshft
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdwkcdshft( short axis, short length,
struct iodbwcsf *wkcdshft );
struct iodbwcsf {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Workpiece coordinate system shift. */
} ;
/* N is the maximum number of controlled axes. */
[Arguments]
axis Axis number (= (1 to the maximum number of controlled axes), or -1)
1 to m: One axis (m: number of currently controlled axes)
-1 : All axes
length Data block length (= 4+4×(number of axes for which data is to be read)).
wkcdshft Buffer in which the workpiece coordinate system shift data is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The function is disabled.
The function cannot be used for the M series.
EW_LENGTH( 2) Incorrect data length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
EW_PARAM( 9) CNC parameter error.
Set bit 6 (NWS) of parameter No. 1201 to 0.
- 503 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the workpiece coordinate system shift of the axis specified by "axis".
The workpiece coordinate system shift data is stored in the "data" array in "wkcdshft"
in signed binary format.
The data of all axes can be read at once by setting -1 in "axis".
The decimal point position in the workpiece coordinate system shift data can be obtained
with the “1.67 cnc_getfigure function”.
- 504 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.73 Write workpiece coordinate system shift. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrwkcdshft
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrwkcdshft( short length, struct iodbwcsf *wkcdshft ) ;
struct iodbwcsf {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Workpiece coordinate system shift. */
} ;
N: maximum number of controlled axes
[Arguments]
length Data block length (=4+4×(number of axes for which data is to be read))
wkcdshft Buffer in which the workpiece coordinate system shift data is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The function is disabled.
The function cannot be used for the M series.
EW_LENGTH( 2) Incorrect data length "length".
EW_ATTRIB( 4) Incorrect axis number "axis".
EW_DATA( 5) Incorrect NC program data.
The workpiece coordinate system shift in "data" is out of a range that
can be specified.
EW_PROT( 7) Write protection.
Set bit 3 (WZO) of parameter No. 3290 to 0.
EW_PARAM( 9) CNC parameter error.
Set bit 6 (NWS) of parameter No. 1201 to 0.
EW_REJECT(13) CNC processing is rejected.
The automatic operation start signal STL <F000.5> is 1.
- 505 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Writes the workpiece coordinate system shift of the axis specified by "type".
The workpiece coordinate system shift data is set in the "data" array in "wkcdshft" in
signed binary format.
"type" specifies the number of an axis for which the data is to be written.
1 to m: One axis (m: number of currently controlled axes)
-1 : All axes
The shift units are the same as those of the cnc_rdwkcdshft function described in "Reads
workpiece coordinate system shift". See an explanation of that function.
- 506 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.74 Read program storage drive information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpdf_drive
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdpdf_drive ( struct odbpdfdrv *pdf_drv ) ;
struct odbpdfdrv {
short max_num; /* Maximum number of drives. */
short dummy;
char drive[16][12]; /* Drive name string. */
} ;
[Arguments]
pdf_drv Buffer in which the program storage drive information is stored.
[Return]
Main return value is as follows. For information about other return values, see Subsection
3.4.2, "Return values of data window functions" above in Part II, "PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the program storage drive information.
The execution of the function is delayed when the CNC is in editing mode (including
background editing state).
- 507 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.75 Read program storage file information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpdf_inf
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdpdf_inf(char *drive, short size_kind,
struct odbpdfinf *pdf_inf);
struct odbpdfinf {
long used_page; /* Program storage in use. */
long all_page; /* Total program storage. */
long used_dir; /* Number of folders (programs) in use. */
long all_dir; /* Total number of folders (programs). */
} ;
[Arguments]
drive Drive name string.
A drive name string contains up to 8 characters and is NULL-terminated.
size_kind Data units of "used_page" and "all_page".
0: Page
1: Byte
2 : Kbyte(1Kbyte=1024bytes)
3 : Mbyte(1Mbyte=1024Kbytes)
pdf_inf Buffer in which the program storage drive information is stored.
used_page Program storage in use.
all_page Total program storage.
The unused program storage is obtained by ("all_page" - "used_page").
used_dir Number of folders (programs) in use.
all_dir Total number of folders (programs).
The number of unused folders (programs) is obtained by ("all_dir" -
"used_dir").
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) The drive specified by the data "drive" does not exist.
- 508 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the information about the program storage file on the specified drive.
The execution of the function is delayed when the CNC is in editing mode (including
background editing state).
- 509 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.76 Read current folder information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpdf_curdir
[Syntax]
#include <fwindow.h>
short cnc_rdpdf_curdir(short dir_kind, char *dir_name) ;
[Arguments]
dir_kind Type of the current folder for which data is to be read.
1: Foreground
2: Background
dir_name Pointer for returning the current drive and folder string.
Although up to 210 characters are valid, the size of 212 bytes should
be provided.
The string is NULL-terminated.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_ATTRIB( 4) Incorrect data "dir_kind".
[Description]
Reads the current folder information.
The execution of the function is delayed when the CNC is in editing mode (including
background editing state).
- 510 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.77 Set current folder. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrpdf_curdir
[Syntax]
#include <fwindow.h>
short cnc_wrpdf_curdir(short dir_kind, char *dir_name) ;
[Arguments]
dir_kind Type of the current folder to be set.
1: Foreground
2: Background
dir_name Pointer for returning the current drive and folder string.
Although up to 210 characters are valid, the size of 212 bytes should
be provided.
The string is null-terminated.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_ATTRIB( 4) Incorrect data "dir_kind".
EW_DATA( 5) The folder specified by the data "dir_name" does not exist.
EW_REJECT(13) CNC processing is rejected.
[Description]
Sets the current folder.
The execution of the function is delayed when the CNC is in editing mode (including
background editing state).
- 511 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.78 Read subfolder information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpdf_subdir
[Syntax]
#include <data.h>
#include <fwindow.h>
struct idbpdfsdir {
/* input */
char path[212]; /* Path name string. */
short req_num; /* Request entry number. */
short dummy;
};
struct odbpdfsdir {
/* output */
short sub_exist; //* Whether a subfolder is included. */
short dummy;
char d_f[36]; /* Folder name string. */
};
[Arguments]
num_dir[in/out]
[in] : Specify the maximum number of folders for which the data is to be read.
[out]: The number of folders for which the data has actually been read is set.
pdf_sdir_in Buffer in which the folder setting is stored.
pdf_sdir_out Storage buffer to which the subfolder information is returned.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_BUSY(-1) The CNC is in use.
EW_NUMBER( 3) Data number error.
No subfolder exists for the data "req_num".
EW_DATA( 5) Data error.
Incorrect format for the folder name "path".
EW_PROT( 7) Protection.
The specified folder cannot be displayed.
EW_REJECT(13) CNC processing is rejected.
- 512 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the information about the subfolder in the specified folder.
The execution of the function is delayed when the CNC is in editing mode (including
background editing state).
If the creation, deletion, or any other subfolder editing operation is performed in the
period between the first request and the last request, the function returns the
information based on the data at the time when the function is called.
"req_num" sets the ordinal number of the subfolder for which you want to get information.
Normally, start the number with 0 and increment the number by 1.
(The number of the first subfolder is 0.)
- 513 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.79 Read file list information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpdf_alldir
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdpdf_alldir( short *num_prog,
struct idbpdfadir *pdf_adir_in, struct odbpdfadir *pdf_adir_out);
struct idbpdfadir {
/* input */
char path[212]; /* Path name character string. */
short req_num; /* Required entry number. */
short size_kind; /* Size output format. */
short type; /* Program list type */
short dummy;
};
struct odbpdfadir {
/* output */
short data_kind; /* Kind of data. */
short year; /* Date and time of last editing (year). */
short mon; /* Date and time of last editing (month). */
short day; /* Date and time of last editing (day). */
short hour; /* Date and time of last editing (hour). */
short min; /* Date and time of last editing (minute). */
short sec; /* Date and time of last editing (second). */
short dummy;
long dummy2;
long size; /* Size. */
unsigned long attr; /* Attribute. */
char d_f[36]; /* Name character string.*/
char comment[52]; /* Comment. */
char o_time[12]; /* Machining time stamp. */
};
[Arguments]
num_prog
[in] : Specify the maximum number of programs to be read.
[out] : The number of programs actually read is set.
pdf_adir_in Buffer to which the folder setting is passed.
pdf_adir_out Buffer to which folder list information is returned.
- 514 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_BUSY(-1) Currently used by the NC.
EW_NUMBER( 3) Data number error.
There is no subfolder for the data (req_num).
EW_ATTRIB( 4) The specified size_kind or type value is invalid.
EW_DATA( 5) The path data is invalid.
EW_REJECT(13) CNC processing is rejected.
[Description]
Reads file list information in a folder.
When editing (including background editing) is being made on the CNC side, the execution
of this function is placed in the wait state.
When folder or file editing such as creation or deletion is performed during the time
from the first request until the last request, data is returned based on the data present
when a request is made.
- 515 -
3.Function References PROGRAMMING B-64303EN-3/01
year indicates the date and time of last editing (year). It is valid only for files.
mon indicates the date and time of last editing (month). It is valid only for files.
day indicates the date and time of last editing (day). It is valid only for files.
hour indicates the date and time of last editing (hour). It is valid only for files.
min indicates the date and time of last editing (minute). It is valid only for files.
sec indicates the date and time of last editing (second). It is valid only for files.
size indicates the file size ("0" to "99999999"). It is valid only for files.
It is valid when the type argument is set to "1".
o_time stores the machining time stamp (a comment in the format of "(xxxHxxMxxS)")
recorded immediately after the program number.
The character string ends with a NULL character. o_time is valid only for files.
It is valid when the type argument is set to "1".
- 516 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.80 Create folder or file. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_add
[Syntax]
#include <fwindow.h>
short cnc_pdf_add( char *file_path ) ;
[Arguments]
file_path Set a drive name, a folder character string, and a file name.
Up to 242 characters can be used. Set a NULL character at the end.
When specifying a folder name, place "/" at the end of the character
string.
If "/" is not present, a file name is assumed to be specified.
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Set the following paths when creating a file in the program folder of
the CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/xxxx" (xxxx is file name.)
Path 2:"//CNC_MEM/USER/PATH2/xxxx" (xxxx is file name.)
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name format error.
2 : The specified folder name is not found.
3 : The maximum allowable number of registered files is exceeded.
4 : The same file name is already present.
5 : The specified file or folder name is selected by the NC.
EW_PROT( 7) Write protection.
The specified file or folder is write-protected.
EW_OVRFLOW( 8) Memory overflow.
File or folder creation is impossible because of insufficient memory
space.
EW_REJECT(13) CNC processing is rejected.
The CNC is operating.
- 517 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Creates a folder or file in the specified folder for the memory card or data server.
A file is created in the CNC memory.
If editing (including background editing) is being made on the CNC side, execution is
put off.
A file with the same number or same name cannot be created.
A folder with the same name cannot be created.
If a folder is read-only, neither a file nor folder can be created in the folder.
A folder cannot be created in the CNC memory.
- 518 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.81 Delete folder or file. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_del
[Syntax]
#include <fwindow.h>
short cnc_pdf_del( char *file_path );
[Arguments]
file_path Set a drive name, a folder character string, and a file name.
Up to 242 characters can be used. Set a NULL character at the end.
When specifying a folder name, place "/" at the end of the character
string.
If "/" is not present, a file name is assumed to be specified.
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
When specifying a file in the program folder of the CNC memory, specify
the following paths.
Path 1:"//CNC_MEM/USER/PATH1/xxxx" (xxxx is file name.)
Path 2:"//CNC_MEM/USER/PATH2/xxxx" (xxxx is file name.)
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name format error.
2 : The specified folder name is not found.
5 : The specified file or folder name is selected by the NC.
Alternatively, when a folder is deleted, the folder is not
empty.
EW_PROT( 7) Write protection.
The specified file or folder is write-protected.
EW_REJECT(13) CNC processing is rejected.
The NC is operating.
- 519 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Creates a folder or file in the specified folder for the memory card or data server.
A file is created in the CNC memory.
If editing (including background editing) is being made on the CNC side, execution is
put off.
A specified file cannot be deleted when being operated or selected in the foreground.
It cannot also be deleted when protected.
A specified folder cannot be deleted when selected as the current folder.
It cannot also be deleted when not empty.
- 520 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.82 Rename folder or file. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_rename
[Syntax]
#include <fwindow.h>
short cnc_pdf_rename( char *file_path, char *d_d_f );
[Arguments]
file_path Set a drive name, a folder character string, and a file name.
Up to 242 characters can be used. Set a NULL character at the end.
When specifying a folder name, place "/" at the end of the character
string.
If "/" is not present, a file name is assumed to be specified.
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
When renaming the program folder of the CNC memory, specify the
following paths.
Path 1:"//CNC_MEM/USER/PATH1/xxxx" (xxxx is file name.)
Path 2:"//CNC_MEM/USER/PATH2/xxxx" (xxxx is file name.)
d_d_f Folder or file name character string after renaming.
Up to 33 characters can be used. Set a NULL character at the end.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name format error.
2 : The specified folder name is not found.
4 : The same file name is already present.
5 : The specified file or folder name is selected by the NC.
EW_PROT( 7) Write protection.
The specified file or folder is write-protected.
EW_REJECT(13) CNC processing is rejected.
- The CNC is operating.
- The emergency stop state is present.
- 521 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Creates a folder or file in the specified folder for the memory card or data server.
A file is created in the CNC memory.
If editing (including background editing) is being made on the CNC side, execution is
put off.
A specified file cannot be renamed when being operated or selected in the foreground.
It cannot also be renamed when protected.
A specified file cannot be renamed when selected as the current folder or a folder above
the current folder.
- 522 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.83 Select main program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_slctmain
[Syntax]
#include <fwindow.h>
short cnc_pdf_slctmain( char *file_path );
[Arguments]
file_path Set a drive name, a folder character string, and a file name.
Up to 242 characters can be used. Set a NULL character at the end.
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths when selecting a program in the program
folder of the CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/xxxx" (xxxx is file name.)
Path 2:"//CNC_MEM/USER/PATH2/xxxx" (xxxx is file name.)
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name format error.
2 : The specified folder name is not found.
EW_MODE(12) CNC mode error.
This function can be used only in the EDIT/MEM mode.
[Description]
Selects a file in a specified folder as the main program.
When editing (including background editing) is being made on the CNC side, the execution
of this function is placed in the wait state.
- 523 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.84 Consolidate programs. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_cond
[Syntax]
#include <fwindow.h>
short cnc_pdf_cond( char *file_path );
[Arguments]
file_path Set a drive name, a folder character string, and a file name.
Up to 242 characters can be used. Set a NULL character at the end.
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths when selecting the program folder of the
CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/xxxx" (xxxx is file name.)
Path 2:"//CNC_MEM/USER/PATH2/xxxx" (xxxx is file name.)
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name format error.
2 : The specified folder name is not found.
5 : The specified file or folder name is selected by the NC.
EW_PROT( 7) Write protection.
The specified file or folder is write-protected.
EW_REJECT(13) CNC processing is rejected.
The CNC is operating.
[Description]
Consolidates a file in a specified folder.
When editing (including background editing) is being made on the CNC side, the execution
of this function is placed in the wait state.
When a specified file is being used for operation or selected in the foreground,
consolidation is impossible. Also when the file is protected, consolidation is
impossible.
- 524 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.85 Change attribute of folder or file. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrpdf_attr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrpdf_attr( char *file_path, struct idbpdftdir *pdf_tdir );
struct idbpdftdir {
unsigned long slct; /* Selection. */
unsigned long attr; /* Setting. */
};
[Arguments]
file_path Set a drive name, a folder character string, and a file name.
Up to 242 characters can be used. Set a NULL character at the end.
When specifying a folder name, place "/" at the end of the string.
If "/" is not present, a file name is assumed to be specified.
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths when selecting a file in the program folder
of the CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/xxxx" (xxxx is file name.)
Path 2:"//CNC_MEM/USER/PATH2/xxxx" (xxxx is file name.)
pdf_tdir Buffer in which information about the folder or file to be changed is
stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name format error.
2 : The specified folder name is not found.
5 : The specified file or folder name is selected by the NC.
EW_PROT( 7) Write protection.
The specified file or folder is write-protected.
Alternatively, the file or folder is protected with a protection level.
EW_REJECT(13) CNC processing is rejected.
- 525 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Changes the attribute of a folder or file in a specified folder.
When editing (including background editing) is being made on the CNC side, the execution
of this function is placed in the wait state.
When a specified folder is selected as the current folder, its attribute cannot be
changed.
In slct, set only the bit of the attribute to be changed to "1". Set bits other than
the described bits to "0".
attr sets attribute data applied after the change. The bit that is set to "1" in slct
is changed to the data set in attr.
Folder attribute
#0 : Editing disable attribute 0: Enabled, 1: Disabled
#1 : Editing/display disable attribute 0: Enabled, 1: Disabled
File attribute
#0 : Editing disable attribute 0: Enabled, 1: Disabled
#1 : Editing/display disable attribute 0: Enabled, 1: Disabled
#2 : Encryption attribute 0: OFF 1: ON
#8 to #10 : Change protection level
Numeric value from "0" to "7" where #10 is the MSB and #8
is the LSB
#12 to #14 : Output protection level
Numeric value from "0" to "7" where #14 is the MSB and #12
is the LSB
When changing the change protection level or output protection level, set all of the
relevant three bits in slct to "1".
- 526 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.86 Get the number of folders and files in specified folder. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpdf_subdirn
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdpdf_subdirn( char *dir_name, struct odbpdfnfil *pdf_nfil);
struct odbpdfnfil {
/* input */
short dir_num; /* Number of folders. */
short file_num; /* Number of files. */
} ;
[Arguments]
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name format error.
2 : The specified folder name is not found.
EW_REJECT(13) CNC processing is rejected.
The NC is operating.
[Description]
Acquires the numbers of subfolders and files in a specified folder.
- 527 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.87 Get main program information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_rdmain
[Syntax]
#include <fwindow.h>
short cnc_pdf_rdmain( char *dir_name );
[Arguments]
dir_name Pointer to the current drive and a folder character string.
Up to 242 characters can be used although a 244-byte area is prepared.
A NULL character is set at the end.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_REJECT(13) CNC processing is rejected.
[Description]
Reads information about the file currently selected as the main program.
- 528 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.88 Get CNC information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_information
[Syntax]
#include <fwindow.h>
short cnc_information( long type, long *data );
[Arguments]
type Set the type of information to be acquired.
data Specify the area for storing acquired data.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) The value specified in type is invalid.
[Description]
Acquires CNC information.
- 529 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.89 Read series and edition of CNC system software. (3) <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdsyssoft3
[Syntax]
#include <fwindow.h>
#include <data.h>
short cnc_rdsyssoft3( short s_id , short *read_num , short *all_num ,
struct odbsyss3 *syssoft3 ) ;
struct odbsyss3 {
short soft_id ; /* Software ID. */
char soft_series[5] ; /* Software series. */
char soft_edition[5] ; /* Software edition. */
};
[Arguments]
s_id Specify a starting ID of series and edition information to be read.
Information is acquired sequentially from a specified ID to greater
IDs.
To read all series and edition information, set s_id to 0 to acquire
data for the first time, and for the second and subsequent operations,
repeat execution while incrementing the s_id value by one (setting the
ID acquired last plus 1).
read_num Specify a pointer to the number of software products to be read.
Specify the number of software products before calling the function.
After the function is called, the number of software products actually
read is set in this argument.
A value ranging from 1 to 40 can be specified.
If no data item can be read, read_num = 0 is returned.
all_num The total number of software products is set.
syssoft3 Buffer in which CNC system software series and edition information is stored.
soft_id Software ID
A numeric value indicating the type of each software product is stored.
Main software IDs are listed below.
0101H : CNC basic software
0102H : CNC optional software A1
0103H : CNC optional software A2
0104H : CNC optional software A3
0111H : CNC language ROM English (Basic)
0112H : CNC language ROM Japanese
0113H : CNC language ROM German
0114H : CNC language ROM French
0115H : CNC language ROM Chinese (traditional characters)
0116H : CNC language ROM Italian
- 530 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 531 -
3.Function References PROGRAMMING B-64303EN-3/01
- 532 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the series and editions of CNC system software products.
- 533 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.90 Start output of NC program to be registered (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_dwnstart4
[Syntax]
#include <fwindow.h>
short cnc_dwnstart4( short type, char *file_name ) ;
[Arguments]
type Specify the type of CNC data to be registered.
0 : NC program
1 : Tool offset
2 : Parameter
3 : Pitch error compensation amount
4 : Custom macro variable
5 : Work origin offset
file_name Drive name and folder name (up to 241 characters) of a program.
Valid only when type = "0".
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths when selecting the program folder of the
CNC memory.
Path 1:"//CNC_MEM/USR/PATH1/"
Path 2:"//CNC_MEM/USR/PATH2/"
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_BUSY(-1) Processing for requesting the start of the output of an NC program to
be compared is rejected.
The cnc_dwnstart4 function (cnc_vrfstart function) has already been
executed.
Use the cnc_dwnend4 function (cnc_vrfend function) to end the previous
output operation.
EW_ATTRIB( 4) The specified type is invalid.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : Folder name error
EW_NOOPT( 6) A required function is not provided.
- 534 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Requests the CNC to start registering (downloading) NC data (such as an NC program, tool
offsets, or parameters). (This function must be executed before downloading is
performed.)
cnc_dwnstart4
= EW_OK
Reexecute
Output NC data.
= EW_RESET cnc_download4 = EW_BUFFER
= EW_OK
cnc_dwnend4
- 535 -
3.Function References PROGRAMMING B-64303EN-3/01
When data is to be output to a memory card or data server, the full path of an output
destination folder must be set in the 'file_name' argument of the cnc_dwnstart4 function.
To access a data server, specify and execute the function as shown in the following
example:
Example) Output to DATA_SV
ret = cnc_dwnstart4(0, "//DATA_SV/") ;
- 536 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.91 Output NC program to be registered (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_download4
[Syntax]
#include <fwindow.h>
short cnc_download4( long *length, char *data );
[Arguments]
length Specify a pointer to a long variable that holds the number of NC data
characters to be output.
When control is returned from this function, the number of characters
actually output is set.
When the specified number of output characters is 0 or a smaller value,
EW_LENGTH is returned.
data Specify the starting address of an area in which NC data to be output
is set.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_RESET(-2) The CNC has been reset.
Call the cnc_dwnend4 function.
EW_FUNC( 1) The CNC does not complete start processing for outputting an NC program
to be registered. Alternatively, the cnc_dwnstart4 function has not
been executed.
EW_LENGTH( 2) The specified data length is invalid.
A negative value is specified as the number of output characters.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : Syntax error in NC data.
2 : When the TV check is enabled, a block that consists of an
odd number of characters (including LF at the end of the block)
is detected
3 : The maximum allowable number of registered NC programs is
exceeded.
4 : The same program number is already registered.
5 : The same program number is selected by the NC.
- 537 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Outputs (downloads) NC data to be registered.
This function outputs as many characters as specified in *length. If the available space
in the buffer for data transfer to the CNC is insufficient for the specified number of
characters, data as much as the available space is output, and the number of the
characters of the output data is set in *length.
If even one character cannot be output, EW_BUFFER is returned. When this value is returned,
the function must be called again.
Because priority is given to the speed of data transfer to the CNC, an error (such as
EW_DATA or EW_OVRFLOW) is generally returned with delay. This means that an error output
at a certain point of time is sometimes due to data that was output in several data output
operations preceding that point. An error that occurs in several data output operations
preceding the end of the function is returned by cnc_dwnend4.
NC data registered in the CNC consists of ASCII strings in the following format:
Add LF to the beginning of the entire data and % to the end. Data preceding the beginning
LF is ignored.
When the data to be output is an NC program, be sure to specify a program number following
address "0" at the beginning of the program to be registered.
For example, when registering the following program:
O1234 ;
G1 F0.3 W10. ;
M30 ;
%
"\nO1234\nG1F0.3W10.\nM30\n%"
- 538 -
B-64303EN-3/01 PROGRAMMING 3.Function References
It is also possible to divide data into several parts and transfer them separately.
The data shown in the above example may also be transferred on a block-by-block basis
as follows:
"\n"
"O1234\n"
"G1F0.3W10.\n"
"M30\n"
"%"
Furthermore, it is also possible to divide one block into several parts and transfer
them separately.
- 539 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.92 Stop output of NC program to be registered (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_dwnend4
[Syntax]
#include <fwindow.h>
short cnc_dwnend4( void );
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The CNC does not complete start processing for outputting an NC program
to be registered. Alternatively, the cnc_dwnstart4 function has not
been executed.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : Syntax error in NC data.
2 : When the TV check is enabled, a block that consists of an
odd number of characters (including LF at the end of the block)
is detected
3 : The maximum allowable number of registered NC programs is
exceeded.
4 : The same program number is already registered.
5 : The same program number is selected by the NC.
EW_PROT( 7) Write protection.
CNC parameters (protection or encryption of programs in the eight or
nine thousands) are write-protected. For the timing of the occurrence
of this error, see [Description].
EW_OVRFLOW( 8) The program memory area of the CNC becomes full, so data cannot be
registered any more. For the timing of the occurrence of this error,
see [Description].
[Description]
Notifies the CNC of the end of NC data registration. (This function must be used after
downloading ends.)
- 540 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 541 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.93 Start reading NC program (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_upstart4
[Syntax]
#include <fwindow.h>
shortcnc_upstart4( short type, char *file_name );
[Arguments]
type Specify the type of CNC data to be read.
0 : NC program
1 : Tool offset
2 : Parameter
3 : Pitch error compensation amount
4 : Custom macro variable
5 : Work origin offset
7 : Operation history data
file_name Drive name, folder name, and file name (up to 241 characters) of a
program.
Valid only when type = "0".
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths when selecting the program folder of the
CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/"
Path 2:"//CNC_MEM/USER/PATH2/"
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_BUSY(-1) Processing for requesting the start of the output of an NC program to
be compared is rejected.
The cnc_upstart4 function has already been executed. Use the cnc_upend4
function to end the previous output operation.
EW_ATTRIB( 4) The specified type is invalid.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
1 : File or folder name error
EW_NOOPT( 6) A required function is not provided.
When registering a custom macro variable, workpiece origin offset, or
pitch error, enable the corresponding function.
- 542 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Requests the CNC to start reading (uploading) NC data (such as an NC program, tool offsets,
or parameters) specified with a path name and file name. (This function must be executed
before uploading is performed.)
cnc_upstart4
= EW_OK
Reexecute
Read NC data.
= EW_RESET cnc_upload4 = EW_BUFFER
= EW_OK
cnc_upend4
Specify a program with a folder and a file name. So, it is impossible to upload more
than one program by specifying a range.
When data is to be read from a memory card or data server, the full path of a program
name must be set in the 'file_name' argument of the cnc_upstart4 function.
To access a data server, specify and execute the function as shown in the following
example:
- 543 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.94 Read NC program (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_upload4
[Syntax]
#include <fwindow.h>
short cnc_upload4( long *length, char *data );
[Arguments]
length Specify the address of a variable for specifying the number of
characters to be read.
In this variable (*length), set the number of characters to be input
by one read operation.
The number of characters must be a multiple of 256.
After the end of a read operation, the number of characters actually
read is set in this variable (*length) again.
If a value smaller than 256 is specified as the number of characters
to be read, EW_LENGTH is returned.
data Specify a starting address of the NC data storage destination.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_RESET(-2) The CNC has been reset. Call the cnc_upend4 function.
EW_FUNC( 1) The CNC does not complete start processing for outputting an NC program
to be registered. Alternatively, the cnc_upstart4 function has not been
executed.
EW_LENGTH( 2) The specified data length is invalid. The specified number of NC data
characters to be read (*length) is less than 256.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
2 : No program is registered within a specified range.
3 : The NC program area is destroyed.
EW_PROT( 7) Write protection.
CNC parameters (protection or encryption of programs in the eight or
nine thousands) are read-protected. For the timing of the occurrence
of this error, see [Description].
EW_BUFFER(10) The buffer is empty or full. Retry.
For the timing of the occurrence of this error, see [Description].
- 544 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads (uploads) NC data.
This function inputs as many characters as specified in *length. When the CNC data
processing is delayed, and so data that can be read is shorter than the specified number
of characters, the data that can be read is read, and the number of the characters of
the read data is set in *length.
If even one character cannot be read, EW_BUFFER is returned. When this value is returned,
the function must be called again.
Because priority is given to the speed of data transfer to the CNC, an error (such as
EW_DATA) is generally returned with delay. This means that an error output at a certain
point of time is sometimes due to data that was output in several data output operations
preceding that point. An error that occurs in several data output operations preceding
the end of the function is returned by cnc_upend4 function.
NC data read from the CNC consists of ASCII strings in the following format:
Alternatively,
The format to be used is determined by the setting of bit 3 (NCR) of NC parameter No.
0100.
Because of the TV check, a space (' ') may be added before LF.
For details, refer to Section, "PROGRAM SECTION CONFIGURATION" in "Common to Lathe
System/Machining Center System User's Manual" (B-64304EN) of the CNC.
A NULL character ('\x00') is not added at the end of the character string written in
the buffer. When read, NC data ends with '%'. Use this character, '%', as the condition
for ending a read operation. When an attempt is made to perform a read operation further
after '%' is received, the function ends with an error (EW_RESET).
- 545 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.95 Stop reading NC program (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_upend4
[Syntax]
#include <fwindow.h>
short cnc_upend4( void );
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The CNC does not complete start processing for outputting an NC program
to be registered. Alternatively, the cnc_upstart4 function has not been
executed.
EW_DATA( 5) Data error.
To obtain more detailed information about this return value, execute
the cnc_getdtailerr function. The function sets the following detailed
status in err_no, which is a member of the odberr structure:
2 : No program is registered within a specified range.
3 : The NC program area is destroyed.
EW_PROT( 7) Write protection.
CNC parameters (protection or encryption of programs in the eight or
nine thousands) are write-protected.
For the timing of the occurrence of this error, see [Description].
[Description]
Posts the end of reading (uploading) of NC data.
(This function must be executed after uploading.)
An error (such as EW_DATA) in the cnc_upload4 function may be returned by this function.
- 546 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.96 Read pitch error compensation data information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpitchinfo
[Syntax]
#include <fwindow.h>
short cnc_rdpitchinfo( short* use_no ) ;
[Arguments]
use_no [ out ] Specify the number of pitch error compensation data items to
be read.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NOOPT( 6) A required function is not provided.
The stored pitch error compensation function is required. (Parameter
NPE(No.8135#0)="0")
[Description]
Reads the number of usable pitch error compensation data items. It is stored in *use_no
in binary form.
- 547 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.97 Read custom macro variable information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmacroinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdmacroinfo( struct odbmvinf *mvinf );
struct odbmvinf {
short use_no1 ; /* Number of local variables. */
short use_no2 ; /* Common variable range. */
} ;
[Arguments]
mvinf [out] Buffer to which custom macro variable information is returned.
A pointer to mvinf to which custom macro variable information is
returned.
use_no1 The number of available local variables is stored.
33 is set at any time.
use_no2 A value indicating the range of available common variables is stored.
0 : "100" to "149", "500" to "531"
1 : "100" to "199", "500" to "999"
2 : "100" to "199", "500" to "599"
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NOOPT( 6) A required function is not provided.
The custom macro function is required. (Parameter NMC(No.8135#5)="0")
[Description]
Reads the number of custom macro local variables and the number of custom macro common
variables.
These numbers are stored in use_no1 and use_no2 of mvinf in binary form.
- 548 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.98 Read setting parameter information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdsetinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdsetinfo( short s_number, unsigned short read_no,
struct odbsetif *setif ) ;
struct odbsetif {
unsigned short info_no ; /* Number of setting parameters. */
short prev_no ; /* Previous setting parameter number. */
short next_no ; /* Next setting parameter number. */
struct {
short set_no ; /* Setting parameter number. */
short set_type ; /* Setting parameter attribute. */
} info[N] ; /* N : Number of setting parameter information items */
/* to be read. */
} ;
[Arguments]
s_number [in] Specify a starting setting parameter number.
read_no [in] Specify the number of setting parameter information items to
be read.
setif [out] Buffer to which setting parameter information is returned.
A pointer to setif to which setting parameter information is
returned.
info_no Number of setting parameter information items.
Number of setting parameter information items actually read.
prev_no Previous setting parameter number.
Valid number before the setting parameter information read
first.
next_no Next setting parameter number.
Valid number after the setting parameter information read last.
info[N].set_no Setting parameter number.
Setting parameter number actually present.
- 549 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) The specified starting setting parameter number (s_number ) is invalid.
[Description]
Reads CNC setting parameter information specified with s_number and read_no.
Basically, CNC setting parameters are distributed discontinuously, and their types,
sizes, and other attributes vary according to their numbers. This function is used to,
for example, display setting parameters.
- 550 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.99 Read diagnostics data information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rddiaginfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rddiaginfo( short s_number, unsigned short read_no,
struct odbdiagif *diagif ) ;
struct odbdiagif {
unsigned short info_no ;/* Number of diagnostics data information items. */
short prev_no ; /* Previous diagnostics data number. */
short next_no ; /* Next diagnostics data number. */
struct {
short diag_no ; /* Diagnostics data number. */
short diag_type ;/* Diagnostics data attribute. */
} info[N] ;/* N : Number of diagnostics data information items to be read. */
} ;
[Arguments]
s_number [ in ] Specify a starting diagnostics data number.
read_no [in] Specify the number of diagnostics data information items to be read.
diagif [out] Buffer to which diagnostics data information is returned.
A pointer to diagif to which diagnostics data information is returned.
info_no Number of diagnostics data information items.
Number of diagnostics data information items actually read.
prev_no Previous diagnostics data number.
Valid number before the diagnostics data information read first.
next_no Next diagnostics data number.
Valid number after the diagnostics data information read last.
info[N].diag_no Diagnostics data number (number of diagnostics data actually present).
- 551 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) The specified starting diagnostics data number (s_number) is invalid.
[Description]
Reads CNC diagnostics data information specified with s_number and read_no.
Basically, CNC diagnostics data is discontinuous, and the type, size, and other
attributes vary according to the individual numbers. This function is used to, for
example, display diagnostics data.
- 552 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.100 Read the minimum parameter number, maximum parameter number, and total number of parameters.
<Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdparanum
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdparanum( struct odbparanum *paranum ) ;
struct odbparanum {
unsigned short para_min ; /* Minimum parameter number. */
unsigned short para_max ; /* Maximum parameter number. */
unsigned short total_no ; /* Total number of parameters. */
} ;
[Arguments]
paranum [out] Buffer to which the maximum parameter number, the minimum parameter
number, and the total number of parameters are returned.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the minimum CNC parameter number, the maximum CNC parameter number, and the total
number of CNC parameters.
The distribution of CNC parameters varies from model to model, and additional parameters
may be provided by function expansion.
- 553 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.101 Read the minimum setting parameter number, maximum setting parameter number, and total
number of setting parameters. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdsetnum
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdsetnum( struct odbsetnum *setnum ) ;
struct odbsetnum {
unsigned short set_min ; /* Minimum setting parameter number. */
unsigned short set_max ; /* Maximum setting parameter number. */
unsigned short total_no ; /* Total number of setting parameters. */
} ;
[Arguments]
setnum [out] Buffer to which the maximum setting parameter number, the minimum
setting parameter number, and the total number of setting parameters
are returned.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the minimum CNC setting parameter number, the maximum CNC setting parameter number,
and the total number of CNC setting parameters.
The distribution of CNC setting parameters varies from model to model, and additional
parameters may be provided by function expansion.
- 554 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.102 Read the minimum diagnostics data number, maximum diagnostics data number, and total number
of diagnostics data items. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rddiagnum
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rddiagnum( struct odbdiagnum *diagnum);
struct odbdiagnum {
unsigned short diag_min ; /*Minimum diagnostics data number.*/
unsigned short diag_max ; /*Maximum diagnostics data number.*/
unsigned short total_no ; /*Total number of diagnostics data items.*/
} ;
[Arguments]
diagnum [out] Buffer to which the maximum diagnostics data number, the minimum
diagnostics data number, and the total number of diagnostics data items
are returned.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the minimum CNC diagnostics data number, the maximum CNC diagnostics data number,
and the total number of CNC diagnostics data items.
The distribution of CNC diagnostics data varies from model to model, and additional data
may be provided by function expansion.
- 555 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.103 Read the number of spindles. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdnspdl
[Syntax]
#include <fwindow.h>
short cnc_rdnspdl( short *spdl );
[Arguments]
spdl [out] Specify the starting address of a variable for holding the number of
spindles.
"0" to "3"
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the number of spindles that can be controlled by the CNC. This number does not
mean the number of installed spindles.
- 556 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.104 Read program directory (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdprogdir2
[Syntax]
#include <data.h>
#include <fwindow.h>
struct prgdir2 {
long number;
long length;
char comment[51];
char dummy;
} ;
[Arguments]
type [in] Specify the type of data to be read.
0 : Program numbers only
1 : Program numbers and comments
2 : Program numbers, comments, and the numbers of characters
used
top_prog [in/out] Specify a pointer to a starting program number.
After the function is called, the starting program number
actually read is set.
num_prog [in/out] Specify a pointer to the number of programs to be read.
After the function is called, the number of programs actually
read is set.
buf [out] Buffer to which a program directory is returned.
- 557 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return value are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) Function is disabled.
EW_LENGTH( 2) The specified data length is invalid.
The number of programs to be read (num_prog) is invalid.
EW_NUMBER( 3) Data number error.
The starting program number (top_prog) is invalid.
EW_ATTRIB( 4) Data attribute error.
The output format (type) is invalid.
[Description]
Reads the program numbers of all machining programs registered in the CNC.
As many program numbers as specified, starting with a specified program number, and their
comments and numbers of characters used are read.
length represents a program size. A program size is returned. This is valid when the
type argument is set to "2".
- 558 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.105 Read axis name. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdaxisname
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdaxisname( short *data_num, struct odbaxisname *axisname );
struct odbaxisname {
char name ; /* Axis name. */
char suff ; /* Axis name suffix. */
} ;
[Arguments]
data_num [in/out] Specify a pointer to a variable that holds the number of axes
to be read.
After the function ends, the number of axes actually read is
set.
axisname [out] Buffer to which an axis name is returned.
name An axis name is returned.
suff The suffix of an axis name is returned.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of axes (*data_num) is "0" or less.
[Description]
Reads as many axis names as the number of axes specified in (*data_num), starting with
the first axis.
If (*data_num) is greater than the current number of controlled axes, the number of
actually read axes (the number of the controlled axes) is set in (*data_num). If
(*data_num) is smaller than the current number of controlled axes, data for the number
of axes specified in (*data_num) is read.
axisname areas must be prepared as many as the number of axes specified in (*data_num).
- 559 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.106 Read position information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdposition
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdposition( short type, short *data_num,
struct odbpos *position );
struct odbpos {
POSELM abs; /* Absolute coordinates. */
POSELM mach; /* Machine coordinates. */
POSELM rel; /* Relative coordinates. */
POSELM dist; /* Distance to go. */
} ;
[Arguments]
type [in] Specify the type of data to be read.
0 : Absolute coordinates
1 : Machine coordinates
2 : Relative coordinates
3 : Distance to go
-1 : All types
data_num [in/out] Specify a pointer to a variable that holds the number of axes
to be read.
After the function ends, the number of axes actually read is
set.
position [out] Buffer to which a coordinate value is returned.
abs POSELM structure to which an absolute coordinate value is
returned.
mach POSELM structure to which a machine coordinate value is
returned.
rel POSELM structure to which a relative coordinate value is
returned.
dist POSELM structure to which the distance to go is returned.
- 560 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of axes (*data_num) is "0" or less.
EW_ATTRIB( 4) Data attribute error.
The specified type of coordinate values (type) is invalid.
[Description]
Reads as many coordinate values as the number of axes specified in (*data_num), starting
with the first axis.
If (*data_num) is greater than the current number of controlled axes, the number of
actually read axes (the number of the controlled axes) is set in (*data_num).
If (*data_num) is smaller than the current number of controlled axes, data for the number
of axes specified in (*data_num) is read.
position areas must be prepared as many as the number of axes specified in (*data_num).
- 561 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.107 Read speed information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdspeed
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdspeed( short type, struct odbspeed *speed );
struct odbspeed {
SPEEDELM actf; /* Composite speed. */
SPEEDELM acts; /* Spindle speed. */
} ;
[Arguments]
type [ in ] Specify the type of data to be read/
0 : Composite speed
1 : Spindle speed
-1 : All
speed [ out ] Buffer to which speed data is returned.
actf SPEEDELM structure to which the composite speed is returned.
acts SPEEDELM structure to which the spindle speed is returned.
- 562 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Data Speed
Dec Decimal point position of speed
Unit Unit of speed
0 : mm/min
1 : inch/min
2 : rpm
3 : mm/rev
4 : inch/rev
name Name (ASCII)
Composite speed : "F"
Spindle speed : "S"
suff Name suffix (ASCII)
When multi-spindle control is enabled for spindle speed, the
number (ASCII) of a position coder selected is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_ATTRIB( 4) Data attribute error.
The specified data type (type) is invalid.
[Description]
Obtains a composite speed and a spindle speed.
The spindle speed obtained by this function is the speed of the main spindle indicated
on the CNC position display screen.
- 563 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.108 Read servo load meter. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdsvmeter
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdsvmeter( short *data_num, struct odbsvload *loadmeter );
struct odbsvload {
LOADELM svload; /* Servo load meter. */
} ;
[Arguments]
data_num [in/out] Specify a pointer to a variable that holds the number of axes
to be read.
After the function ends, the number of axes actually read is
set.
loadmeter [out] Buffer to which load meter values are returned.
- 564 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of axes (*data_num) is "0" or less.
[Description]
Reads as many servo load meter values as the number of axes specified in (*data_num),
starting with the first axis.
If (*data_num) is greater than the current number of servo axes, the number of actually
read axes (the number of servo axes) is set in (*data_num).
If (*data_num) is smaller than the current number of servo axes, data for the number
of axes specified in (*data_num) is read.
svload areas must be prepared as many as the number of axes specified in (*data_num).
- 565 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.109 Read spindle load meter. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdspmeter
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdspmeter( short type, short *data_num,
struct odbspload *loadmeter );
struct odbspload {
LOADELM spload; /* Spindle load meter value. */
LOADELM spspeed; /* Spindle motor speed. */
} ;
[Arguments]
type [in] Specify the type of data to be read.
0 : Spindle load meter value
1 : Spindle motor speed
-1 : All types
data_num.[in/out] Specify a pointer to a variable that holds the number of
spindles to be read.
After the function ends, the number of spindles actually read
is set.
loadmeter [out] Buffer to which a load meter value is returned.
svload LOADELM structure to which a spindle load meter value is
returned.
- 566 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Data block error.
The number of spindles (data_num) is "0" or less.
EW_ATTRIB( 4) Data attribute error.
The specified data type (type) is invalid.
[Description]
Reads spindle load meter values and spindle motor speeds.
If (data_num) is greater than the current number of spindles, the number of actually
read spindles is set in (data_num).
If (data_num) is smaller than the current number of spindles, data for the number of
spindles specified in (data_num) is read.
- 567 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.110 Read modal G code.<Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdgcode
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdgcode( short type, short block, short *num_gcd,
struct odbgcd *g_code );
struct odbgcd {
short group ; /* G code group. */
short flag ; /* Additional information. */
char code[8] ; /* G code. */
} ;
[Arguments]
type [in] Specify a G code group to be read.
0 to 36 : Read a modal G code
-1 : Read modal G codes at a time
100 to 103: Read a one-shot G code
-2 : Read one-shot G codes at a time
block [in] Specify a target block for reading.
0 : Previous block
1 : Currently executed block
2 : Next block
num_gcd [in/out] Specify a pointer to the number of G codes to be read.
After the function is called, the number of G codes actually
read is set.
g_code [out] Buffer to which G code data is returned.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of G codes to be read (*num_gcd) is invalid.
EW_NUMBER( 3) Data number error.
The specified G code group (type) is invalid.
EW_ATTRIB( 4) Data attribute error.
The specified block (block) is invalid.
- 568 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads G code information specified on the CNC side.
Prepare one g_code when reading one G code. When reading G codes at a time, prepare as
many g_code areas as the number of G codes to be read (*num_gcd).
- 569 -
3.Function References PROGRAMMING B-64303EN-3/01
- 570 -
B-64303EN-3/01 PROGRAMMING 3.Function References
group The group number (the value specified in type) of a read G code is set.
For example, when this function is executed during execution of block N100 in
the following machining program, the results shown below are obtained:
N090 G18 ;
N100 G01 Z100. ;
N110 G17 G02 X10. Y-20. R12. ;
- 571 -
3.Function References PROGRAMMING B-64303EN-3/01
- 572 -
B-64303EN-3/01 PROGRAMMING 3.Function References
group The group number (the value specified in type) of a read one-shot G code
is set.
- 573 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.111 Read command value. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdcommand
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdcommand( short type, short block, short *num_cmd,
struct odbcmd *command );
struct odbcmd {
char adrs ; /* Command address. */
char num ; /* M code number or axis number. */
short flag ; /* Additional information. */
long cmd_val ; /* Command value data. */
long dec_val ; /* Number of decimal positions in the command value.*/
} ;
[Arguments]
type [in] Specify the type of a command value.
0 to 29 : Read a modal code other than G codes
-1 : Read modal codes other than G codes at a time
100 to 129 : Read a command value
-2 : Read command values at a time
200 to 223 : Read an axis command value
-3 : Read axis command values at a time
block [in] Specify a target block for reading.
0 : Previous block
1 : Currently executed block
2 : Next block
num_cmd [in/out] Specify a pointer to the number of data items to be read.
After the function is called, the number of data items actually
read is set.
command [out] Buffer to which command value data is returned.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of data items to be read (*num_cmd) is invalid.
- 574 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads a command value.
Information is stored in members of command. Data that can be read is modal data other
than G codes, and command values.
Prepare one command area when reading one command value. When reading command values
at a time, prepare as many command areas as the number of data items to be read (*num_cmd).
Values specified with "D", "E", "F", "H", "L", "M", "N", "O", "S", "T", and the
second auxiliary function ("A", "B", "C", "U", "V", or "W" specified in parameter
No. 3460) are read.
- 575 -
3.Function References PROGRAMMING B-64303EN-3/01
- 576 -
B-64303EN-3/01 PROGRAMMING 3.Function References
When the specified address is not specified in the specified block, "0" is set
in the data area pointed to by num_cmd.
- 577 -
3.Function References PROGRAMMING B-64303EN-3/01
type Axis
200 1st axis
201 2nd axis
: :
206 7th axis
207 8th axis
num An axis number ("1" to the maximum number of controlled axes) is set
in binary form.
- 578 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 579 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.112 Read alarm status (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_alarm2
[Syntax]
#include <fwindow.h>
short cnc_alarm2( long *alarm );
[Arguments]
alarm [ out ] Specify the address of a variable for acquiring alarm status
information.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads the alarm status when the CNC is placed in the alarm status.
When the CNC alarm status is monitored with an application program, this function is
used to display maintenance information and guidance information about how to release
alarms. When the CNC is in the system alarm state, communication is disabled entirely,
so no alarm status can be acquired.
When the CNC is in the system alarm state, no data can be transferred between the MMC
and the CNC, so no alarm status can be acquired.
The following addresses are assigned to variables for acquiring alarm status
information:
- 580 -
B-64303EN-3/01 PROGRAMMING 3.Function References
#14 : Reserved
#15 : External alarm message (EX)
#16 : Reserved
#17 : Reserved
#18 : Reserved
#19 : PMC error (PC)
#20 to #31 : (Not used)
- 581 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.113 Read operator's message (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdopmsg2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdopmsg2( short type,short length,struct opmsg2 *opmsg );
struct opmsg2 {
short datano ; /* Operator's message number. */
short type ; /* Operator's message type. */
short char_num ; /* Number of message characters. */
char data[MSG_SIZE] ; /* Operator's message character string. */
} ; /* MSG_SIZE: Number of message characters. */
[Arguments]
type [ in ] Specify the type of an operator's message.
0 : First message
1 : Second message
2 : Third message
3 : Fourth message
-1 : All messages
length [ in ] Specify the data block length (opmsg size).
Single message (first to fourth message)
All messages
opmsg [ out ] Buffer to which an operator's message is returned.
The operator's message is stored in data in opmsg.
datano An operator's message number is set.
- Message found:
With no number: "0"
With number: "2000" to "2099"
- No message found: "-1"
type The type of an operator's message is set.
0 to 3 : First to fourth message
char_num The number of operator's message characters is set.
1 to 64 : Operator's message
The number of characters includes "\0" placed at the end.
data An operator's message character string is set.
An ASCII string is set. Character "\0" is set at the end.
- 582 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The size (length) in opmsg is invalid.
EW_ATTRIB( 4) Data attribute error.
The specified operator's message type (type) is invalid.
EW_PARAM( 9) CNC parameter error.
Bit 0 (PCC) of parameter No. 11931 is set to "0".
EW_NOOPT( 6) A required function is not present.
External message
External data input
[Description]
Reads operator's messages of the CNC.
0┌───────────┐ ──
│ datano │ ↑
2├───────────┤ │
│ type │ │
4├───────────┤ │
│ char_num │ │
6├─────┬─────┘length
│ data[0] │ │
7├─────┤ │
~ ~ │
6+63├─────┤ │
│ data[63] │ ↓
6+64└─────┘ ──
All messages
0┌───────────┐ ──
│ 1st message │ ↑
70├───────────┤ │
│ 2nd message │ │
140├───────────┤length
│ 3rd message │ │
210├───────────┤ │
│ 4th message │ ↓
280└───────────┘ ──
- 583 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.114 Read operator's message (3). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdopmsg3
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdopmsg3( short type, short *number, struct opmsg3 *opmsg );
struct opmsg3 {
short datano ; /* Operator's message number. */
short type ; /* Operator's message type. */
short char_num ; /* Number of message characters. */
char data[MSG_SIZE] ; /* Operator's message character string. */
} ; /* MSG_SIZE: Number of message characters. */
[Arguments]
type [in] Specify the type of an operator's message.
0 : First message
1 : Second message
2 : Third message
3 : Fourth message
4 : Macro message
-1 : All messages
number [in/out] Specify the number of messages to be read.
The number of data items actually read is set in *number.
When type = "0" to "4", specify "1".
When type = "-1", specify "5".
opmsg [out] Buffer to which operator's messages are returned.
Operator's messages are stored in data in opmsg.
datano An operator's message number is set.
- Message found:
With no number: "0"
* For one operator's message
With number: "2100" to "2199"
* For four operator's messages
- No message found: "-1"
type The type of an operator's message is set.
0 to 3 : First to fourth message
4 : Macro message
char_num The number of operator's message characters is set.
The number of characters includes "\0" placed at the end.
data An operator's message character string is set.
An ASCII string is set. Character "\0" is set at the end.
- 584 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the number of messages (number).
EW_ATTRIB( 4) Data attribute error.
The specified operator's message type (type) is invalid.
EW_NOOPT( 6) A required function is not present.
External message
External data input
[Description]
Reads operator's messages of the CNC.
- 585 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.115 Read spindle name. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdspdlname
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdspdlname( short *data_num, struct odbspdlname *spdlname );
struct odbspdlname {
char name ; /* Spindle name. */
char suff1 ; /* Spindle name suffix 1. */
char suff2 ; /* Spindle name suffix 2. */
char suff3 ; /* Not used. */
} ;
[Arguments]
data_num [in/out] Specify a pointer to a variable that holds the number of spindles to
be read.
After the function ends, the number of spindles actually read is set.
spdlname [out] Buffer to which a spindle name is returned.
name Spindle name (ASCII).
ASCII code 'S' is stored.
suff1 Spindle name suffix 1 (ASCII).
A spindle number ("1", "2", ...) is stored.
suff2 Spindle name suffix 2 (ASCII).
When the spindle switch function is provided, the following ASCII
code is stored:
Main spindle : "1"
Subspindle : "2"
When the spindle switch function is not provided, a NULL character
('\0') is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of spindles (*data_num) is "0" or less.
- 586 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads as many spindle names as the number specified in (*data_num), starting with the
first spindle. When (*data_num) is greater than the current total number of spindles,
the number of spindles actually read (the total number of spindles) is set in (*data_num).
When (*data_num) is smaller than the current total number of spindles, data items as
many as the number specified in (*data_num) are read.
- 587 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.116 Read program directory (3). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdprogdir3
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdprogdir3( short type, long *top_prog, short *num_prog,
struct prgdir3 *buf );
struct prgdir3 {
long number;
long length;
long page;
char comment[52];
struct{
short year;
short month;
short day;
short hour;
short minute;
short dummy;
} mdate;
struct{
short year;
short month;
short day;
short hour;
short minute;
short dummy;
} cdate;
} ;
[Arguments]
type [in] Specify the type of a directory of programs to be read.
0 : Program numbers only
1 : Program numbers and comments
2 : Program numbers, comments, and the numbers of characters used
top_prog [in/out] Specify a pointer to a starting program number.
After the function is called, the starting program number actually
read is set.
num_prog [in/out] Specify a pointer to the number of programs to be read.
After the function is called, the number of programs actually read
is set.
buf [out] Buffer to which a program directory is returned.
- 588 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of programs to be read (num_prog) is invalid.
EW_NUMBER( 3) Data number error.
The starting program number (top_prog) is invalid.
EW_ATTRIB( 4) Data attribute error.
The output format (type) is invalid.
[Description]
Reads a directory of the program numbers of all machining programs registered in the
CNC.
As many program numbers as specified, starting with a specified program number, and their
comments, dates (dates of creation and dates of update), and program sizes are read.
- 589 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.117 Read tool offset information (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtofsinfo2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtofsinfo2( struct odbtlinf2 *tlinf2 );
struct odbtlinf2 {
short ofs_type; /* Memory type. */
short use_no; /* Number of offsets that can be used. */
short ofs_enable ; /* Type of offsets that can be used. */
} ;
[Arguments]
tlinf2 [out] Buffer to which tool offset information is returned.
Binary data is stored in ofs_type and use_no of tlinf2.
ofs_type Offset memory type.
- Machining center:
0 : Memory type A
1 : Memory type B
2 : Memory type C
- Lathe:
0 : No tool geometry and wear compensation performed.
1 : Tool geometry and wear compensation performed.
use_no Number of usable offsets. 0 to 999 sets
ofs_enable Type of usable offsets (Enabled only for the T series. These are set
to 0 for the M series.)
#0 : X-axis offset. Usable = "1"/not usable = "0"
#1 : Y-axis offset. Usable= "1"/not usable = "0"
#2 : Z-axis offset. Usable= "1"/not usable = "0"
#3 : Tool-nose radius compensation. Usable= "1"/not usable =
"0"
#4 : Virtual tool tip. Usable= "1"/not usable = "0"
#5 to #15 : (Not used.)
- 590 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NOOPT( 6) A required function is provided.
M series Number of tool offsets: 32/400 sets
Tool offset memory A/C
Tool radius and tool-nose radius compensation
T series Number of tool offsets: 32/64/99/128/200 sets
Tool geometry and wear compensation
Tool radius and tool-nose radius compensation
[Description]
Reads the tool offset memory type and the number of usable offsets.
- 591 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.118 Read custom macro variables (double-precision floating point). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmacror2
[Syntax]
#include <fwindow.h>
short cnc_rdmacror2( unsigned long s_no, unsigned long *num,
double *data );
[Arguments]
s_no [in] Specify a starting custom macro variable number with which reading starts.
num [in/out] Specify a pointer to the number of custom macro variables to be read.
After the function is called, the number of custom macro variables
actually read is set.
data [out] Specify a pointer to custom macro data to be read.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Data number error.
The specified custom macro variable number (s_no) is invalid.
EW_DATA( 5) Data error.
A custom macro variable value is beyond the valid range.
EW_NOOPT( 6) A required function is not provided. Enable the custom macro function
(bit 5 (NMC) of parameter No. 8135 = 0).
[Description]
Reads as many custom macro variables as specified in num, starting with a custom macro
having a number specified in s_no.
Data is stored in data in the double format. It is not affected by the setting of
cnc_setmactype.
- 592 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Custom macro variables may have a special value, "empty". This value is represented as
follows:
0xFFFFFFFFFFFFFFFF
For details of custom macro variables, refer to "Common to Lathe System/Machining Center
System User's Manual" (B-64304EN) of the CNC.
- 593 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.119 Write custom macro variables (double-precision floating point). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrmacror2
[Syntax]
#include <fwindow.h>
short cnc_wrmacror2( unsigned long s_no, unsigned long *num,
double *data );
[Arguments]
s_no [in] Specify a starting custom macro variable number with which writing starts.
num [in/out] Specify a pointer to the number of custom macro variables to which data
is to be written.
After the function is called, the number of custom macro variables to which
data has actually been written is stored.
data [in] Specify a pointer to custom macro data to be written.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Data number error.
The specified custom macro variable number (s_no) is invalid.
EW_DATA( 5) Data error.
A custom macro variable value is beyond the valid range.
EW_NOOPT( 6) A required function is not provided. Enable the custom macro function
(bit 5 (NMC) of parameter No. 8135 = 0).
[Description]
Rewrites as many custom macro variables as specified in num, starting with a custom
macro variable having a number specified in s_no.
Data is stored in data in the double format. It is not affected by the setting of
cnc_setmactype.
- 594 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Custom macro variables may have a special value, "empty". This value is represented as
follows:
0xFFFFFFFFFFFFFFFF
For details of custom macro variables, refer to "Common to Lathe System/Machining Center
System User's Manual" (B-64304EN) of the CNC.
- 595 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.120 Read controlled axis/spindle-related data. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdaxisdata
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdaxisdata( short cls, short* type, short num, short* len,
struct odbaxdt *axdata );
struct odbaxdt {
char name[4]; /* Axis name. */
long data; /* Data. */
short dec; /* Decimal point position of data. */
short unit; /* Unit of data. */
short flag; /* Flag. */
short reserve; /* Not used. */
} ;
[Arguments]
cls [in] Specify the class of data to be read.
1 : Coordinates
2 : Servo
3 : Spindle
4 : Spindle currently selected
5 : Speed
type [in] Pointer to an array that specifies the type of data to be read.
The following values can be specified according to the value of cls:
- cls = "1" (Coordinate value)
0 : Absolute coordinate value
1 : Machine coordinate value
2 : Relative coordinate value
3 : Distance to go
4 : Handle interrupt amount (input unit)
5 : Handle interrupt amount (output unit)
6 : Program restart position
7 : Distance to go at the time of program restart
8 : Block restart position
9 : Distance to go at the time of block restart
10 : Absolute coordinate value (for offset and graphic screens)
11 : Relative coordinate value (for offset and graphic screens)
- 596 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length. Alternatively, the number of axes (*len)
is "0" or less.
EW_NUMBER( 3) Data attribute error.
The specified data class (cls) is invalid.
EW_ATTRIB( 4) Data attribute error.
The specified data type (type) is invalid.
Alternatively, the number of types (num) exceeds 4.
EW_NOOPT( 6) A required function is not provided.
[Description]
This function is a revised function of the cnc_rdposition, cnc_rdspeed, cnc_rdsvmeter,
cnc_rdspmeter, and cnc_rdhndintrpt functions and is intended to support the axis name
extension function. The function reads axis- and spindle-related data.
Specify the class of data to be read in the cls argument, and specify the type of data
to be read in a short array (type[]). The number of arrays is specified in the num argument.
Up to four types of data can be read at a time. If an attempt is made to read more than
four types of data, the EW_ATTRIB error results.
- 597 -
3.Function References PROGRAMMING B-64303EN-3/01
The number of axes to be read is specified in the (*len) argument. According to the value
of data class cls, (*len) is set as follows:
1. When cls is set to a coordinate value (=1), servo (=2), or spindle (=3)
Data for as many axes as specified in (*len), starting with the first axis is
read.
After the function is executed, if (*len) is greater than the number of currently
valid axes, the number of actual axes is set in (*len).
If (*len) is smaller than the number of currently valid axes, data for as many
axes as specified in (*len) is read.
2.When cls is set to the spindle being selected (=4) or speed (=5)
Data for one axis is read at any time. When the spindle being selected is
specified, however, if there is no spindle being selected, "0" is set in (*len).
The read data is stored in an array of the odbaxdt structure specified in the
axdata[] argument. This argument must have the size for num × (*len). The read
data is stored in units of the size specified in (*len) in the order specified
in type[] as follows:
Even if the number specified in (*len) is smaller than the actual number of
axes, data is stored according to the value specified in (*len) when the function
is called.
data Data.
- 598 -
B-64303EN-3/01 PROGRAMMING 3.Function References
flag Flags.
Flags are set according to the cls value as follows:
- cls ="1" (coordinate value)
#0 : Display status
1 = Displayed on the CNC screen
0 = Not displayed on the CNC screen
#1 : Axis detachment
1 = Enabled
0 = Disabled
#2 : Interlock
1 = Enabled
0 = Disabled
#3 : Machine lock
1 = Enabled
0 = Disabled
#4 : Servo off
1 = Enabled
0 = Disabled
#5 : In-position check
1 = Not in the in-position check state
0 = In the in-position check state
#6 : Mirror image
1 = Enabled
0 = Disabled
#7 to #15 : Not used
- 599 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.121 Start output of NC program for operation (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_dncstart2
[Syntax]
#include <fwindow.h>
short cnc_dncstart2( char *filename );
[Arguments]
filename [out] Specify the starting address of an area for storing a program number
for operation posted by the CNC.
When the CNC requires a program for a DNC operation, only a null
character is set as the program number.
The area for storing a program number for operation must be at least
16 bytes long. If a 16-byte area is not allocated, the operation of this
function is not guaranteed.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_BUSY(-1) The cnc_dncstart2 function has already been executed.
Use the cnc_dncend2 function to end the previous output operation.
EW_REJECT(13) The CNC does not start a DNC operation.
EW_PARAM( 9) Parameter error.
[Description]
Executing this function shows whether the CNC has started a DNC operation or not.
- 600 -
B-64303EN-3/01 PROGRAMMING 3.Function References
When the CNC has started a DNC operation, this function returns EW_OK. When EW_OK is
returned, the program number requested by the CNC (or a NULL character in case of a DNC
operation) is acquired. Then, use the cnc_dnc2 function to output a program for the DNC
operation.
When the CNC has not started a DNC operation, this function returns EW_REJECT.
When the cnc_dnc2 or cnc_dncend2 function is executed without executing this function,
EW_FUNC is returned.
cnc_dncstart2() retry
=EW_REJECT
=EW_OK
retry
Output NC program
for DNC operation
cnc_dnc2() =EW_BURRER
=EW_OK
Is there data
left?
Yes
No
cnc_dncend2()
- 601 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.122 Output NC program for operation (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_dnc2
[Syntax]
include <fwindow.h>
short cnc_dnc2( long *length, char *data );
[Arguments]
length [in/out] Specify a pointer to a long variable in which the number of the
characters of an NC program to be output is set.
When control is returned from this function, the number of characters
actually output is set.
Data [in] Specify the starting address of an area in which an NC program to be
output is set.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_RESET(-2) The CNC is reset.
After a DNC operation starts, the CNC requests the stop of a remote
program operation.
EW_FUNC( 1) The cnc_dncstart2 function has not been executed.
EW_LENGTH( 2) The specified data length is invalid.
A negative value is specified as the number of output characters.
EW_PARAM( 9) Parameter error.
EW_BUFFER(10) The buffer is full.
Because the buffer does not have enough space, output operation fails.
Retry.
- 602 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Outputs an NC program for remote program operation (DNC operation) on the CNC side.
This function outputs as many characters as the number specified in length. If the buffer
for data transfer to the CNC does not have enough space for the specified number of
characters, data for the available buffer space is output, and the number of actually
output characters is set in length.
When the CNC stops the DNC operation, EW_RESET is returned. When this function returns
EW_RESET, specify DNC_CANCEL as the output result in the CNC_dncend2 function to end
NC program output.
EOB command 1 EOB command 2 EOB ..... command n EOB Mxx EOB
Command 1 to n ASCII characters
EOB LF(0x0A)
Mxx M code for ending DNC operation (such as M02 and M30)
- 603 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.123 Stop output of NC program for operation (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_dncend2
[Syntax]
#include <fwindow.h>
short cnc_dncend2( short result );
[Arguments]
result [in] DNC_NORMAL : Successful.
DNC_CANCEL : Canceled by operation stop request from the CNC.
DNC_OPENERR : A file could not be opened.
DNC_NOFILE : A file is not present.
DNC_READERR : A file could not be read.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) The cnc_dncstart2 function has not been executed.
EW_DATA( 5) The value specified as the output result is invalid.
EW_PARAM( 9) Parameter error.
Set parameters as follows:
[Description]
Notifies the CNC of the end of the output of a CNC program for a DNC operation.
When notifying the CNC, specify the result of NC program output processing performed
by an application program to indicate whether the processing ended normally or ended
with an error.
When EW_RESET is returned during NC program output (during execution of the cnc_dnc2
function), specify DNC_CANCEL as the output result in this function, and execute this
function.
- 604 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.124 Read abnormal load torque data. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_loadtorq
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_loadtorq( short motor, short axis, short length,
struct odbload *buf ) ;
struct odbload {
short datano ; /* Motor type. */
short type ; /* Axis number. */
short data[N] ; /* Abnormal load torque data. */
} ; /* N is the maximum number of controlled axes. */
[Arguments]
motor Motor type.
0 : Servo motor
1 : Spindle motor
axis Axis number. (= (1 to the maximum number of controlled axes) or "-1")
-1 : Specifies all axes (ALL_AXES).
1 to m : Specifies one axis (m: current number of controlled
axes).
length Data block length. (= 4 + 2 × (number of axes to be read))
buf Buffer in which abnormal load torque data is stored.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) The specified data block length is invalid.
The buf size (length) is invalid.
EW_ATTRIB( 4) The specified axis number is invalid.
The specified data is neither "-1" nor a number ranging from "1" to
the maximum number of controlled axes.
- 605 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads abnormal load torque data (estimated load torque) of servo motors or spindle motors.
Data is stored in buf in signed binary form.
As an axis number (axis), a value from "1" to the maximum number of controlled axes (read
for one axis) or "-1" (read for all axes at a time) is specified. When all axes are
specified for spindle motors, data for two axes is read.
In buf.data, a digitized value of load torque data is stored in binary form. When reading
for one axis is specified, load torque data for a specified axis is stored in buf.data[0].
buf 0┌─────┐ ─
│datano │ ↑
2├─────┤ │
│type │ │
4├─────┤ │
│data[0] │ │
6├─────┤ length
~ ~ │
4+2×(N-1) ├─────┐ │
│data[N-1] │ │
├─────┤ │
│data[N] │ ↓
4+2×N └─────┘ ─
- 606 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program displays the load torque data of the first spindle motor on the
screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
- 607 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.125 Read CNC hardware configuration information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdsyshard
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdsyshard( short hard_num, short *read_num,
struct odbsysh *syshard) ;
struct odbsysh {
unsigned long id1 ; /* ID-1(ID) */
unsigned long id2 ; /* ID-2 (additional information). */
short group_id ; /* Group name ID. */
short hard_id ; /* Hardware name ID. */
short hard_num ; /* Serial number assigned to information. */
short slot_no ; /* Slot number. */
short id1_format ; /* ID-1 display format. */
short id2_format ; /* ID-2 display format. */
} ;
[Arguments]
hard_num For the first read operation, specify hard_num = 1.
Data is acquired in the order of information serial numbers. The second and
subsequent read operations are performed repeatedly with hard_num set to
(hard_num acquired last + "1").
read_num Specify a pointer to the number of hardware information items to be read.
Before the function is called, the number of hardware items to be read must
be specified.
After the function is called, the number of items actually read is set. A
value from 1 to 25 can be specified. If no data can be read, read_num = "0"
is returned.
syshard Pointer to a structure to which CNC hardware configuration information is
returned.
As many arrays as the number specified in (*read_num) are required.
id1 The ID of hardware is stored.
id2 Additional hardware information is stored.
group_id Group name ID of hardware.
A numeric value indicating the type of the group of each hardware item is
stored.
The group name IDs of major hardware items are as follows:
(When new data is added, an ID is added.)
0100H MAIN BOARD
0200H OPTION BOARD
0400H BUS EXTN
0500H (UNKNOWN)
- 608 -
B-64303EN-3/01 PROGRAMMING 3.Function References
0600H DISPLAY
0700H OTHERS
0f00H CERTIFY ID
hard_id Hardware name ID
A numeric value indicating the type of hardware is stored.
Major hardware name IDs are listed below.
(When new data is added, an ID is added.)
0100H MAIN BOARD
0101H CPU CARD
0102H SERVO CARD
0103H PMC MODULE
0110H FROM/SRAM
0200H FAST ETHER
0210H FL-NET
0220H PROFI MASTER
0230H PROFI SLAVE
0240H C LANGUAGE
0250H HSSB 2CH
0260H HSSB 1CH
0270H TPU
0280H ADD SPDL
0290H ADD AXIS
02A0H DEVNT MASTER
0400H BUS EXTN
0500H (QFS)
0510H (WRC)
0520H (ETC)
0530H (LIME)
0540H (NBG)
0550H (LSC)
0560H (PHI)
0570H (NEW)
0601H LCD BOARD
0602H DISP ID
0603H GUI CARD
0604H GUI BOARD
0605H GUI ID
0701H MDI ID
0702H BASIC UNIT ID
0f00H CERTIFY ID-1
0f01H CERTIFY ID-2
0f02H CERTIFY ID-3
hard_num A serial number of hardware information is stored.
slot_no A slot number is stored.
id1_format ID-1 display format.
- 609 -
3.Function References PROGRAMMING B-64303EN-3/01
When the following sample data is obtained, information is displayed as shown in the display
example:
/**** Sample data ***********************************************************
* group_id/hard_id/ id1 /id1_format/ id2 /id2_format/slot_no/hard_num *
* *
* 0100H 0100H 00010003 7 0 0 1 *
* 0100H 0101H 00060004 7 800C1104 6 0 2 *
* 0100H 0110H 0000C103 5 0 0 3 *
* *
* 0200H 0200H 10010007 7 0 1 4 *
* *
* 0200H 0220H 10040007 7 0 2 5 *
* *
* 0600H 0602H 00000005 2 0 0 6 *
****************************************************************************/
- 610 -
B-64303EN-3/01 PROGRAMMING 3.Function References
EW_OK( 0) Successful.
EW_DATA( 5) Error in the value of hard_num or read_num.
[Description]
Reads CNC hardware configuration information. Each information item is stored in a member
of a structure. Up to 25 hardware configuration information items can be read at a time.
When all information cannot be read at one time, specify hard_num, and read information
repeatedly. There is no path-dependent data.
- 611 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.126 Read CNC system information (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_sysinfo_ex
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_sysinfo_ex( struct odbsysex *sys );
struct odbsysex {
short max_axis; /* Maximum number of controlled axes. */
short max_spdl; /* Maximum number of spindles. */
short max_path; /* Maximum number of paths. */
short max_mchn; /* Maximum number of machine groups. */
short ctrl_axis; /* Number of controlled axes. */
short ctrl_srvo; /* Number of controlled servo axes. */
short ctrl_spdl; /* Number of controlled spindles. */
short ctrl_path; /* Number of controlled paths. */
short ctrl_mchn; /* Number of controlled machines. */
short reserved[3];
struct {
short system; /* System type. */
short group; /* System group type. */
short attrib; /* Path attribute. */
short ctrl_axis; /* Number of controlled axes in a path. */
short ctrl_srvo; /* Number of controlled servo axes in a path. */
short ctrl_spdl; /* Number of controlled spindles in a path. */
short mchn_no; /* Machine group number. */
short reserved;
} path[MAX_PATH];
} ;
MAX_PATH : 2
[Arguments]
sys [out] Pointer to the struct odbsysex structure to which CNC system information
is returned.
max_axis Maximum number of axes controllable in the entire CNC system.
max_spdl Maximum number of spindles controllable in the entire CNC system.
max_path Maximum number of paths controllable in the entire CNC system.
max_mchn Maximum number of machine groups controllable in the entire CNC system.
ctrl_axis Current number of controlled axes in the entire CNC system.
ctrl_srvo Current number of servo axes in the entire CNC system.
* The same value as the number of controlled axes is acquired.
ctrl_spdl Current number of spindles in the entire CNC system.
- 612 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Reads CNC-specific system information such as information indicating whether the CNC
system is a machining center system or lathe system, path information, and the number
of controlled axes.
Use this function to confirm compatibility between the CNC's system software and the
PMC's software or to obtain the number of axes before reading coordinate data such as
absolute coordinates or machine coordinates on the CNC side.
- 613 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.127 Read machine position of controlled axis (3). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_machine3
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_machine3( short axis, short length, short type,
struct iodbaxis *machine);
struct iodbaxis {
short dummy ; /* Not used. */
short type ; /* Axis number. */
long data[N] ; /* Machine position of controlled axis. */
} ; /* N : Maximum number of controlled axes. */
[Arguments]
axis Specify a target axis number for reading.
ALL_AXES : Specifies all axes. (ALL_AXES: "-1")
1 to m : Specifies one axis. (m: Current number of controlled axes)
length Specify the data block length (size of the iodbaxis structure).
- 614 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Servo or acceleration/deceleration
Value Coordinates to be read
delay
0 Machine-based machine coordinates Considered
Machine coordinates depending on
1 Not considered
bit 0 (MCN) of parameter No. 3104
2 Machine-based machine coordinates Not considered
machine Pointer to the iodbaxis structure to which the machine position on each
controlled axis is returned.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The size (length) of the iodbaxis structure is invalid.
EW_ATTRIB( 4) Data attribute error.
The specified axis number (axis) is invalid.
The machine coordinate type (type) is invalid.
[Description]
Reads the machine position on an axis specified in axis.
type specifies the type of machine position to be read.
When ALL_AXES is specified in axis, the positions on all axes can be read at a time.
In this case, the machine position on each axis is stored in the data array in the iodbaxis
structure.
The decimal point position of the machine position can be acquired by using the
cnc_getfigure function.
- 615 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.128 Read jogging speed or dry run speed. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdjogdrun
[Declaration]
#include <data.h>
#include <fwindow.h>
short cnc_rdjogdrun( short axis, struct odbjogdrun *jogdrun );
struct odbjogdrun {
struct speedelm jogdrun ; /* Jogging speed or dry run speed. */
} ;
struct speedelm {
long data ; /* Speed. */
short dec ; /* Decimal point position of speed. */
short unit ; /* Unit of speed. */
short reserve ; /* Not used. */
char name ; /* Name. */
char suff ; /* Suffix of name. */
} ;
[Arguments]
axis Specify "1" at any time.
Jogdrun Pointer to the speedelm structure to which the speed is returned.
Acquired information is stored.
Each member variable of the speedelem structure holds the following
value:
data Speed
dec Decimal point position of speed
unit Unit of speed
0 : mm/min
1 : inch/min
name Name (ASCII)
Jogging speed: "J"
Dry run speed: "D"
suff Suffix of the name (ASCII). Always set to "F"
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
- 616 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Obtains the jogging feedrate or dry run speed displayed on the CNC's position display
screen.
The jogging feedrate and dry run speed can be made visible or invisible by setting bit
7 (JSP) of parameter No. 3108. For details of the parameter, refer to "Parameter Manual"
(B-64310EN) of the CNC.
This function can acquire the jogging feedrate or dry run speed regardless of parameter
setting.
- 617 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.129 Read P-code macro variables (double-precision floating point). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpmacror2
[Syntax]
#include <fwindow.h>
short cnc_rdpmacror2( unsigned long stnum, unsigned long *num,
unsigned short type, double *mcval ) ;
[Arguments]
stnum [ in ] Specify a starting P-code macro variable number with which reading
starts.
num [ in ] Specify the number of P-code macro variables to be read.
After the function is called, the number of variables actually read
is set.
type [ in ] Specify the type of the target macro for reading.
0 : Conversational
1 : Auxiliary
2 : Execution
* For P-code macro variable numbers "10000" to "89999", this value
is ignored.
mcval [ out ] Array for storing read P-code macro variables.
For empty data, 0xFFFFFFFFFFFFFFFF is set.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Data number error. The specified P-code macro variable number (stnum)
is invalid.
EW_NOOPT( 6) A required function is not provided.
The macro executor function is required.
[Description]
Reads as many P-code macro variables as the number specified in num, starting with the
P-code macro variable (variable for the macro executor) specified in stnum.
- An argument for specifying a macro type, which is required when P-code macro
variables are read, is added.
- Values to be read were represented with an integer type variable value and
the number of decimal positions in a structure. With this function, these
values are represented in double form.
- 618 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- The block size specified at the time of reading is changed to the number of
P-code macro variables to be read.
- 619 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.130 Write P-code macro variables (double-precision floating point). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrpmacror2
[Syntax]
#include <fwindow.h>
short cnc_wrpmacror2( unsigned long stnum, unsigned long *num,
unsigned short type, double *pmacror );
[Arguments]
stnum [ in ] Specify a P-code macro variable number with which writing
starts.
num [ in ] Specify the number of P-code macro variables to which data is to be
written.
After the function is called, the number of variables actually written
is set.
type [ in ] Specify one of the following as the target macro type for writing:
0 : Conversational
1 : Auxiliary
2 : Execution
* For P-code macro variable numbers "10000" to "89999", this
value is ignored.
pmacror [ in ] Array of values to be written to P-code macro variables.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NUMBER( 3) Data number error.
The specified P-code macro variable number (stnum) is invalid.
EW_NOOPT( 6) A required function is not provided.
The macro executor function is required.
[Description]
Writes as many P-code macro variables as the number specified in num, starting with the
P-code macro variable number (variable for the macro executor) specified in stnum.
- An argument for specifying a macro type, which is required when P-code macro variables
are written, is added.
- Values to be written were represented with an integer type variable value and the number
of decimal positions. With this function, these values are represented in double form.
- 620 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- The block size specified for writing is changed to the number of P-code macro variables
to be written.
- 621 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.131 Read all alarm messages at once. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdalmmsg
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdalmmsg( short type, short *num, struct odbalmmsg *almmsg);
struct odbalmmsg {
long alm_no ; /* Alarm number. */
short type ; /* Alarm type. */
short axis ; /* Axis number. */
short dummy ; /* Reserved. */
short msg_len ; /* Number of message characters. */
char alm_msg[32]; /* Alarm message. */
};
[Arguments]
- 622 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) The specified data length is invalid.
The number of alarms (*num) is "0" or less.
EW_ATTRIB( 4) Data attribute error.
The specified alarm type (type) is invalid.
[Description]
Reads alarm messages issued in the CNC. All alarm messages can be read at once.
Unlike the cnc_rdalminfo function, this function inserts axis names in alarm messages
that are related to axes.
- 623 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.132 Read alarm message (extended message string). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdalmmsg2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdalmmsg2( short type, short *num,
struct odbalmmsg2 *almmsg) ;
struct odbalmmsg2 {
long alm_no ; /* Alarm number. */
short type ; /* Alarm type. */
short axis ; /* Axis number. */
short dummy ; /* Reserved. */
short msg_len ; /* Number of message characters. */
char alm_msg[64]; /* Alarm message. */
};
[Arguments]
type Specify an alarm type.
0 : Parameter writing switch on (SW)
1 : Parameter input that requires power-off (PW)
2 : I/O error (IO)
3 : PS for foreground (PS)
4 : Overtravel/external data input error (OT)
5 : Overheat (OH)
6 : Servo alarm (SV)
7 : Data I/O error (SR)
8 : Macro alarm (MC)
9 : Spindle alarm (SP)
10 : OT alarm other than PS alarms (DS)
11 : Alarm related to malfunction prevention function (IE)
12 : PS for background (BG)
13 : Excessive synchronization error (SN)
14 : Reserved
15 : External alarm message (EX)
16 : External alarm message (EX2)
- 624 -
B-64303EN-3/01 PROGRAMMING 3.Function References
17 :
External alarm message (EX3)
18 :
External alarm message (EX4)
19 :
PMC error (PC)
20 :
Not used
:
31 : Not used
num Specify a pointer to the number of alarms to be read.
Before calling the function, specify the number of alarms to be read. After
the function is called, the number of alarms actually read is set.
Almmsg Pointer to an array of a structure to which an alarm message is returned.
As many arrays as the number specified in (*num) are required.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) The specified data length is invalid.
The number of alarms (*num) is "0" or less.
EW_ATTRIB( 4) Data attribute error.
The specified alarm type (type) is invalid.
[Description]
Reads alarm messages issued in the CNC.
- 625 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.133 Read program directory (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdprogdir4
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdprogdir4( short type, long top_number, short *num_prog,
struct prgdir4 *buf);
struct prgdir4 {
long number;
long length;
long page;
char comment[52];
struct{
short year;
short month;
short day;
short hour;
short minute;
short dummy;
} mdate;
struct{
short year;
short month;
short day;
short hour;
short minute;
short dummy;
} cdate;
};
[Arguments]
type [in] Specify the format of a list of programs to be read.
0 : Program numbers only
1 : Program numbers and comments
2 : Program numbers, comments, dates, and sizes
top_number [in] Specify a starting program with which acquisition of information is
to be started, as the position of the program in the order of
registered NC programs ("1" or greater).
Programs are obtained sequentially from the smallest program number.
num_prog [in/out] Pointer to the number of programs to be read.
After the function is called, the number of programs actually read
is set.
- 626 -
B-64303EN-3/01 PROGRAMMING 3.Function References
buf [out] Pointer to the struct prgdir4 structure to which a program directory
is returned.
struct prgdir4 has the same format as the struct prgdir3 structure.
number Program number.
A program number is returned.
length Program size (the number of characters).
The program size in characters is returned.
This argument is valid when the type argument is set to "2".
Page Not used.
comment Comment.
A comment recorded immediately after the program number is stored.
A comment body consists of up to 48 characters (up to 50 characters
when the parentheses before and after the comment are included).
When a comment consisting of more than 48 characters is recorded,
the 49th and subsequent characters are not output.
When a program has no comment, only parentheses ("()") are output.
The character string ends with a NULL character.
This argument is valid when the type argument is set to "1" or "2".
mdate Date of update.
The date when the program was updated.
This argument is valid when the type argument is set to "2".
The structure consists of the following:
year : 4-digit year
month : Month
day : Day
hour : Hour
minute : Minute
cdate Not used.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 2) Error in the data block length.
The number of programs to be read (num_prog) is invalid.
EW_NUMBER( 3) Data number error.
The starting program number (top_number) is invalid.
EW_ATTRIB( 4) Data attribute error.
The output format (type) is invalid.
- 627 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the program numbers of all machining programs registered in the CNC.
As many program numbers as specified in num_prog, starting with the program number
specified in num_prog, and their comments, dates (dates of creation and dates of update),
and sizes are read.
[Example]
The following program reads the registration status of all NC programs and displays a
list of program numbers on the screen:
void example()
{
struct prgdir4 prg[BUFSIZE];
short i, num;
short top = 0;
do {
num = BUFSIZE;
ret = cnc_rdprogdir4( h, 0, &top, &num, prg );
if ( ret == EW_NUMBER ) {
break;
}
if ( ret ) {
printf( "ERROR: %d\n", ret );
break;
}
for ( i = 0 ; i < num ; i++ ) {
printf( "O%d\n", prg[i].number );
}
top = prg[num-1].number + 1;
} while ( num >= BUFSIZE );
}
- 628 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.134 Stop history data sampling. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_stopophis
[Syntax]
#include <fwindow.h>
short cnc_stopophis( void );
[Arguments]
------
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_REJECT(13) CNC processing is rejected.
[Description]
Instructs the CNC to stop sampling operation history data, alarm history data, and
external operator's message history data.
- 629 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.135 Resume history data sampling. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_startophis
[Syntax]
#include <fwindow.h>
short cnc_startophis( void );
[Arguments]
------
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Instructs the CNC to resume sampling operation history data, alarm history data, and
external operator's message history data.
- 630 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.136 Read the number of operation history data items. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdophisno
[Syntax]
#include <fwindow.h>
short cnc_rdophisno( unsigned short * hisno );
[Arguments]
hisno Specify the address of a variable for storing the number of operation
history data items.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) Function is not executed.
History data sampling is not stopped (by using the cnc_stopophis
function).
[Description]
Reads the number of operation history data items.
When reading operation history data by using the cnc_rdophistry3 function, use the
cnc_rdophisno3 function instead of this function.
Before this function can be used, history data sampling must be stopped (cnc_stopophis
function).
(Example)
When the following history data is displayed on the operation history screen of
the NC, using this function sets the number of operation history data items to "3".
- 631 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.137 Read the number of operation history data items (3). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdophisno3
[Syntax]
#include <fwindow.h>
short cnc_rdophisno3( unsigned short * hisno );
[Arguments]
hisno Specify the address of a variable for storing the number of operation
history data items.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) Function is not executed.
History data sampling is not stopped (cnc_stopophis function).
[Description]
Reads the number of operation history data items.
This function is a special function used when operation history data is to be read using
the cnc_rdophistry3 function.
Before this function can be used, history data sampling must be stopped (cnc_stopophis
function).
- 632 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.138 Read operation history data (4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdophistry4
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdophistry4( unsigned short s_no, unsigned short *e_no,
unsigned short *length, void *his);
struct odbophis4 {
short rec_len; /* Valid record length. */
short rec_type; /* Record type. */
union {
struct {
char key_code; /* Key code. */
char pw_flag; /* Power-on flag. */
short pth_no; /* Path number. */
short ex_flag; /* External MDI key flag. */
short hour; /* Hour. */
short minute; /* Minute. */
short second; /* Second. */
} rec_mdi; /* MDI key operation. */
struct {
short sig_name; /* Signal name. */
short sig_no; /* Signal number. */
char sig_old; /* Bit pattern before change. */
char sig_new; /* Bit pattern after change. */
short pmc_no; /* PMC number. */
short hour; /* Hour. */
short minute; /* Minute. */
short second; /* Second. */
short dummy; /* Not used. */
} rec_sgn; /* Signal. */
struct {
short alm_grp; /* Alarm type. */
short alm_no; /* Alarm number. */
short axis_no; /* Absolute axis number or absolute */
/* spindle number. */
short year; /* Year. */
short month; /* Month. */
short day; /* Day. */
short hour; /* Hour. */
short minute; /* Minute. */
short second; /* Second. */
- 633 -
3.Function References PROGRAMMING B-64303EN-3/01
- 634 -
B-64303EN-3/01 PROGRAMMING 3.Function References
struct {
short alm_grp; /* Alarm type. */
short alm_no; /* Alarm number. */
short axis_no; /* Absolute axis number or absolute */
/* spindle number. */
short year; /* Year. */
short month; /* Month. */
short day; /* Day. */
short hour; /* Hour. */
short minute; /* Minute. */
short second; /* Second. */
short pth_no; /* Path number. */
short dammy; /* Not used. */
short dsp_flg; /* Flag for message display. */
short axis_num; /* Total number of axes. */
char alm_msg[64];/* Alarm message. */
long g_modal[10];/* G code modal value. */
char g_dp[10]; /* #7: When 1 is set, the value is */
/* specified in a specified block. */
/* #6 to #0: Number of decimal */
/* positions.*/
long a_modal[10];/* B,D,E,F,H,M,N,O,S, or T */
/* code modal value. */
char a_dp[10]; /* #7: When 1 is set, the value is */
/* specified in a specified block. */
/* #6 to #0: Number of decimal */
/* positions.*/
long abs_pos[32];/* Absolute coordinate value when */
/* the alarm is issued. */
char abs_dp[32]; /* Number of decimal positions of */
/* the coordinate value when the alarm */
/* is issued.*/
long mcn_pos[32];/* Machine coordinate value when */
/* the alarm is issued. */
char mcn_dp[32]; /* Number of decimal positions of */
/* the coordinate value when the alarm */
/* is issued. */
} rec_mal; /* Alarm with a message with additional :/
/* information. */
struct {
short dsp_flg; /* Flag for message display. */
short om_no; /* Message number. */
short year; /* Year. */
short month; /* Month. */
short day; /* Day. */
short hour; /* Hour. */
short minute; /* Minute. */
short second; /* Second. */
- 635 -
3.Function References PROGRAMMING B-64303EN-3/01
- 636 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Arguments]
s_no Specify an operation history data number with which reading is started.
(Specify "1" or a greater value.)
e_no Specify a pointer to an operation history data number with which reading
is ended.
(Specify "1" or a greater value.)
The function returns the last operation history data number that was
actually read.
length Specify a pointer to the data block length required for storing
operation history data in a specified range.
The structure for storing each operation history data item is shown
below. The size of a structure is indicated by rec_len. As many
structures as specified are placed in the order of operation history
record numbers. The length to be specified is the sum of the rec_len
values of these structures.
The function returns the size of data actually read, so a little bit longer size may
be specified.
- 637 -
3.Function References PROGRAMMING B-64303EN-3/01
Signal
struct odbophis4 0┌───────────┐ ─
│ rec_len = 20 │ ↑
2├───────────┤ │
│ rec_type │ │
4├───────────┤ │
│ sig_name │ │
6├───────────┤ │
│ sig_no │ │
8├─────┬─────┘ │
│ sig_old │ │
9├─────┤ rec_len
│ sig_new │ │
10├─────┴─────┐ │
│ pmc_no │ │
12├───────────┤ │
│ hour │ │
14├───────────┤ │
│ minute │ │
16├───────────┤ │
│ second │ │
18├───────────┤ │
│ dummy │ ↓
20└───────────┘ ─
- 638 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Alarm
struct odbophis4 0┌───────────┐ ─
│ rec_len = 24 │ ↑
2├───────────┤ │
│ rec_type │ │
4├───────────┤ │
│ alm_grp │ │
6├───────────┤ │
│ alm_no │ │
8├───────────┤ │
│ axis_no │ │
10├───────────┤ │
│ year │ │
12├───────────┤rec_len
│ month │ │
14├───────────┤ │
│ day │ │
16├───────────┤ │
│ hour │ │
18├───────────┤ │
│ minute │ │
20├───────────┤ │
│ second │ │
22├───────────┤ │
│ pth_no │ ↓
24└───────────┘ ─
Date and time
struct odbophis4 0┌───────────┐ ─
│ rec_len = 20 │ ↑
2├───────────┤ │
│ rec_type │ │
4├───────────┤ │
│ evnt_type │ │
6├───────────┤ │
│ year │ │
8├───────────┤ │
│ month │rec_len
10├───────────┤ │
│ day │ │
12├───────────┤ │
│ hour │ │
14├───────────┤ │
│ minute │ │
16├───────────┤ │
│ second │ │
18├───────────┤ │
│ dummy │ ↓
20└───────────┘ ─
- 639 -
3.Function References PROGRAMMING B-64303EN-3/01
- 640 -
B-64303EN-3/01 PROGRAMMING 3.Function References
~ ~ │
79├─────┤ │
│ g_dp[9] │ │
80├─────┴─────┐ │
│ │ │
│ a_modal[0] │ │
│ │ │
84├───────────┤ │
~ ~ │
116├───────────┤ │
│ │ │
│ a_modal[9] │ │
│ │ │
120├─────┬─────┘ │
│ a_dp[0] │ │
121├─────┤ │
~ ~ │
129├─────┤ │
│ a_dp[9] │ │
130├─────┴─────┐ │
│ │ │
│ abs_pos[0] │ │
│ │ │
134├───────────┤ │
~ ~ │
254├───────────┤ │
│ │ │
│ abs_pos[31] │ │
│ │ │
258├─────┬─────┘ │
│abs_dp[0] │ │
259├─────┤ │
~ ~ │
289├─────┤ │
│abs_dp[31]│ │
290├─────┴─────┐ │
│ │ │
│ mcn_pos[0] │ │
│ │ │
294├───────────┤ │
~ ~ │
- 641 -
3.Function References PROGRAMMING B-64303EN-3/01
~ ~ │
414├───────────┤ │
│ │ │
│ mcn_pos[31] │ │
│ │ │
418├──────┬────┘ │
│mcn_dp[0] │ │
419├──────┤ │
~ ~ │
449├──────┤ │
│mcn_dp[31] │ ↓
450└──────┘ ─
Alarm with a message with additional information
struct odbophis4 0┌───────────┐ ─
│ rec_len =514 │ ↑
2├───────────┤ │
│ rec_type │ │
4├───────────┤ │
│ alm_grp │ │
6├───────────┤ │
│ alm_no │ │
8├───────────┤ │
│ axis_no │ │
10├───────────┤ │
│ year │ │
12├───────────┤ │
│ month │ │
14├───────────┤ │
│ day │ │
16├───────────┤ │
│ hour │ │
18├───────────┤ │
│ minute │ │
20├───────────┤ │
│ second │ │
22├───────────┤ │
│ pth_no │ │
24├───────────┤ │
│ dammy │ │
26├───────────┤ │
│ dsp_flg │ │
28├───────────┤ │
│ axis_num │ │
30├──────┬────┘ │
│alm_msg[0] │ │
31├──────┤ │
~ ~ │
- 642 -
B-64303EN-3/01 PROGRAMMING 3.Function References
~ ~ │
93├──────┤ │
│alm_msg[63] │ │
94├──────┴────┐ │
│ │ │
│ g_modal[0] │ │
│ │ │
98├───────────┤ │
~ ~ │
130├───────────┤ │
│ │ │
│ g_modal[9] │ │
│ │rec_len
134├─────┬─────┘ │
│ g_dp[0] │ │
135├─────┤ │
~ ~ │
143├─────┤ │
│ g_dp[9] │ │
144├─────┴─────┐ │
│ │ │
│ a_modal[0] │ │
│ │ │
148├───────────┤ │
~ ~ │
180├───────────┤ │
│ │ │
│ a_modal[9] │ │
│ │ │
184├─────┬─────┘ │
│ a_dp[0] │ │
185├─────┤ │
~ ~ │
193├─────┤ │
│ a_dp[9] │ │
194├─────┴─────┐ │
│ │ │
│ abs_pos[0] │ │
│ │ │
198├───────────┤ │
~ ~ │
- 643 -
3.Function References PROGRAMMING B-64303EN-3/01
~ ~ │
318├───────────┤ │
│ │ │
│ abs_pos[31] │ │
│ │ │
322├─────┬─────┘ │
│abs_dp[0] │ │
323├─────┤ │
~ ~ │
353├─────┤ │
│abs_dp[31]│ │
354├─────┴─────┐ │
│ │ │
│ mcn_pos[0] │ │
│ │ │
358├───────────┤ │
~ ~ │
478├───────────┤ │
│ │ │
│ mcn_pos[31] │ │
│ │ │
482├──────┬────┘ │
│mcn_dp[0] │ │
483├──────┤ │
~ ~ │
513├──────┤ │
│mcn_dp[31] │ ↓
514└──────┘ ─
- 644 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 645 -
3.Function References PROGRAMMING B-64303EN-3/01
- 646 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Change of a parameter
struct odbophis4 0┌───────────┐ ─
│ rec_len = 32 │ ↑
2├───────────┤ │
│ rec_type │ │
4├───────────┤ │
│ prm_grp │ │
6├───────────┤ │
│ prm_num │ │
8├───────────┤ │
│ hour │ │
10├───────────┤ │
│ minute │ │
12├───────────┤rec_len
│ second │ │
14├───────────┤ │
│ prm_len │ │
16├───────────┤ │
│ │ │
│ prm_no │ │
│ │ │
20├───────────┤ │
│ │ │
│ prm_old │ │
│ │ │
24├───────────┤ │
│ │ │
│ prm_new │ │
│ │ │
28├───────────┤ │
│ old_dp │ │
30├───────────┤ │
│ new_dp │ ↓
32└───────────┘ ─
- 647 -
3.Function References PROGRAMMING B-64303EN-3/01
- 648 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 649 -
3.Function References PROGRAMMING B-64303EN-3/01
0x 1x 2x 3x 4x 5x 6x 7x
x0 SP 0 @ P
x1 1 A Q
x2 2 B R
x3 # 3 C S
x4 4 D T
x5 5 E U
x6 & 6 F V
x7 7 G W
x8 CAN ( 8 H X
x9 ) 9 I Y
xA EOB * J Z
xB + K [
xC , L
xD INPUT - M ]
xE . N
xF / ? O
8x 9x Ax Bx Cx Dx Ex Fx
x0 RESET F0
x1 F1
x2 F2
x3 F3
x4 INSERT F4
x5 DELETE F5
x6 ALTER F6
x7 F7
x8 Curs→ POS F8
x9 Curs← PROG F9
xA Curs↓ HELP OFS/SET
xB Curs↑ SYSTEM
xC MESSAGE
Xd GRAPH
xE Page↓ CUSTOM1 FR
xF Page↑ CUSTOM2 FL
・ How to use this table: To know the key code of 'A' for example, "4x" is combined
with "x1" to form "41" (in hexadecimal).
- 650 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 651 -
3.Function References PROGRAMMING B-64303EN-3/01
- 652 -
B-64303EN-3/01 PROGRAMMING 3.Function References
7 6 5 4 3 2 1 0
┌─┬─┬─┬─┬─┬─┬─┬─┐
| Number of decimal positions |
└─┴─┴─┴─┴─┴─┴─┴─┘
#7 : 0 : Not specified in a specified block.
1 : Specified in a specified block.
a_modal[0],a_dp[0]=Auxiliary function code
a_modal[1],a_dp[1]=D code
a_modal[2],a_dp[2]=E code
a_modal[3],a_dp[3]=F code
a_modal[4],a_dp[2]=H code
a_modal[5],a_dp[3]=M code
a_modal[6],a_dp[2]=N code
a_modal[7],a_dp[3]=O code
a_modal[8],a_dp[2]=S code
a_modal[9],a_dp[3]=T code
* When 'O' (program name) is specified, the first five
characters are set.
(Example) O123 TEST_PROGRAM
a_modal ┌──┐ ┌──┐
│'O' │ │'T' │
├──┤ ├──┤
│'1' │ │'E' │
├──┤ ├──┤
│'2' │ │'S' │
├──┤ ├──┤
│'3' │ │'T' │
a_dp ├──┤ ├──┤
│ 0 │ │'_' │
└──┘ └──┘
abs_pos Absolute coordinate value when an alarm was issued.
abs_dp Number of decimal positions of an absolute coordinate value when an
alarm was issued.
mcn_pos Machine coordinate value when an alarm was issued.
cn_dp Number of decimal positions of a machine coordinate value when an
alarm was issued.
* An undefined value is set in areas beyond the number of axes.
alm_msg Alarm message.
dsp_flg Flag for message display.
1 : For a macro alarm, MCxxxx is indicated.
For an external alarm or external operator's message,
EXxxxx is indicated.
0 : Messages are displayed without modification.
om_no Message number.
ope_msg Message (a NULL character (\0) is set at the end.)
- 653 -
3.Function References PROGRAMMING B-64303EN-3/01
- 654 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 655 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) Function is not executed.
History data sampling is not stopped (by using the cnc_stopophis
function).
EW_LENGTH( 2) Error in the data block length.
The size (length) of the operation history data storage area is invalid.
EW_NUMBER( 3) Data number error.
The starting data number (s_no) or ending data number (e_no) is invalid.
[Description]
Reads operation history data.
When reading operation history data, use this function or the CNC_rdophistry3 function
instead of the cnc_rdophistry function.
The cnc_rdophistry3 function differs from the cnc_rdophistry4 function in data type.
For details, see the descriptions of these functions.
The structure of operation history data to be read varies depending on the type of the
operation history data.
The CNC automatically records operation history data, alarm history data, and external
operator's message history data.
Before these types of data can be accessed, sampling performed by the CNC must be stopped
temporarily. Therefore, before using this function, stop history data sampling
(cnc_stopophis function).
As soon as the read operation is completed, resume history data sampling (cnc_startophis
function) to minimize the period during which history data sampling is stopped.
Record numbers such as the starting and ending record numbers are assigned to individual
records of operation history data to be read. These record numbers stay valid during
the time from the stop of history data sampling until history data sampling is resumed.
- 656 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 657 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.139 Clear history data. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_clearophis
[Syntax]
#include <fwindow.h>
short cnc_clearophis( short slct );
[Arguments]
slct Specify the type of history data to be cleared.
0 : Operation history data and external operator history data
1 : Alarm history data
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_ATTRIB( 4) Data attribute error.
The specified history data type (slct) is invalid.
EW_PARAM( 9) CNC parameter error.
Set bit 7 (EKE) of parameter No. 3195 to "1".
[Description]
Data is cleared according to the slct argument as follows:
0 : Operation history data and external operator history data
1 : Alarm history data
- 658 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.140 Read signal to be included in operation history (3). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdhissgnl3
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdhissgnl3( struct iodbsig3 * sig );
struct iodbsig3 {
short datano; /* Not used. */
short type; /* Not used. */
struct {
short ent_no; /* Entry number.*/
short pmc_no; /* PMC number. */
short sig_no; /* Signal number. */
char sig_name; /* Signal name. */
char mask_pat; /* Signal mask pattern. */
} data[60];
} ;
[Arguments]
sig Pointer to a structure to which a signal to be included in operation
history is returned.
ent_no Entry number ("1" to "60").
pmc_no PMC number ("1" to "3").
sig_no Number of a registered signal.
X : "0" to "127"
G : "0" to "767"
Y : "0" to "127"
F : "0" to "767"
sig_name Name of a registered signal.
0 : Not registered
1 : "X"
2 : "G"
3 : "Y"
4 : "F"
mask_pat Signal mask pattern.
[Return]
Main return value is as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
- 659 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads a signal to be included in the operation history.
When reading signals to be included in the operation history, use this function instead
of the cnc_rdhissgnl function.
- 660 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.141 Set signal to be included in operation history (3). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrhissgnl3
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrhissgnl3( struct iodbsig3 * sig);
struct iodbsig3 {
short datano; /* Not used. */
short type; /* Number of signals. */
struct {
short ent_no; /* Registration entry number. */
short pmc_no; /* PMC number. */
short sig_no; /* Signal number. */
char sig_name; /* Signal name. */
char mask_pat; /* Signal mask pattern. */
} data[60];
} ;
[Arguments]
sig Pointer to the structure for setting signals to be included in the
operation history.
ent_no Registration entry number ("1" to "60").
pmc_no PMC number ("1" to "3").
sig_no Number of a signal to be registered.
X: "0" to "127"
G: "0" to "767"
Y: "0" to "127"
F: "0" to "767"
sig_name Name of the signal to be registered.
0: Not registered.
1: "X"
2: "G"
3: "Y"
4: "F"
mask_pat Signal mask pattern.
- 661 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_ATTRIB(4) Data attribute error.
The specified number of signals to be registered (type) is invalid.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function. One of the following detail status codes is
set in member err_no in structure odberr:
1: Registration number (ent_no) error
2: Signal number (sig_no) error
This code is also set when the same signal name or number
is specified more than once.
3: Signal name (sig_name) error
4: PMC number (pmc_no) error
A nonexistent PMC number is specified.
[Description]
Sets signals to be included in the operation history.
To set signals to be included in the operation history, use this function, not the
cnc_wrhissgnl function.
- 662 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.142 Read the number of alarm history data items (3). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdalmhisno3
[Syntax]
#include <fwindow.h>
short cnc_rdalmhisno3( unsigned short * hisno );
[Arguments]
hisno Specify the address of the variable for which to store the number of
alarm history data items.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_FUNC(1) Function is not executed.
History data sampling is not stopped (the cnc_stopophis function is not
executed).
[Description]
Reads the number of alarm history data items.
This is a dedicated function for reading alarm history data using the cnc_rdalmhistry4
function.
Before using this function, stop history data sampling (execute the cnc_stopophis
function).
- 663 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.143 Read alarm history data (5). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdalmhistry5
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdalmhistry5( unsigned short s_no,unsigned short e_no,
unsigned short length, struct odbahis5 *his);
struct odbahis5 {
unsigned short s_no; /* Start record number. */
unsigned short e_no; /* End record number. */
struct {
short alm_grp; /* Kind of alarm. */
short alm_no; /* Alarm number. */
short axis_no; /* Absolute axis number or absolute */
/* spindle number (1 to the maximum */
/* controlled axis number). */
short year; /* Year. */
short month; /* Month. */
short day; /* Day. */
short hour; /* Hours. */
short minute; /* Minutes. */
short second; /* Seconds. */
short len_msg; /* Number of characters in an alarm message */
/* (0-63). */
short pth_no; /* Path number. */
short dammy; /* Not used. */
short dsp_flg; /* Message display flag. */
short axis_num; /* Total number of axes. */
char alm_msg[64]; /* Alarm message. */
long g_modal[10]; /* Modal G code */
char g_dp[10]; /* When #7 is set to 1, the code is */
/* specified with the specified block. */
/* #6 to #0: Number of digits after the */
/* decimal point. */
long a_modal[10]; /* Modal B, D, E, F, H, M, N, O, S, or T */
/* code */
char a_dp[10]; /* When #7 is set to 1, the code is */
/* specified with the specified block. */
/* #6 to #0: Number of digits after the */
/* decimal point. */
long abs_pos[32]; /* Absolute coordinates when the alarm */
/* is issued. */
- 664 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Arguments]
s_no Specifies the start record number. (Specify "1" or greater.)
e_no Specifies the end record number. (Specify "1" or greater.)
length Specifies the data block length (structure size).
alm_his 0┌─────────────┐
│ alm_grp │
2├─────────────┤
│ alm_no │
4├─────────────┤
│ axis_no │
6├─────────────┤
│ year │
8├─────────────┤
│ month │
10├─────────────┤
│ day │
12├─────────────┤
│ hour │
14├─────────────┤
│ minute │
~ ~
- 665 -
3.Function References PROGRAMMING B-64303EN-3/01
~ ~
16├─────────────┤
│ second │
18├─────────────┤
│ len_msg │
20├─────────────┤
│ pth_no │
22├─────────────┤
│ dammy │
24├─────────────┤
│ dsp_flg │
26├─────────────┤
│ axis_num │
28├──────┬──────┘
│alm_msg[0] │
29├──────┤
~ ~
91├──────┤
│alm_msg[63] │
92├──────┴──────┐
│ │
│ g_modal[0] │
│ │
96├─────────────┤
~ ~
128├─────────────┤
│ │
│ g_modal[9] │
│ │
132├─────┬───────┘
│ g_dp[0] │
133├─────┤
~ ~
141├─────┤
│ g_dp[9] │
142├─────┴───────┐
│ │
│ a_modal[0] │
│ │
146├─────────────┤
~ ~
- 666 -
B-64303EN-3/01 PROGRAMMING 3.Function References
~ ~
178├─────────────┤
│ │
│ a_modal[9] │
│ │
182├─────┬───────┘
│ a_dp[0] │
183├─────┤
~ ~
191├─────┤
│ a_dp[9] │
192├─────┴───────┐
│ │
│ abs_pos[0] │
│ │
196├─────────────┤
~ ~
316├─────────────┤
│ │
│ abs_pos[31] │
│ │
320├─────┬───────┘
│abs_dp[0] │
321├─────┤
~ ~
351├─────┤
│abs_dp[31]│
352├─────┴───────┐
│ │
│ mcn_pos[0] │
│ │
356├─────────────┤
~ ~
476├─────────────┤
│ │
│ mcn_pos[31] │
│ │
480├──────┬──────┘
│mcn_dp[0] │
481├──────┤
~ ~
511├──────┤
│mcn_dp[31] │
512└──────┘
- 667 -
3.Function References PROGRAMMING B-64303EN-3/01
axis_no An absolute axis number ("1" to the maximum controlled axis number)
or absolute spindle number ("1" to the number of spindles) is set.
("0" is set for an alarm which is not relevant to an axis or spindle.)
- 668 -
B-64303EN-3/01 PROGRAMMING 3.Function References
7 6 5 4 3 2 1 0
┌─┬─┬─┬─┬─┬─┬─┬─┐
| | Number of digits after the decimal point |
└─┴─┴─┴─┴─┴─┴─┴─┘
7 6 5 4 3 2 1 0
┌─┬─┬─┬─┬─┬─┬─┬─┐
| | Number of digits after the decimal point |
└─┴─┴─┴─┴─┴─┴─┴─┘
- 669 -
3.Function References PROGRAMMING B-64303EN-3/01
* When "0" (program name) is indicated, the first 5 characters are stored,
however.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_FUNC(1) Function is not executed.
History data sampling is not stopped (the cnc_stopophis function is not
executed).
EW_LENGTH(2) Error in the data block length.
The structure size (length) is invalid. The length value meets the
following condition:
(e_no-s_no+1) × sizeof(data[0]) + 4 > length
EW_NUMBER(3) Data number error.
The start record number (s_no) or end record number (e_no) is invalid.
- 670 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads alarm history data.
To read alarm history data, use this function, or cnc_rdalmhistry4 function, not the
cnc_rdalmhistry function.
For the differences among these functions, see the description of each of these functions.
Operation history data, alarm history data, and external operator’s message history data
are automatically recorded by the CNC.
To access these data items, data sampling by the CNC must be stopped temporarily. To
stop data sampling, before using this function, execute "stop history data sampling"
(cnc_stopophis function).
To minimize the history data sampling stop time, execute "resume history data sampling"
(cnc_startophis function) immediately after history data has been read.
The start/end record number is the number assigned to each alarm history data record
to be read. These record numbers are effective after "stop history data sampling" is
executed until "resume history data sampling" is executed.
- 671 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.144 Read the number of external operator’s message history data items. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdomhisno
[Syntax]
#include <fwindow.h>
short cnc_rdomhisno( unsigned short * hisno );
[Arguments]
hisno Specifies the address of the variable for which to store the number of
external operator’s message history data items.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_FUNC(1) Function is not executed.
History data sampling is not stopped (the cnc_stopophis function is not
executed).
EW_PARAM(9) CNC parameter error.
Set bit 6 (HOM) of parameter No. 3196 to "0" and bit 2 (OMH) of parameter
No. 3112 to "1".
[Description]
Reads the number of external operator’s message alarm data items.
Before using this function, stop history data sampling (execute the cnc_stopophis
function).
- 672 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.145 Read external operator’s message history data (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdomhistry2
[Syntax]
#include <fwindow.h>
short cnc_rdomhistry2( unsigned short s_no,unsigned short e_no,
unsigned short length, struct odbmhis2 *his);
struct odbmhis2 {
unsigned short s_no; /* Start record number. */
unsigned short e_no; /* End record number. */
struct {
short dsp_flg; /* Message display flag. */
short om_no; /* Message number. */
short year; /* Year. */
short month; /* Month. */
short day; /* Day. */
short hour; /* Hours. */
short minute; /* Minutes. */
short second; /* Seconds. */
char ope_msg[256];/* Message (ends with null (\0)). */
} opm_his[N]; /* N: Number of external operator’s message */
/* history data items to be read. */
} ;
[Arguments]
s_no Specifies the start record number. (Specify "1" or greater.)
e_no Specifies the end record number. (Specify "1" or greater.)
length Specifies the data block length (structure size).
- 673 -
3.Function References PROGRAMMING B-64303EN-3/01
opm_his 0┌─────────────┐
│ dsp_flg │
2├─────────────┤
│ om_no │
4├─────────────┤
│ year │
6├─────────────┤
│ month │
8├─────────────┤
│ day │
10├─────────────┤
│ hour │
12├─────────────┤
│ minute │
16├─────────────┤
│ second │
18├──────┬──────┘
│ ope_msg[0] │
19├──────┤
~ ~
273├──────┤
│ope_msg[255]│
274└──────┘
- 674 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_FUNC(1) Function is not executed.
History data sampling is not stopped (the cnc_stopophis function is not
executed).
EW_LENGTH(2) Error in the data block length.
The structure size (length) is invalid. The length value meets the
following condition:
(e_no-s_no+1) × sizeof(data[0]) + 4 > length
EW_NUMBER(3) Data number error.
The start record number (s_no) or end record number (e_no) is invalid.
EW_PARAM(9) CNC parameter error.
Set bit 2 (OMH) of parameter No. 3112 to "1".
[Description]
Reads external operator’s message history data.
The unit of one external operator’s message history data item is called a record.
Operation history data, alarm history data, and external operator’s message history data
are automatically recorded by the CNC.
To access these data items, data sampling by the CNC must be stopped temporarily. To
stop data sampling, before using this function, execute "stop history data sampling"
(cnc_stopophis function).
To minimize the history data sampling stop time, execute "resume history data sampling"
(cnc_startophis function) immediately after history data has been read.
The start/end record number is the number assigned to each external operator’s message
history data record to be read. These record numbers are effective after "stop history
data sampling" is executed until "resume history data sampling" is executed.
- 675 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.146 Read tool life management data (tool group number). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdgrpid
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdgrpid( short number, struct odbtlife1 *grpid);
struct odbtlife1 {
short dummy ; /* Not used. */
short type ; /* Tool number. */
long data ; /* Tool group number. */
} ;
[Arguments]
number Specifies a tool number.
grpid Pointer to structure odbtlife1 to which to return the tool group number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_ATTRIB(4) Data attribute error.
The specified tool number (number) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the number of the tool group in which the specified tool is registered.
When the tool number is found in multiple tool groups, the smallest group number is stored.
This function is available only when you use an up to 4-digit tool number.
If you use a tool number longer than 4 digits, you must use the cnc_rdgrpid2 function.
The number of the tool group in which the specified tool number is registered is stored
in grpid.data with binary format. When "0" is specified for number, the number of the
tool group being currently used is stored. When no tool group number has been specified
since power-on, however, "0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
- 676 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 677 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.147 Read tool life management data (number of tool groups). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdngrp
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdngrp( struct odbtlife2 *ngrp);
struct odbtlife2 {
short dummy[2] ; /* Not used. */
long data ; /* Number of tool groups. */
} ;
[Arguments]
ngrp Pointer to structure odbtlife2 to which to return the number of tool
groups.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the total number of tool groups in which tools are registered.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
- 678 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.148 Read tool life management data (number of tools). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdntool
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdntool( short number, struct odbtlife3 *ntool);
struct odbtlife3 {
short datano ; /* Tool group number. */
short dummy ; /* Not used. */
long data ; /* Number of tools. */
} ;
[Arguments]
number Specifies a tool group number.
ntool Pointer to structure odbtlife3 to which to return the number of tools.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (number) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the number of tools registered in the specified tool group.
The number of tools registered in the specified tool group is stored in ntool.data with
binary format. When "0" is specified for number, the number of tools in the tool group
being currently used is stored. When no tool group number has been specified since
power-on, however, "0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
- 679 -
3.Function References PROGRAMMING B-64303EN-3/01
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 680 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.149 Read tool life management data (tool life). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdlife
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdlife( short number,struct odbtlife3 *life);
struct odbtlife3 {
short datano ; /* Tool group number. */
short dummy ; /* Not used. */
long data ; /* Tool life value. */
} ;
[Arguments]
number Specifies a tool group number with binary format.
life Pointer to structure odbtlife3 to which to return the tool life value.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (number) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the tool life value of the specified tool group.
The tool life value of the specified tool group is stored in life.data with binary format.
When "0" is specified for number, the tool life value of the tool group being currently
used is stored. When no tool group number has been specified since power-on, however,
"0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
- 681 -
3.Function References PROGRAMMING B-64303EN-3/01
- 682 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.150 Read tool life management data (tool life counter). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdcount
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdcount( short number, struct odbtlife3 *count);
struct odbtlife3 {
short datano ; /* Tool group number. */
short dummy ; /* Not used. */
long data ; /* Tool life counter value. */
} ;
[Arguments]
number Specifies a tool group number with binary format.
count Pointer to structure odbtlife3 to which to return the tool life counter
value.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (number) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the tool life counter value of the specified tool group.
The tool life counter value of the specified tool group is stored in count.data with
binary format. When "0" is specified for number, the tool life counter value of the tool
group being currently used is stored. When no tool group number has been specified since
power-on, however, "0" is stored.
- 683 -
3.Function References PROGRAMMING B-64303EN-3/01
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
- 684 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.151 Read tool life management data (tool length compensation number 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rd1length
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rd1length( short grp_num, short tool_num,
struct odbtlife4 *tl_len1);
struct odbtlife4 {
short datano ; /* Tool group number. */
short type ; /* Tool number. */
long data ; /* Tool length compensation number (always 0 for */
/* the lathe system (T series)). */
} ;
[Arguments]
grp_num Specifies a tool group number with binary format.
tool_num Specifies a tool number with binary format.
tl_len1 Pointer to structure odbtlife4 to which to return the tool length
compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (tool_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 685 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the tool length compensation number for the specified tool group and tool numbers.
This function is effective only for the machining system. For the lathe system (T series),
"0" is always read.
This function is available only when you use an up to 4-digit tool number.
If you use a tool number longer than 4 digits, you must use the cnc_rd1tlifedat2 function.
The tool length compensation number of the specified tool is stored in tl_len1.data with
binary format. When "0" is specified for grp_num or tool_num, the tool group or tool
being currently used is referenced, respectively. When no tool group number has been
specified since power-on, however, "0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 686 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.152 Read tool life management data (tool length compensation number 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rd2length
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rd2length( short grp_num, short tuse_num,
struct odbtlife4 *tl_len2 );
struct odbtlife4 {
short datano ; /* Tool group number. */
short type ; /* Tool ordinal number. */
long data ; /* Tool length compensation number (always 0 for */
/* the lathe system (T series)). */
} ;
[Arguments]
grp_num Specifies a tool group number with binary format.
tuse_num Specifies a tool ordinal number with binary format.
tl_len2 Pointer to structure odbtlife4 to which to return the tool length
compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (tuse_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 687 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the tool length compensation number for the specified tool group and tool ordinal
numbers.
This function is effective only for the machining system. For the lathe system (T series),
"0" is always read.
The tool length compensation number of the specified tool is stored in tl_len2.data with
binary format.
When "0" is specified for grp_num, the tool group being currently used is referenced.
When no tool group number has been specified since power-on, however, "0" is stored.
When "0" is specified for tuse_num, the tool being currently used is referenced for the
number of a tool group already used or the first tool is referenced for the number of
a tool group which has not yet been used.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 688 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.153 Read tool life management data (tool radius compensation number 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rd1radius
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rd1radius( short grp_num, short tool_num,
struct odbtlife4 *radius1);
struct odbtlife4 {
short datano ; /* Tool group number. */
short type ; /* Tool number. */
long data ; /* Tool radius compensation number (always a value */
/* of 0 is read for the lathe system (T series)). */
} ;
[Arguments]
grp_num Specifies a tool group number with binary format.
tool_num Specifies a tool number with binary format.
radius1 Pointer to structure odbtlife4 to which to return the tool radius
compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (tool_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the tool radius compensation number for the specified tool group and tool numbers.
This function is effective only for the machining system. For the lathe system (T series),
"0" is always read.
This function is available only when you use an up to 4-digit tool number.
If you use a tool number longer than 4 digits, you must use the cnc_rd1tlifedat2 function.
The tool radius compensation number of the specified tool is stored in radius1.data with
binary format. When "0" is specified for grp_num or tool_num, the tool group or tool
being currently used is referenced, respectively. When no tool group number has been
specified since power-on, however, "0" is stored.
- 689 -
3.Function References PROGRAMMING B-64303EN-3/01
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 690 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.154 Read tool life management data (tool radius compensation number 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rd2radius
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rd2radius( short grp_num, short tuse_num,
struct odbtlife4 *radius2);
struct odbtlife4 {
short datano ; /* Tool group number. */
short type ; /* Tool ordinal number. */
long data ; /* Tool radius compensation number (always a value */
/* of 0 is read for the lathe system (T series)). */
} ;
[Arguments]
grp_num Specifies a tool group number with binary format.
tuse_num Specifies a tool ordinal number with binary format.
radius2 Pointer to structure odbtlife4 to which to return the tool radius
compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (tuse_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 691 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the tool radius compensation number for the specified tool group and tool ordinal
numbers.
This function is effective only for the machining system. For the lathe system (T series),
"0" is always read.
The tool radius compensation number of the specified tool is stored in radius2.data with
binary format.
When "0" is specified for grp_num, the tool group being currently used is referenced.
When no tool group number has been specified since power-on, however, "0" is stored.
When "0" is specified for tuse_num, the tool being currently used is referenced for the
number of a tool group already used or the first tool is referenced for the number of
a tool group which has not yet been used.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 692 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.155 Read tool life management data (tool information 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_t1info
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_t1info( short grp_num, short tool_num,
struct odbtlife4 *tinfo1);
struct odbtlife4 {
short datano ; /* Tool group number. */
short type ; /* Tool number. */
long data ; /* Tool information. */
} ;
[Arguments]
grp_num Specifies a tool group number with binary format.
tool_num Specifies a tool number with binary format.
tinfo1 Pointer to structure odbtlife4 to which to return tool information.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (tool_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 693 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads tool information of the specified tool group and tool numbers.
This function is available only when you use an up to 4-digit tool number.
If you use a tool number longer than 4 digits, you must use the cnc_rd1tlifedat2 function.
Tool information of the specified tool is stored in tinfo1.data with binary format.
When "0" is specified for grp_num or tool_num, the tool group or tool being currently
used is referenced, respectively. When no tool group number has been specified since
power-on, however, "0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 694 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.156 Read tool life management data (tool information 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_t2info
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_t2info( short grp_num, short tuse_num,
struct odbtlife4 *tinfo2);
struct odbtlife4 {
short datano ; /* Tool group number. */
short type ; /* Tool ordinal number. */
long data ; /* Tool information. */
} ;
[Arguments]
grp_num Specifies a tool group number with binary format.
tuse_num Specifies a tool ordinal number with binary format.
tinfo2 Pointer to structure odbtlife4 to which to return tool information.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (tuse_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 695 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads tool information of the specified tool group and tool ordinal numbers.
Tool information of the specified tool is stored in tinfo2.data with binary format.
When "0" is specified for grp_num, the tool group being currently used is referenced.
When no tool group number has been specified since power-on, however, "0" is stored.
When "0" is specified for tuse_num, the tool being currently used is referenced for the
number of a tool group already used or the first tool is referenced for the number of
a tool group which has not yet been used.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 696 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.157 Read tool life management data (tool number). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_toolnum
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_toolnum( short grp_num, short tuse_num,
struct odbtlife4 *toolnum);
struct odbtlife4 {
short datano ; /* Tool group number. */
short type ; /* Tool ordinal number. */
long data ; /* Tool number. */
} ;
[Arguments]
grp_num Specifies a tool group number with binary format.
tuse_num Specifies a tool ordinal number with binary format.
toolnum Pointer to structure odbtlife4 to which to return the tool number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (tuse_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the tool number corresponding to the specified tool group and tool ordinal numbers.
The tool number of the relevant tool is stored in toolnum.data with binary format.
When "0" is specified for grp_num, the tool group being currently used is referenced.
When no tool group number has been specified since power-on, however, "0" is stored.
When "0" is specified for tuse_num, the tool being currently used is referenced for the
number of a tool group already used or the first tool is referenced for the number of
a tool group which has not yet been used.
- 697 -
3.Function References PROGRAMMING B-64303EN-3/01
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 698 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.158 Read tool life management data (number of tools, tool life, life counter) (range specified).
<Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtoolrng
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtoolrng( short s_number, short e_number, short length,
struct iodbtr *toolnum);
struct iodbtr {
short datano_s ; /* Read start group number. */
short dummy ; /* Not used. */
short datano_e ; /* Read end group number. */
struct {
long ntool ; /* Number of tools. */
long life ; /* Tool life value. */
long count ; /* Tool life counter value. */
} data[N] ;
} ; /* N: Number of groups of which data is to be read. */
[Arguments]
s_number Specifies the read start tool group number with binary format.
e_number Specifies the read end tool group number with binary format.
length Specifies the data block length (size of structure iodbtr).
iodbtr 0┌────┐ ─
│datano_s│ ↑
2├────┤ │
│dummy │ │
4├────┤ │
│datano_e│ │
6├────┤ │
│ │ length
8├────┴────┐ │
│ data[0] │ │
20├─────────┤ │
~ ~ │
8+12×(N-1) ├─────────┤ │
│ data[N-1] │ ↓
8+12×N └─────────┘ ─
- 699 -
3.Function References PROGRAMMING B-64303EN-3/01
data 0┌─────┐
│ ntool │
4├─────┤
│ life │
8├─────┤
│ count │
12└─────┘
toolnum Pointer to structure iodbtr to which to return the number of tools, tool
life value, and tool life counter value of each tool group number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The size (length) of structure iodbtr is invalid.
EW_NUMBER(3) Data number error.
The tool group number (s_number or e_number) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the number of tools, tool life value, and tool life counter value of each tool
group within the specified range.
The units of the tool life value and tool life counter value are [minutes] or [times].
Which unit is used depends on the setting of bit 2 (LTM) of parameter No. 6800 on the
CNC.
The number of tools, tool life value, and tool life counter value of each tool group
within the specified range are stored in toolnum.data[i].ntool, toolnum.data[i].life,
and toolnum.data[i].count with binary format, respectively.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 700 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.159 Read all tool life management data in group at once. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtoolgrp
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtoolgrp( short grp_num, short length,
struct odbtg *toolgrp);
struct odbtg {
short grp_num ; /* Tool group number. */
short dummy[2] ; /* Not used. */
long ntool ; /* Number of tools. */
long life ; /* Tool life. */
long count ; /* Tool life counter value. */
struct {
long tuse_num ; /* Tool ordinal number. */
long tool_num ; /* Tool number. */
long length_num ; /* Tool length compensation number. */
long radius_num ; /* Tool radius compensation number. */
long tinfo ; /* Tool information. */
} data[N] ;
} ; /* N: Number of tools registered. */
[Arguments]
grp_num Specifies a tool group number with binary format.
When "0" is specified, the tool group being currently used is
referenced.
length Specifies the data block length (size of structure odbtg).
odbtg 0┌────┐ ─
│grp_num │ ↑
2├────┤ │
│dummy[0]│ │
4├────┤ │
│dummy[1]│ │
6├────┤ │
│ │ │
8├────┴────┐ │
│ ntool │ │
12├─────────┤length
~ life ~ │
- 701 -
3.Function References PROGRAMMING B-64303EN-3/01
16├─────────┤ │
│ count │ │
20├─────────┤ │
│ data[0] │ │
40├─────────┤ │
~ ~ │
20+20×(N-1) ├─────────┤ │
│ data[N-1] │ ↓
20+20×N └─────────┘ ─
- 702 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The size (length) of structure odbtg is invalid.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads various tool information of the specified tool group at a time.
The units of the tool life value and tool life counter value are [minutes] or [times].
Which unit is used depends on the setting of bit 2 (LTM) of parameter No. 6800 on the
CNC.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 703 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.160 Write tool life management data (life counter) (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrcountr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrcountr( short length, struct idbwrc *wrcount);
struct idbwrc {
short datano_s ; /* Write start group number. */
short dummy ; /* Not used. */
short datano_e ; /* Write end group number. */
struct {
long dummy[2] ; /* Not used. */
long count ; /* Tool life counter value. */
} data[N] ;
} ; /* N: Number of groups of which the tool */
/* life counter value is to be written. */
[Arguments]
length Specifies the data block length (size of structure idbwrc).
idbwrc 0┌────┐ ─
│datano_s│ ↑
2├────┤ │
│ dummy │ │
4├────┤ │
│datano_e│ │
6├────┤ │
│ │ │
8├────┴────┐ │
│ │ │
│ data[0] │length
│ │ │
20├─────────┤ │
~ ~ │
8+12×(N-1) ├─────────┤ │
│ │ │
│ data[N-1] │ │
│ │ ↓
8+12×N └─────────┘ ─
- 704 -
B-64303EN-3/01 PROGRAMMING 3.Function References
data 0┌─────┐
│ dummy[0] │
4├─────┤
│ dummy[1] │
8├─────┤
│ count │
12└─────┘
N is the number of groups of which the tool life counter value is to be written.
wrcoun Pointer to structure idbwrc in which to set the tool life counter value.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The size (length) of structure idbwrc is invalid.
EW_NUMBER(3) Data number error.
The tool group number (datano_s or datano_e) is invalid.
EW_DATA(5) The tool life counter value is out of the limit.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Rewrites the tool life counter value of each tool group within the specified range.
The write start group number is stored in wrcount.datano_s with binary format.
The write end group number is stored in wrcount.datano_e with binary format.
The tool life counter value is stored wrcount.data[i].count with binary format.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 705 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.161 Register tool life management data (tool group). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrtoolgrp
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrtoolgrp( long toolno, struct idbitd *buf);
struct idbitd {
short datano; /* Tool group number. */
short type; /* Tool life counter type. */
long data; /* Tool life value. */
} ;
[Arguments]
toolno Specifies a tool number.
buf Pointer to structure idbitd in which to set tool data.
datano Specifies a tool group number.
type Specifies a tool life counter type.
data Specifies a tool life value.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (toolno) is invalid.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
3: Tool life counter type (type) error.
4: Tool life value (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
The number of the tool group containing invalid data is set in member
err_dtno in structure odberr.
- 706 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
- When the specified tool group number is not registered:
Registers a new tool group with the specified number and sets the tool number,
tool life value, and tool counter type.
- When the specified tool group number has already been registered:
Adds the specified tool number to the end of the specified tool group.
Does not change the tool life value or tool counter type.
The unit of the tool life value can be determined by getting the "tool life counter type"
(executing cnc_rdcnttype).
When the tool life counter type is set to the time specification, bit 1 (FGL) of parameter
No. 6805 can be used to set 1 or 0.1 minutes for the unit of the tool life value.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 707 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.182 Write tool life management data (tool life). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrlife
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrlife( struct idbitd *buf);
struct idbitd {
short datano; /* Tool group number. */
short type; /* Not used. */
long data; /* Tool life value. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set the tool life value.
datano Specifies a tool group number.
data Specifies a tool life value.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_DATA(5) Tool life value (data) error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
1: Tool life value (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
The number of the tool group containing invalid data is set in member
err_dtno in structure odberr.
- 708 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Writes a tool life value for the specified tool group.
The unit of the tool life value can be determined by getting the "tool life counter type"
(executing cnc_rdcnttype).
When the tool life counter type is set to the time specification, bit 1 (FGL) of parameter
No. 6805 can be used to set 1 or 0.1 minutes for the unit of the tool life value.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 709 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.163 Write tool life management data (life counter). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrcount
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrcount( struct idbitd *buf);
struct idbitd {
short datano; /* Tool group number. */
short type; /* Not used. */
long data; /* Tool life counter value. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set the tool life counter value.
datano Specifies a tool group number.
data Specifies a tool life counter value.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_DATA(5) Tool life counter value (data) error.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 710 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Rewrites the tool life counter value of the specified tool group.
The unit of the tool life value can be determined by getting the "tool life counter type"
(executing cnc_rdcnttype).
When the tool life counter type is set to the time specification, bit 1 (FGL) of parameter
No. 6805 can be used to set 1 or 0.1 minutes for the unit of the tool life value.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 711 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.164 Write tool life management data (life counter type). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrcnttype
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrcnttype( struct idbitd *buf);
struct idbitd {
short datano; /* Tool group number. */
short type; /* Not used. */
long data; /* Tool life counter type. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set the tool life counter type.
datano Specifies a tool group number.
data Specifies a tool life counter type.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_DATA(5) Tool life counter type (data) error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
3: Tool life counter type (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
The number of the tool group containing invalid data is set in member
err_dtno in structure odberr.
- 712 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Rewrites the tool life counter type of the specified tool group.
The value of the tool life counter type is either of the following:
0: Count
1: Time
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 713 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.165 Write tool life management data (tool length compensation number 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wr1length
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wr1length( struct idbitd *buf);
struct idbitd2 {
short datano; /* Tool group number. */
long type; /* Tool number. */
long data; /* Tool length compensation number. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set the tool length compensation
number.
datano Specifies a tool group number.
type Specifies a tool number.
data Specifies a tool length compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (type) is invalid.
EW_DATA(5) Tool life counter type (data) error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
2: Tool length compensation number (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
- 714 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets a tool length compensation number for the specified tool group and tool numbers.
This function is enabled only for the M series. If this function is executed in the
T series, EW_OK(0) is returned as the return value without data being written. @@2@@
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 715 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.166 Write tool life management data (tool length compensation number 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wr2length
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wr2length(struct idbitd *buf);
struct idbitd {
short datano; /* Tool group number. */
short type; /* Tool ordinal number. */
long data; /* Tool length compensation number. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set tool data.
datano Specifies a tool group number.
type Specifies a tool ordinal number.
data Specifies a tool length compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (type) is invalid.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
2: Tool length compensation number (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
- 716 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets a tool length compensation number for the specified tool group and tool ordinal
numbers.
This function is enabled only for the M series. If this function is executed in the
T series, EW_OK(0) is returned as the return value without data being written.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 717 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.167 Write tool life management data (tool radius compensation number 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wr1radius
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wr1radius( struct idbitd2 *buf);
struct idbitd2 {
short datano; /* Tool group number. */
long type; /* Tool number. */
long data; /* Tool radius compensation number. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set tool data.
datano Specifies a tool group number.
type Specifies a tool number.
data Specifies a tool radius compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (type) is invalid.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
3: Tool radius compensation number (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
- 718 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets a tool radius compensation number for the specified tool group and tool numbers.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 719 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.168 Write tool life management data (tool radius compensation number 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wr2radius
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wr2radius( struct idbitd *buf);
struct idbitd {
short datano; /* Tool group number. */
short type; /* Tool ordinal number. */
long data; /* Tool radius compensation number. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set tool data.
datano Specifies a tool group number.
type Specifies a tool ordinal number.
data Specifies a tool radius compensation number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (type) is invalid.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
3: Tool radius compensation number (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
- 720 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets a tool radius compensation number for the specified tool group and tool ordinal
numbers.
This function is enabled only for the M series. If this function is executed in the
T series, EW_OK(0) is returned as the return value without data being written.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 721 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.169 Write tool life management data (tool information 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrt1info
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrt1info( struct idbitd2 *buf );
struct idbitd2 {
short datano; /* Tool group number. */
long type; /* Tool number. */
long data; /* Tool information. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set tool data.
datano Specifies a tool group number.
type Specifies a tool number.
data Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (type) is invalid.
EW_DATA(5) Data error.
The specified tool information (data) is invalid.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
4: Tool information (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
- 722 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets tool information for the specified tool group and tool numbers.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 723 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.170 Write tool life management data (tool information 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrt2info
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrt2info( struct idbitd *buf );
struct idbitd {
short datano; /* Tool group number. */
short type; /* Tool ordinal number. */
long data; /* Tool information. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set tool data.
datano Specifies a tool group number.
type Specifies a tool ordinal number.
data Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (type) is invalid.
EW_DATA(5) Data error.
The specified tool information (data) is invalid.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
4: Tool information (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
- 724 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets tool information for the specified tool group and tool ordinal numbers.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 725 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.171 Write tool life management data (tool number). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrtoolnum
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrtoolnum( struct idbitd *buf );
struct idbitd {
short datano; /* Tool group number. */
short type; /* Tool ordinal number. */
long data; /* Tool number. */
} ;
[Arguments]
buf Pointer to structure idbitd in which to set tool data.
datano Specifies a tool group number.
type Specifies a tool ordinal number.
data Specifies a tool number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (type) is invalid.
EW_DATA(5) Data error.
The specified tool information (data) is invalid.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
0: Error other than EW_DATA.
1: Tool number (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be
changed.)
- 726 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Changes the tool number for the specified tool group and tool ordinal numbers.
When the current maximum ordinal number + 1 is specified as the tool ordinal number,
a new tool is added.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 727 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.172 Read tool life management data (tool life counter type). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdcnttype
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdcnttype( short number, struct odbtlife3 *ntool);
struct odbtlife3 {
short datano ; /* Tool group number. */
short dummy ; /* Not used. */
long data ; /* Tool life counter type. */
} ;
[Arguments]
number Specifies a tool group number.
ntool Pointer to structure odbtlife3 to which to return the tool life counter
type.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (number) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the tool life counter type registered for the specified tool group.
(0: Count 1: Time)
The tool life counter type registered for the specified tool group is stored in ntool.data
with binary format. When "0" is specified for number, the tool life counter type
registered for the tool group being currently used is stored. When no tool group number
has been specified since power-on, however, "0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
- 728 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 729 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.173 Read tool life management data (number of tool group being used or to be used). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdusegrpid
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdusegrpid( struct odbusegr *usegrpid );
struct odbusegr {
short datano; /* Not used. */
short type; /* Not used. */
long next; /* Number of the next tool group to be used. */
long use; /* Number of the tool group being used. */
long slct; /* Number of the tool group being selected. */
} ;
[Arguments]
usegrpid Pointer to structure odbusegr to which to return the target tool group
numbers.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the number of the next tool group to be used, number of the tool group being used,
and number of the tool group being selected.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 730 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.174 Read tool life management data (maximum number of tool groups that can be registered).
<Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmaxgrp
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdmaxgrp( struct odblfno *maxgrp );
struct odblfno {
short datano; /* Not used. */
short type; /* Not used. */
short data; /* Maximum number of tool groups that can be */
/* registered. */
} ;
[Arguments]
maxgrp Pointer to structure odblfno to which to return the maximum number of
tool groups that can be registered.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the maximum number of tool groups that can be registered.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 731 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.175 Read tool life management data (maximum number of tools that can be registered in group).
<Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmaxtool
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdmaxtool( struct odblfno *maxtool );
struct odblfno {
short datano; /* Not used. */
short type; /* Not used. */
short data; /* Maximum number of tools that can be registered */
/* in a group.*/
} ;
[Arguments]
maxtool Pointer to structure odblfno to which to return the maximum number of
tools that can be registered in a group.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the maximum number of tools that can be registered in a group.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 732 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.176 Read tool life management data (ordinal number of tool to be used in group). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdusetlno
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdusetlno( short s_grp, short e_grp, short length,
struct odbtluse *usetlno);
struct odbtluse {
short s_grp; /* Read start tool group number. */
short dummy; /* Not used. */
short e_grp; /* Read end tool group number. */
long data[N]; /* Ordinal number of a tool to be used in each */
/* group. */
}; /* N: Number of groups of which the tool */
/* ordinal number is to be read. */
[Arguments]
s_grp Specifies the read start tool group number with binary format.
e_grp Specifies the read end tool group number with binary format.
length Specifies the data block length (size of structure odbtluse).
odbtluse 0┌────┐ ─
│ s_grp │ ↑
2├────┤ │
│ dummy │ │
4├────┤ │
│ e_grp │ │
6├────┤ │
│ │ │
8├────┴────┐length
│ data[0] │ │
12├─────────┤ │
~ ~ │
8+4×(N-1) ├─────────┤ │
│ data[N] │ ↓
8+4×N └─────────┘ ─
- 733 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The size (length) of structure odbtluse is invalid.
EW_NUMBER(3) Data number error.
The tool group number (s_grp or e_grp) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the ordinal number of a tool to be used in each group.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 734 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.177 Read tool life management data (tool data 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rd1tlifedata
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rd1tlifedata( short grp_no, short tool_no,
struct iodbtd *tld1);
struct iodbtd {
short datano; /* Tool group number. */
short type; /* Not used. */
long tool_num; /* Tool number. */
long h_code; /* Tool length compensation number. */
long d_code; /* Tool radius compensation number. */
long tool_inf; /* Tool information. */
} ;
[Arguments]
grp_no Specifies a tool group number.
tool_no Specifies a tool number.
tld1 Pointer to structure iodbtd to which to return various tool information.
The following information items are stored in tld1 with binary format:
datano Specifies a tool group number.
type Specifies a current tool number.
tool_num Specifies a new tool number.
h_code Specifies a tool length compensation number. (Always "0" for
the lathe system (T series).)
d_code Specifies a tool radius compensation number. (Always "0" for
the lathe system (T series).)
tool_inf Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_no) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool number (tool_no) is invalid.
- 735 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads various tool information.
When "0" is specified for grp_no or tool_no, the tool group or tool being currently used
is referenced, respectively. When no tool group number has been specified since power-on,
however, "0" is stored.
This function is available only when you use an up to 4-digit tool number.
If you use a tool number longer than 4 digits, you must use the cnc_rd1tlifedat2.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 736 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.178 Read tool life management data (tool data 1) (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rd1tlifedat2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rd1tlifedat2( short grp_num, long tool_num,
struct iodbtd2 *tld1);
struct iodbtd2 {
short datano; /* Tool group number. */
short dummy; /* Not used. */
long type; /* Not used. */
long tool_num; /* Tool number. */
long h_code; /* Tool length compensation number. */
long d_code; /* Tool radius compensation number. */
long tool_inf; /* Tool information. */
} ;
[Arguments]
grp_num Specifies a tool group number.
tool_num Specifies a tool number.
tld1 Pointer to structure iodbtd2 to which to return various tool
information.
The following information items are stored in tld1 with binary format:
datano Specifies a tool group number.
type Specifies a current tool number.
tool_num Specifies a new tool number.
h_code Specifies a tool length compensation number. (Always "0"
for the lathe system (T series).)
d_code Specifies a tool radius compensation number. (Always "0"
for the lathe system (T series).)
tool_inf Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
- 737 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads various tool information.
When "0" is specified for grp_no or tool_no, the tool group or tool being currently used
is referenced, respectively. When no tool group number has been specified since power-on,
however, "0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 738 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.179 Read tool life management data (tool data 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rd2tlifedata
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rd2tlifedata( short grp_no, short use_no,
struct iodbtd * tld2);
struct iodbtd {
short datano; /* Tool group number. */
short type; /* Tool ordinal number. */
long tool_num; /* Tool number. */
long h_code; /* Tool length compensation number. */
long d_code; /* Tool radius compensation number. */
long tool_inf; /* Tool information. */
} ;
[Arguments]
grp_no Specifies a tool group number.
use_no Specifies a tool ordinal number.
tld2 Pointer to structure iodbtd to which to return various tool information.
The following information items are stored in tld2 with binary format:
datano Specifies a tool group number.
type Specifies a current tool number.
tool_num Specifies a new tool number.
h_code Specifies a tool length compensation number. (Always "0"
for the lathe system (T series).)
d_code Specifies a tool radius compensation number. (Always "0"
for the lathe system (T series).)
tool_inf Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_no) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (use_no) is invalid.
- 739 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads various tool information.
When "0" is specified for grp_no, the tool group being currently used is referenced.
When no tool group number has been specified since power-on, however, "0" is stored.
When "0" is specified for use_no, the tool being currently used is referenced for the
number of a tool group already used or the first tool is referenced for the number of
a tool group which has not yet been used.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 740 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.180 Write tool life management data (tool data 1). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wr1tlifedata
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wr1tlifedata( struct iodbtd *tld1);
struct iodbtd {
short datano; /* Tool group number. */
short type; /* Current tool number. */
long tool_num; /* New tool number. */
long h_code; /* Tool length compensation number. */
long d_code; /* Tool radius compensation number. */
long tool_inf; /* Tool information. */
} ;
[Arguments]
tld1 Pointer to structure iodbtd for updating various tool information.
The following information items are stored in tld1 with binary format:
datano Specifies a tool group number.
type Specifies a current tool number.
tool_num Specifies a new tool number.
h_code Specifies a tool length compensation number. (Always "0"
for the lathe system (T series).)
d_code Specifies a tool radius compensation number. (Always "0"
for the lathe system (T series).)
tool_inf Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_no) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified current tool number (type) is invalid.
- 741 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Writes various tool information.
1. As preprocessing, set TLIFE_OPTION as the option and "1" as the value for the
cnc_setlibopt function and call the function.
2. Call cnc_wr1tlifedata.
3. As postprocessing, set TLIFE_OPTION as the option and "0" as the value for the
cnc_setlibopt function and call the function.
When all of the following conditions are satisfied at a normal call, error EW_REJECT(13)
is returned:
- During automatic operation (OP = "1").
- The tool group with the target number is being used or to be used next.
- Bit 1 (TCO) of parameter No. 6802 = "0".
- 742 -
B-64303EN-3/01 PROGRAMMING 3.Function References
When all of the following conditions are satisfied at a normal call, the tool status
cannot be changed to the cleared state:
- During automatic operation (OP = "1").
- The tool group with the target number is being used or to be used next.
- The tool with the target number is being used.
- Bit 1 (TCO) of parameter No. 6802 = "1".
- Bit 2 (E17) of parameter No. 6802 = "1".
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 743 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.181 Write tool life management data (tool data 1) (2). (2) <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wr1tlifedat2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wr1tlifedat2( struct iodbtd2 *tld1);
struct iodbtd2 {
short datano; /* Tool group number. */
short dummy; /* Not used. */
long type; /* Current tool number. */
long tool_num; /* New tool number. */
long h_code; /* Tool length compensation number. */
long d_code; /* Tool radius compensation number. */
long tool_inf; /* Tool information. */
} ;
[Arguments]
tld1 Pointer to structure iodbtd2 for updating various tool information.
The following information items are stored in tld1 with binary format:
datano Specifies a tool group number.
type Specifies a current tool number.
tool_num Specifies a new tool number.
h_code Specifies a tool length compensation number. (Always
"0" for the lathe system (T series).)
d_code Specifies a tool radius compensation number. (Always
"0" for the lathe system (T series).)
tool_inf Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified current tool number (type) is invalid.
- 744 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Writes various tool information.
1. As preprocessing, set TLIFE_OPTION as the option and "1" as the value for the
cnc_setlibopt function and call the function.
2. Call cnc_wr1tlifedat2.
3. As postprocessing, set TLIFE_OPTION as the option and "0" as the value for the
cnc_setlibopt function and call the function.
When all of the following conditions are satisfied at a normal call, error EW_REJECT(13)
is returned:
- During automatic operation (OP = "1").
- The tool group with the target number is being used or to be used next.
- Bit 1 (TCO) of parameter No. 6802 = "0".
- 745 -
3.Function References PROGRAMMING B-64303EN-3/01
When all of the following conditions are satisfied at a normal call, the tool status
cannot be changed to the cleared state:
- During automatic operation (OP="1").
- The tool group with the target number is being used or to be used next.
- The tool with the target number is being used.
- Bit 1 (TCO) of parameter No. 6802 = "1".
- Bit 2 (E17) of parameter No. 6802 = "1".
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 746 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.182 Write tool life management data (tool data 2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wr2tlifedata
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wr2tlifedata( struct iodbtd *tld2 );
struct iodbtd {
short datano; /* Tool group number. */
short type; /* Tool ordinal number. */
long tool_num; /* Tool number. */
long h_code; /* Tool length compensation number. */
long d_code; /* Tool radius compensation number. */
long tool_inf; /* Tool information. */
};
[Arguments]
tld2 Pointer to structure iodbtd for updating various tool information.
The following information items are stored in tld2 with binary format:
datano Specifies a tool group number.
type Specifies a current tool number.
tool_num Specifies a new tool number.
h_code Specifies a tool length compensation number. (Always
"0" for the lathe system (T series).)
d_code Specifies a tool radius compensation number. (Always
"0" for the lathe system (T series).)
tool_inf Specifies tool information:
1: The tool is registered.
2: The life of the tool ends.
3: The tool is skipped.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (type) is invalid.
- 747 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Writes various tool information.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the CNC.
- 748 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.183 Read tool life management data (tool group information). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdgrpinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdgrpinfo( short s_grp, short e_grp, short length,
struct iodbtgi *grpinfo);
struct iodbtgi {
short s_grp; /* Read start group number. */
short dummy; /* Not used. */
short e_grp; /* Read end group number. */
struct {
long n_tool; /* Number of tools. */
long count_value; /* Tool life value. */
long counter; /* Tool life counter value. */
long count_type; /* Tool life counter type. */
} data[N];
} ; /* N: Number of groups of which information is to be read. */
[Arguments]
s_grp Specifies the read start tool group number with binary format.
e_grp Specifies the read end tool group number with binary format.
length Specifies the data block length (size of structure iodbtgi).
iodbtgi 0┌────┐ ─
│ s_grp │ ↑
2├────┤ │
│ dummy │ │
4├────┤ │
│ e_grp │ │
6├────┤ │
│ │ │
8├────┴────┐length
│ data[0] │ │
24├─────────┤ │
~ ~ │
8+16×(N-1) ├─────────┤ │
│ data[N-1] │ ↓
8+16×N └─────────┘ ─
- 749 -
3.Function References PROGRAMMING B-64303EN-3/01
data 0┌──────┐
│ n_tool │
4├──────┤
│count_value │
8├──────┤
│ counter │
12├──────┤
│ count_type │
16└──────┘
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The size (length) of structure iodbtgi is invalid.
EW_NUMBER(3) Data number error.
The tool group number (s_grp or e_grp) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads tool group information. The following information items can be obtained:
- Number of tools.
- Tool life value.
- Tool life counter value.
- Tool life counter type (0: Count, 1: Time).
The unit of the tool life value is [minutes] or [times].
Which unit is used depends on the setting of bit 2 (LTM) of parameter No. 6800 on the
CNC. For the M series, the tool life counter type (time or count specification) can be
set for each tool group number with the G10 command.
- 750 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system. The following parameters
are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 751 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.184 Read tool life management data (tool group information 4). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdgrpinfo4
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdgrpinfo4( short grp_no, short direction,
short num_to_read, short *num_read,struct iodbtgi4 *grpinfo4);
struct iodbtgi4 {
short grp_no; /* Tool group number. */
long n_tool; /* Number of tools. */
long count_value; /* Tool life value. */
long counter; /* Tool life counter value. */
long count_type; /* Tool life counter type. */
long opt_grpno; /* Arbitrary group number. */
long life_rest; /* Remaining life setting. */
} ;
[Arguments]
grp_no Specifies the read start tool group number with binary format.
If a number outside the tool group number range is specified, an error
is returned.
When the specified number is within the tool group number range, this
function starts reading tool information of the existing tool group with
the number nearest the specified number.
Direction Specifies the read search direction.
Reads tool information based on the tool group number specified for the
read start tool group number (grp_no):
0: In ascending order (in the direction in which the tool group number
increases).
1: In descending order (in the direction in which the tool group number
decreases).
num_to_read Specifies the number of items to be read.
If a value smaller than or equal to "0" is specified, an error is
returned.
num_read Specifies the pointer to a short variable for which to store the number
of items read actually.
After a search is performed for the read start tool group number in the
read search direction, if no group for which a tool is specified is found,
a value of 0 is returned.
grpinfo4 Pointer to structure iodbtgi4 to which to return tool group information.
The following information items are stored in grpinfo4 with binary
format:
grp_no Tool group number.
- 752 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
A number smaller than or equal to 0 is specified for the number of items
to be read (num_to_read).
EW_NUMBER(3) Data number error.
The tool group number (grp_no) is invalid.
EW_ATTRIB(4) Data attribute error.
The search direction (direction) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads tool group information 4. The following information items can be obtained:
- Number of tools.
- Tool life value.
- Tool life counter value.
- Tool life counter type (0: Count, 1: Time).
- Arbitrary group number.
- Remaining life setting.
The unit of the tool life value is [times] or [minutes] depending on the setting of bit
2 (LTM) of parameter No. 6800 on the CNC.
For the M series, the tool life counter type (time or count specification) can be set
for each tool group number with the G10 command.
"0" is returned for the arbitrary group number and remaining life setting.
(Note) At least as many arrays as the number of items to be read that is specified for
num_to_read must be prepared.
If the prepared number of arrays is smaller than the number specified for
num_to_read, the operation of this function is not guaranteed.
- 753 -
3.Function References PROGRAMMING B-64303EN-3/01
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
- Bit 5 (TGN) of parameter No. 6802.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 754 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.185 Write tool life management data (tool group information). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrgrpinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_wrgrpinfo( short length, struct iodbtgi *grpinfo);
struct iodbtgi {
short s_grp; /* Write start group number. */
short dummy; /* Not used. */
short e_grp; /* Write end group number. */
struct {
long n_tool; /* Not used. */
long count_value; /* Tool life value. */
long counter; /* Tool life counter value. */
long count_type; /* Tool life counter type. */
} data[N];
}; /* N: Number of groups of which information */
/* is to be written. */
[Arguments]
length Specifies the data block length (size of structure iodbtgi).
iodbtgi 0┌────┐ ─
│ s_grp │ ↑
2├────┤ │
│ dummy │ │
4├────┤ │
│ e_grp │ │
6├────┤ │
│ │ │
8├────┴────┐length
│ data[0] │ │
24├─────────┤ │
~ ~ │
8+16×(N-1) ├─────────┤ │
│ data[N-1] │ ↓
8+16×N └─────────┘ ─
- 755 -
3.Function References PROGRAMMING B-64303EN-3/01
data 0┌──────┐
│ n_tool │
4├──────┤
│count_value │
8├──────┤
│ counter │
12├──────┤
│ count_type │
16└──────┘
N is the number of groups of which information is to be written.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The size (length) of structure iodbtgi is invalid.
EW_NUMBER(3) Data number error.
The tool group number (s_grp or e_grp) is invalid.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function. One of the following detail status codes is
set in member err_no in structure odberr:
0: Error other than EW_DATA.
1: Tool life value (count_value) error.
2: Tool life counter value (counter) error.
3: Tool life counter type (count_type) error.
5: During automatic operation.
6: Next group to be used or group being used.
(No items other than the life counter value can be changed.)
The number of the tool group containing invalid data is set in member
err_dtno in structure odberr.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 756 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Writes tool group information.
The maximum life value and life counter value are as follows:
For the count specification: 99999999 times
For the time specification: 60000 minutes
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 757 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.186 Delete tool life management data (tool group information). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_deltlifegrp
[Syntax]
#include <fwindow.h>
short cnc_deltlifegrp( short number );
[Arguments]
number Specifies a tool group number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (number) is invalid.
EW_DATA(5) Data error.
The specified tool number (data) is invalid.
To get more detailed information on this return value, execute the
cnc_getdtailerr function. One of the following detail status codes is
set in member err_no in structure odberr:
0: Error other than EW_DATA.
5: During automatic operation.
6: Next group to be used or group being used.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
EW_REJECT(13) CNC processing is rejected.
No data can be written because processing is being executed for the group,
the group is being selected, or data of the group is being buffered.
[Description]
Deletes a tool group.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 758 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.187 Add tool life management data (tool data). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_instlifedt
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_instlifedt( struct idbitd * inst );
struct idbitd {
short datano; /* Tool group number. */
short type; /* Tool ordinal number. */
long data; /* Tool number. */
};
[Arguments]
inst Pointer to structure idbitd in which to set tool data.
The following information items are stored in idbitd with binary
format:
datano Specifies a tool group number.
type Specifies a tool ordinal number.
data Specifies a tool number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (datano) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (type) is invalid.
EW_DATA(5) Data error.
The specified tool number (data) is invalid.
To get more detailed information on this return value, execute the
cnc_getdtailerr function. One of the following detail status codes is
set in member err_no in structure odberr:
0: Error other than EW_DATA.
1: Tool number (data) error.
5: During automatic operation.
6: Next group to be used or group being used.
- 759 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Adds tool data.
The code indicating that "the life of the tool does not end" is set for tool information.
Added data is inserted following the specified tool ordinal number.
When a tool is added to a tool group which is not registered, the tool group itself is
also registered.
In this case, the life value, life counter value, H code, and D code are set to "0".
The life counter type depends on the parameter setting.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 760 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.188 Delete tool life management data (tool data). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_deltlifedt
[Syntax]
#include <fwindow.h>
short cnc_deltlifedt( short grp_num, short ent_num );
[Arguments]
grp_num Specifies a group number.
ent_num Specifies a tool ordinal number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grp_num) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (ent_num) is invalid.
EW_DATA(5) Data error.
The specified tool number (data) is invalid.
To get more detailed information on this return value, execute the
cnc_getdtailerr function. One of the following detail status codes is
set in member err_no in structure odberr:
0: Error other than EW_DATA.
5: During automatic operation.
6: Next group to be used or group being used.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
EW_REJECT(13) CNC processing is rejected.
No data can be written because processing is being executed for the group,
the group is being selected, or data of the group is being buffered.
- 761 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Deletes tool data.
After tool data is deleted, the space is filled up in the file (see the figure below).
┌────┐ ┌────┐
Tool ordinal│Tool │ Tool ordinal│Tool │
number │number │ number │number │
├────┤ Delete tool data with ├────┤
1 │ 010 │ tool ordinal number 2. 1 │ 010 │
├────┤ ├────┤
2 │ 020 │ ────────> 2 │ 030 │
├────┤ ├────┤
3 │ 030 │ 3 │ 040 │
├────┤ ├────┤
・ ~ ~ ・ ~ ~
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 762 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.189 Clear tool life management data (life counter, tool information) (range specified).
<Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_clrcntinfo
[Syntax]
#include <fwindow.h>
short cnc_clrcntinfo( short grpno_s, short grpno_e );
[Arguments]
grpno_s Specifies the write start group number.
grpno_e Specifies the write end group number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) Data number error.
The tool group number (grpno_s or grpno_e) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
EW_REJECT(13) CNC processing is rejected.
No data can be written because processing is being executed for the group,
the group is being selected, or data of the group is being buffered.
To get more detailed information on this return value, execute the
cnc_getdtailerr function. The number of the tool group containing
invalid data is set in member err_dtno in structure odberr.
[Description]
Clears the life counter and tool information.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 763 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.190 Read tool life management data (maximum number of groups that can be registered/maximum
number of tools that can be registered in group/maximum tool life value). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtlinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtlinfo( struct odbtlinfo *tlinfo ) ;
struct odbtlinfo {
long max_group; /* Maximum number of groups that can be */
/* registered. */
long max_tool; /* Maximum number of tools that can be registered. */
long max_minute; /* Maximum tool life value (time) */
long max_cycle; /* Maximum tool life value (count) */
} ;
[Arguments]
tlinfo Pointer to structure odbtlinfo in which to store the number of tool
groups, maximum number of groups that can be registered, maximum number
of tools that can be registered in a group, and maximum tool life value.
The following information items are stored in odbtlinfo with binary
format:
max_group Maximum number of groups that can be registered.
max_tool Maximum number of tools that can be registered.
max_minute Maximum tool life value (time).
max_cycle Maximum tool life value (count).
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the maximum number of groups that can be registered, maximum number of tools that
can be registered in a group, and maximum tool life value.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- 764 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 765 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.191 Read tool life management data (tool group information). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtlgrp
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtlgrp( short grp_no,short *num, struct iodbtlgrp *tlgrp);
struct iodbtlgrp {
long ntool; /* Number of tools. */
long nfree; /* Number of tools that can be used. */
long life; /* Tool life value. */
long count; /* Tool life counter value. */
long use_tool; /* Ordinal number of the tool being selected. */
long opt_grpno; /* Arbitrary group number. */
long life_rest; /* Remaining life setting. */
short rest_sig; /* Advance notice signal status. */
short count_type ; /* Counter type. */
} ;
[Arguments]
grp_no Specifies the read start tool group number with binary format.
num Specifies the pointer to the variable for the number of groups to be
read.
The number of groups actually installed is stored in this variable.
tlgrp Pointer to arrays of structure iodbtlgrp in which to store tool group
information.
The following information items are stored in iodbtlgrp with binary
format:
ntool Number of tools.
nfree Number of tool that can be used.
life Tool life value.
use_tool Ordinal number of the tool being selected.
opt_grpno Arbitrary group number.
"-1" is returned.
life_rest Remaining life setting.
"-1" is returned.
rest_sig Advance notice signal status.
"0" is returned.
count_type Counter type.
0: The type is count.
1: The type is time.
- 766 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The number of groups (*num) is invalid.
EW_NUMBER(3) Data number error.
The specified tool group number (grp_no) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads tool group information. The following information items can be obtained:
- Number of tools.
- Number of tools that can be used.
- Tool life value.
- Tool life counter value.
- Ordinal number of the tool being selected.
- Arbitrary group number.
- Remaining life setting.
- Advance notice signal status.
- Tool life counter type (0: Count 1: Time).
The unit of the tool life value is [times] or [minutes] depending on the setting of bit
2 (LTM) of parameter No. 6800 on the CNC.
For the M series, the tool life counter type (time or count specification) can be set
for each tool group number with the G10 command.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
- Bit 5 (TGN) of parameter No. 6802.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 767 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.192 Read tool life management data (tool information). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdtltool
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdtltool( long grp_no, long use_no, short *num,
struct iodbtltool *tltool);
struct iodbtltool {
long tool_num; /* Tool number. */
long h_code; /* Tool length compensation number. */
long d_code; /* Tool radius compensation number. */
long tool_inf; /* Tool information. */
} ;
[Arguments]
grp_no Specifies a tool group number.
use_no Specifies the read start tool ordinal number.
num Specifies the pointer to the variable for the number of tool data items
to be read.
The number of tool data items actually installed is stored in this
variable.
tltool Pointer to arrays of structure iodbtltool in which to store tool
information.
The following information items are stored in iodbtltool with binary
format:
ool_num Number of tools.
h_code Number of tools that can be used.
d_code Tool life value.
tool_inf Tool information.
- 768 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) Error in the data block length.
The number of tool information items (*num) is invalid.
EW_NUMBER(3) Data number error.
The specified tool group number (grp_no) is invalid.
EW_ATTRIB(4) Data attribute error.
The specified tool ordinal number (use_no) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads various tool information. The following information items can be obtained:
- Tool number.
- Tool length compensation number ("0" is always read for the lathe system (T
series)).
- Tool radius compensation number ("0" is always read for the lathe system (T
series)).
- Tool information.
0: No tool data.
1: The life does not end.
2: The life of the tool ends.
3: Skipped tool.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 769 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.193 Read tool life management data (tool group number) (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdgrpid2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdgrpid2( long number, struct odbtlife5 *grpid);
struct odbtlife5 {
long dummy ; /* Not used. */
long type ; /* Tool number. */
long data ; /* Tool group number. */
} ;
[Arguments]
number Specifies a tool number.
grpid Pointer to structure odbtlife5 to which to return the tool group number.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_ATTRIB(4) Data attribute error.
The specified tool number (number) is invalid.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
- 770 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the number of the tool group in which the specified tool is registered.
When the tool number is found in multiple tool groups, the smallest group number is stored.
The number of the tool group in which the specified tool number is registered is stored
in grpid data with binary format. When "0" is specified for number, the number of the
tool group being currently used is stored. When no tool group number has been specified
since power-on, however, "0" is stored.
Up to 128 sets (for M and T series) or 256 sets (for T series (2-path control)) are
available for tool life management through the entire system.
The following parameters are related to this function:
- Bit 0 (GS1) of parameter No. 6800.
- Bit 1 (GS2) of parameter No. 6800.
- Parameter No. 6813.
For information about the parameters, refer to "Parameter Manual" (B-64310EN) of the
CNC.
- 771 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.194 Read tool life management data (count override). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdcntover
[Syntax]
#include <fwindow.h>
short cnc_rdcntover( short * cntover )
[Arguments]
cntover Pointer to the variable to which to return the count override value.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NOOPT(6) A required function is not provided.
Enable the tool life management function (bit 0 (TLF) of parameter No.
8132 =1).
[Description]
Reads the count override value.
- 772 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.195 Get CNC error details. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_getdtailerr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_getdtailerr( struct odberr *err ) ;
struct odberr{
short err_no ; /* Detail status. */
short err_dtno ; /* Error data number. */
} ;
[Arguments]
err Area in which to store error details.
[Return]
EW_OK(0) Successful.
[Description]
Gets detailed information of an error which occurred when a function was executed.
- 773 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.196 Write MDI program. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrmdiprog
[Syntax]
#include <fwindow.h>
short cnc_wrmdiprog( short length, char *data ) ;
[Arguments]
length Specifies the number of characters in the MDI program to be written.
data Specifies the start address of the MDI program data to be written.
Up to 500 characters including the end NULL character are allowed for
an MDI program data string.
Specify NULL at the end of MDI program data.
[Return]
Return values are listed below. For information about other return values, see Subsection
3.4.2, "Return values of data window functions" above in II, "PROGRAMMING".
EW_OK(0) Successful.
EW_LENGTH(2) The number of characters in the MDI program (length) is invalid.
EW_DATA(5) A character which is unavailable for NC programs is detected.
EW_MODE(12) The function is executed in an unavailable CNC mode.
Set the CNC mode to MDI.
EW_REJECT(13) MDI operation is being executed or the CNC is in the emergency stop
status.
[Description]
Writes an MDI program to the CNC.
This function must be used in the MDI mode.
The written data format is shown below.
- 774 -
B-64303EN-3/01 PROGRAMMING 3.Function References
char data[ ] =
"\nM03S2000\nG28U0W0\nT0101\nG00X35.0Z-10.0\n%" ;
len = (short)strlen( data ) ;
ret = cnc_wrmdiprog( len, data ) ;
return ;
}
- 775 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.197 Read execution pointer for MDI operation. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdmdipntr
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdmdipntr( struct odbmdip *buf ) ;
struct odbmdip{
long mdiprog ; /* Number of the program being executed. */
long mdipntr ; /* Execution block pointer. */
long crntprog ; /* Buffered program number. */
long crntpntr ; /* Buffered block pointer. */
} ;
[Arguments]
buf Pointer to structure odbmdip to which to return execution pointer
information.
[Return]
Return values are listed below. For information about other return values, see Subsection
3.4.2, "Return values of data window functions" above in II, "PROGRAMMING".
EW_OK(0) Successful.
EW_MODE(12) The function is executed in an unavailable CNC mode.
Set the CNC mode to MDI.
[Description]
Reads the execution pointer for MDI operation.
This function must be used in the MDI mode.
The following data items can be obtained:
- 776 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.198 Write execution pointer for MDI operation. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrmdipntr
[Syntax]
#include <fwindow.h>
short cnc_wrmdipntr( long crntpntr ) ;
[Arguments]
crntpntr Specifies the execution start block pointer with an absolute pointer
value (block number indicated when the number of the first block of
the program is 0).
[Return]
Return values are listed below. For information about other return values, see Subsection
3.4.2, "Return values of data window functions" above in II, "PROGRAMMING".
EW_OK(0) Successful.
EW_DATA(5) The specified execution start block pointer (crntpntr) is invalid.
EW_MODE(12) The function is executed in an unavailable CNC mode.
Set the CNC mode to MDI.
EW_REJECT(13) MDI operation is being executed or the CNC is in the emergency stop
status.
[Description]
Specifies the execution pointer for MDI operation. (The pointer cannot be directly
manipulated while a program is being executed.)
Before executing this function, register an MDI program using the cnc_wrmdiprog
function.
This function must be used in the MDI mode.
- 777 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.199 Read CNC status information (2). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_statinfo2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_statinfo( struct odbst2 *buf ) ;
struct odbst2 {
short hdck ; /* Manual handle retrace status. */
short tmmode ; /* Not used. */
short aut ; /* Auto/manual operation mode selection. */
short run ; /* Automatic operation status. */
short motion ; /* Axis movement/dwell status. */
short mstb ; /* M/S/T/B function status. */
short emergency ; /* Emergency stop status. */
short alarm ; /* Alarm status. */
short edit ; /* Program editing status. */
short warning ; /* Warning message status. */
short o3dchk ; /* Not used. */
short ext_opt ; /* Not used. */
short restart ; /* Restart check status after program editing. */
} ;
* For a 2-path system, all status values are indicated for each path.
[Arguments]
buf Status information storage area
[Return]
Main return value is as follows. For information about other return values, see Subsection
3.4.2, "Return values of data window functions" above in Part II, "PROGRAMMING".
EW_OK(0) Successful.
- 778 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads CNC status information.
The following status information items can be read:
- 779 -
3.Function References PROGRAMMING B-64303EN-3/01
- T series
0: **** (no editing)
1: EDIT (during editing)
2: SeaRCH (during a search)
3: OUTPUT (during data output)
4: INPUT (during data input)
5: COMPARE (during comparison)
6: Label SKip (label skip state)
8: Work ShiFT (in the workpiece shift write mode)
9: ReSTaRt (during program restart)
17: MEmory-CHecK (during tape memory check)
restart Check performed at the restart of automatic operation after program editing.
0: One of the following states:
- The program is not edited.
- Bit 7 (RSC) of parameter No. 10330 is set to disable the function which displays
a confirmation message at the restart of automatic operation.
- NC not supported.
1: The program is edited.
- 780 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.200 Read parameter data information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdparainfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_rdparainfo( short s_number, unsigned short read_no,
struct odbparaif *paraif ) ;
struct odbparaif {
unsigned short info_no ; /* Number of parameter data information items. */
short prev_no ; /* Previous parameter data number. */
short next_no ; /* Next parameter data number. */
struct {
short prm_no ; /* Parameter data number. */
short prm_type ; /* Parameter data attribute. */
} info[N] ; /* N: Number of parameter data information items to be */
/* read. */
} ;
[Arguments]
s_number [in] Specifies the start parameter data number.
read_no [in] Specifies the number of parameter data information items to be
read.
paraif [out] Information storage area to which to return parameter data
information.
Pointer to setif to which to return parameter data information.
info_no Number of parameter data information items.
Number of actually read parameter data information items.
prev_no Previous parameter data number.
Valid number preceding the first read parameter data
information.
next_no Next parameter data number.
Valid number following the last read parameter data
information.
info[N].prm_no Parameter data number.
Actually existing parameter data number.
- 781 -
3.Function References PROGRAMMING B-64303EN-3/01
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_NUMBER(3) The specified start parameter data number (s_number) is invalid.
[Description]
Reads CNC parameter data information specified with s_number and read_no.
In principle, CNC parameter data is not stored contiguously, and attributes such as the
type and size differ depending on the individual number. Use this function to display
parameter data.
- 782 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.201 Read program on a line-by-line basis. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_rdpdf_line
[Syntax]
#include <fwindow.h>
short cnc_rdpdf_line( char *prog_name, unsigned long line_no,
char *prog_data, unsigned long *line_len,
unsigned long *data_len ) ;
[Arguments]
prog_name Specifies a program path with drive-name+path-name+file-name.
When prog_name data is NULL, the name of the last accessed program is
assumed to be specified.
If you want to specify an MDI program, specify "MDI".
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is "//DATA_SV/".
Specify the following paths for the program folder of the CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/"
Path 2:"//CNC_MEM/USER/PATH2/"
line_no Specifies the read start line number.
For the first line in the program, specify 0.
If a number greater than the number of registered lines is specified,
an error (EW_DATA) is returned.
prog_data Specifies the start address of the buffer in which to store read program
data.
line_len Specifies the number of lines to be read in the program.
The function returns the number of actually read lines.
data_len Specifies the number of characters to be read in the program.
The function returns the number of actually read characters.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_BUSY(-1) Busy.
- During the execution of a search.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
1: Program path (prog_name) error.
2: Read start line number (line_no) error.
- 783 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Reads the specified program on a line-by-line basis.
This function attempts to read as many lines in the program as specified for (*line_len)
(it returns the number of actually read lines). If the number of characters that is
specified for (*data_len) is reached (the function returns the number of actually read
characters), the function stops reading the program. When the end (EOB (‘\n’)) of the
last line read is not read, the line is not counted as the read line, however.
Example) If you want to read lines 1 to 3 of the following program, you must specify
at least 33 for the number of characters to be read. If a value of 30 is specified
for the number of characters to be read, a value of 2 is set for the number of read
lines (*line_len) because line 3 cannot be read to its end. Thirty characters are
set in the buffer, however.
O1234 ;
N001 G01 X0. F100 ;
N002 X20. ;
N003 X50. ;
N004 X80. ;
N005 M30 ;
%
The following table shows the relationships between each CNC mode and target program
(MDI program, program being selected, or program not selected):
Even when the OP signal is set to 1, this function can be executed if the STL signal
is set to 0 (in the status such as feed hold stopped or single block stopped).
When this function is executed for an MDI program or program being selected, the execution
pointer moves to the beginning of the line specified for line_no in the following cases:
- When an MDI program is specified in the MDI mode
- When the program being selected is specified in the EDIT mode
- When the program being selected is specified in the TJOG/THND mode with a playback
function
- 784 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.202 Write program on a line-by-line basis. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_wrpdf_line
[Syntax]
#include <fwindow.h>
short cnc_wrpdf_line( char *prog_name, unsigned long line_no,
char *prog_data, unsigned long data_len);
[Arguments]
prog_name Specifies a program path with drive-name+path-name+file-name.
When prog_name data is NULL, the name of the last accessed program is
assumed to be specified.
If you want to specify an MDI program, specify "MDI".
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths for the program folder of the CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/"
Path 2:"//CNC_MEM/USER/PATH2/"
line_no Specifies the number of a line to be written.
Line 0 is the first line (line containing a program name and program
number) of a program.
prog_data Specifies the pointer to the buffer in which the program string to be
written is stored.
Note the following points and specify a string in ASCII code:
- Codes other than those significant for the NC are ignored.
- Lowercase alphabetic characters are ignored.
- '%' (EOR) is ignored.
Even when the specified string contains multiple EOB characters ('\n'),
the registered line with the specified line number is replaced with the
specified string.
That is, one line can be replaced with multiple lines.
data_len Specifies the number of characters to be written.
Before data is written, the unused space in the NC is checked. If the
size of the space is smaller than that for the number of characters to
be written + 100 characters, data is not written and an error
(EW_OVRFLOW) is returned.
Up to 200 characters can be written at a time.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_BUSY(-1) Busy.
- 785 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Writes the specified program on a line-by-line basis.
The file name on the first line cannot be changed. If an attempt is made to rewrite the
file name, an error (EW_DATA) is returned.
The following table shows the relationships between each CNC mode and target program
(MDI program, program being selected, or program not selected):
When a playback function is enabled, TJOG/THND mode is assumed to be the same as the
"EDIT mode".
Even when the OP signal is set to 1, this function can be executed if the STL signal
is set to 0 (in the status such as feed hold stopped or single block stopped).
When this function is executed for an MDI program or program being selected, the execution
pointer moves to the beginning of the line specified for line_no in the following cases:
- When an MDI program is specified in the MDI mode
- When the program being selected is specified in the EDIT mode
- When the program being selected is specified in the TJOG/THND mode with a playback
function
- 786 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.203 Delete program on a line-by-line basis. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_delline
[Syntax]
#include <fwindow.h>
short cnc_pdf_delline( char *prog_name, unsigned long line_no,
unsigned long line_len);
[Arguments]
prog_name Specifies a program path with drive-name+path-name+file-name.
When prog_name data is NULL, the name of the last accessed program is
assumed to be specified.
If you want to specify an MDI program, specify "MDI".
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths for the program folder of the CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/"
Path 2:"//CNC_MEM/USER/PATH2/"
line_no Specify the deletion start line number.
For the first line of the program, specify 0.
If the specified number exceeds the number of registered lines, an error
(EW_DATA) is returned.
line_len Specify the number of lines in the program that are to be deleted.
If the specified number exceeds the number of registered lines, the
lines from that with the specified line number to the last line but one
are deleted. The last line (%) is not deleted.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_BUSY(-1) Busy.
- During the execution of a search.
EW_DATA(5) Data error.
To get more detailed information on this return value, execute the
cnc_getdtailerr function.
One of the following detail status codes is set in member err_no in
structure odberr:
1: Program path (prog_name) error.
2: Deletion start line number (line_no) error.
3: Error in the number of lines to be deleted (line_len).
EW_PROT(7) Write protection.
- CNC parameters (Nos. 8000s and Nos. 9000s protection and encryption)
are write-protected according to the setting.
- 787 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Deletes the specified program on a line-by-line basis.
When the number of the line containing the file name ("Oxxxx" or "<xxxx>") is specified
for the deletion start line number, data following the file name to the end of line ('\n')
is deleted, but the file name is not deleted.
Example)
Deletes the following program on a line-by-line basis:
O1234(TEST PROGRAM) ;
G01 X0. F100 ;
X20. ;
M30 ;
%
When three lines starting from line 0 in the program are deleted, the result is:
O1234 M30 ;
%
The following table shows the relationships between each CNC mode and target program
(MDI program, program being selected, or program not selected):
When a playback function is enabled, TJOG/THND mode is assumed to be the same as the
"EDIT mode".
Even when the OP signal is set to 1, this function can be executed if the STL signal
is set to 0 (in the status such as feed hold stopped or single block stopped).
When this function is executed for an MDI program or program being selected, the execution
pointer moves to the beginning of the line specified for line_no in the following cases:
- When an MDI program is specified in the MDI mode
- When the program being selected is specified in the EDIT mode
- When the program being selected is specified in the TJOG/THND mode with a playback
function
- 788 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.204 Get program execution pointer. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_rdactpt
[Syntax]
#include <fwindow.h>
short cnc_pdf_wractpt( char *prog_name, long *blk_no ) ;
[Arguments]
prog_name Specifies the pointer to the area in which to store the program being
executed.
When an MDI program is executed, "MDI" is set. The buffer must be able
to contain at least 244 characters.
blk_no Specifies the pointer to the area in which to store the block number
indicated when the number of the first block of the program is 0.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_MODE(12) CNC mode error.
- The function is executed in a mode other than the MDI, MEM, EDIT,
TJOG, or THND mode.
EW_REJECT(13) Pointer get processing is rejected.
- Currently, the target program does not exist.
- The CNC is performing DNC or M198 operation.
- The STL signal is on.
- In the emergency stop status.
[Description]
Gets the current program name and block number in the MDI or MEM mode and EDIT, TJOG,
or THND mode and stores them in prog_name.
- 789 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.205 Set program execution pointer. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
cnc_pdf_wractpt
[Syntax]
#include <fwindow.h>
short cnc_pdf_wractpt( char *prog_name, short type, long *blk_no );
[Arguments]
prog_name Specifies a program for which to set the execution pointer with
drive-name+path-name+file-name.
For an MDI program, specify "MDI".
The drive name of the memory card is “//MEMCARD/”.
The drive name of the data server is “//DATA_SV/”.
Specify the following paths for the program folder of the CNC memory.
Path 1:"//CNC_MEM/USER/PATH1/"
Path 2:"//CNC_MEM/USER/PATH2/"
type Execution pointer type.
0: Absolute pointer
(The number of the first block of the program is 0.)
1: Relative pointer
(Relative value to the current execution pointer)
blk_no Specifies the pointer to the long variable for which to store the block
number to be set.
When type = 0
- Specify a block number indicated when the number of the first block
of the program is 0.
When type = 1
- Specify the relative value to the current execution pointer as the
block number.
- When a value of 0 is specified for the block number, the execution
pointer is not changed, and the next pointer to be executed is set
in blk_no with an absolute pointer.
[Return]
Main return values are as follows. For information about other return values, see
Subsection 3.4.2, "Return values of data window functions" above in Part II,
"PROGRAMMING".
EW_OK(0) Successful.
EW_ATTRIB(4) Data attribute error.
- An invalid value is specified for type.
EW_DATA(5) Data error.
- The specified program name is invalid or does not exist.
- The specified block number is invalid or does not exist.
EW_MODE(12) CNC mode error.
- In the EDIT mode, NULL is specified for prog_name.
EW_REJECT(13) CNC processing is rejected.
- During operation.
- No MDI program exists.
- No program is selected.
- An alarm is issued.
- In the emergency stop status.
[Description]
Sets the next pointer (block) to be executed for a program for MDI or memory operation.
When a block has been buffered, the buffered block is executed before the pointer (block)
set with this function is executed.
- 791 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.1 Read arbitrary PMC data (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_rdpmcrng
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_rdpmcrng( short adr_type, short data_type, short s_number,
short e_number, short length, struct iodbpmc *buf ) ;
struct iodbpmc {
short type_a ; /* Kind of PMC address. */
short type_d ; /* Type of PMC data. */
short datano_s ; /* Start PMC address. */
short datano_e ; /* End PMC address. */
union {
char cdata[N] ; /* PMC data (Byte) */
short idata[N] ; /* (Word) */
long ldata[N] ; /* (2-Word) */
} u ; /* N is number of data to be read. */
} ;
[Arguments]
adr_type Kind of PMC address.
data_type Type of PMC data.
s_number Start PMC address.
e_number End PMC address.
length Data block length
( =8+(byte size of data)*(number of data to be read)).
buf Buffer in which the PMC data are stored.
[Return]
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect PMC address "s_number" or "e_number".
EW_ATTRIB( 4) Incorrect kind of PMC address "adr_type" or type of PMC data
"data_type".
- 792 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the PMC data at the specified PMC address or in the specified address range.
This function is used to read or write data between an application program in C Language
Executor and PMC ladder software.
Argument adr_type specifies the identification code corresponding to the type of a PMC
address to be read.
Identification
PMC address type
code
0, ‘G‘ G ( PMC → CNC )
1, ‘F‘ F ( CNC → PMC )
2, ‘Y‘ Y ( PMC → Machine )
3, ‘X‘ X ( Machine → PMC )
4, ‘A‘ A ( Message request )
5, ‘R‘ R ( Internal relay/system relay )
6, ‘T‘ T ( Variable timer )
7, ‘K‘ K ( Keep relay )
8, ‘C‘ C ( Counter )
9, ‘D‘ D ( Data table )
12, ‘E‘ E ( Expansion relay )
For the PMC data referenceable area of each PMC address type, see Table 3.4.2.1, "PMC
data referenceable areas" shown later.
Argument data_type specifies a PMC data type. This data type must be the same as that
on the PMC side.
0: byte type
1: word type
2: long type
Argument s_number specifies the PMC address number at which read operation is started.
Argument e_number specifies the PMC address number at which read operation is ended.
- 793 -
3.Function References PROGRAMMING B-64303EN-3/01
- 794 -
B-64303EN-3/01 PROGRAMMING 3.Function References
0i-D / 0i Mate-D
Signal type Symbol 0i-D PMC
PMC/L
Output signal from PMC to CNC G G0 to G767 G0 to G767
G1000 to G1767 G1000 to G1767(NOTE 2)
G2000 to G2767 (NOTE 2)
G3000 to G3767 (NOTE 2)
G4000 to G4767 (NOTE 2)
G5000 to G5767 (NOTE 2)
G6000 to G6767 (NOTE 2)
G7000 to G7767 (NOTE 2)
G8000 to G8767 (NOTE 2)
G9000 to G9767 (NOTE 2)
Internal relay R R0 to R7999 R0 to R1499
System relay R R9000 to R9499 R9000 to R9499
Expansion relay E E0 to E9999 E0 to E9999
Message display A
- Display request A0 to A249 A0 to A249
- Display status A9000 to A9249 A9000 to A9249
Timer T
- Variable timer T0 to T499 T0 to T79
- For variable timer precision (NOTE 3) T9000 to T9499 T9000 to T9079
Counter C
- Variable counter C0 to C399 C0 to C79
- Constant counter C5000 to C5199 C5000 to C5039
Keep relay K
- User area K0 to K99 K0 to K19
- System area K900 to K999 K900 to K999
Data table D D0 to D9999 D0 to D2999
Label L L1 to L9999 L1 to L9999
Sub program P P1 to P5000 P1 to P512
- 795 -
3.Function References PROGRAMMING B-64303EN-3/01
NOTE
1 Reserved area for the PMC management software. No I/O can be allocated to this
area. A user program cannot use this area.
2 Reserved area for the PMC management software. A user program cannot use
this area.
3 Area used to set the timer precision of the variable timer
- Do not change the set time or precision setting during operation of the timer. (It
is allowed to continue writing the same value.)
- The precision setting must fall within the following specified range.
- If the above rules are not observed, normal timer operation is not guaranteed.
- The areas other than T9000-T9999(0i-D PMC) or T9000-T9079(PMC/L, DCS
PMC) are reserved by FANUC.
The correspondence between the precision settings and the values that can be
written to T9000 is shown below.
0: Default (8/48 msec)
1: 1 msec
2: 10 msec
3: 100 msec
4: 1 sec
5: 1 min
- 796 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program reads and displays the feed rate override value
(G0012).
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 797 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.2 Write arbitrary PMC data (range specified). <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_wrpmcrng
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_wrpmcrng( short length, struct iodbpmc *buf ) ;
struct iodbpmc {
short type_a ; /* Kind of PMC address. */
short type_d ; /* Type of PMC data. */
short datano_s ; /* Start PMC address. */
short datano_e ; /* End PMC address. */
union {
char cdata[N] ; /* PMC data (Byte) */
short idata[N] ; /* (Word) */
long ldata[N] ; /* (2-Word) */
} u ; /* N is number of data to be written. */
} ;
[Arguments]
length Specifies the data block length.
When type_d is "0" (byte type): length = 8 + N
When type_d is "1" (word type): length = 8 + N × 2
When type_d is "2" (long type): length = 8 + N × 4
* N is the number of data items to be rewritten.
buf PMC data storage area
type_a Specifies the identification code corresponding to the type of a PMC
address to be read.
type_d Specifies the type of PMC data.
datano_s Specifies the PMC address number at which write operation is started.
datano_e Specifies the PMC address number at which write operation is ended.
For the specifiable address types, start address, and end address, see
"PMC data referenceable areas" in "Read arbitrary PMC data (range
specified) (pmc_rdpmcrng)".
- 798 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Return]
EW_OK( 0) Successful.
EW_LENGTH( 2) Incorrect data block length "length".
EW_NUMBER( 3) Incorrect PMC address "buf.datano_s" or "buf.datano_e".
EW_ATTRIB( 4) Incorrect kind of PMC address "buf.type_a" or type of
PMC data "buf.type_d".
[Description]
Writes the PMC data at the specified PMC address or in the specified address range.
This function is used to read or write data between an application program in C Language
Executor and PMC ladder software.
- 799 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program sets the specified bit of a specified internal relay (R) to "1".
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
- 800 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.3 Read PMC message. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_rdpcmsg
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_rdpcmsg( unsigned short adr_no, unsigned short adr_bit,
struct pmcmsg *buf ) ;
struct pmcmsg {
unsigned short msg_len ; /* Length of message. */
unsigned char pmc_msg[256] ; /* PMC message string. */
} ;
[Arguments]
adr_no PMC address A. ( =0 - 24 )
adr_bit Bit of PMC address A. ( =0 - 7 )
buf Buffer in which PMC message is stored.
[Return]
EW_OK( 0) Successful.
EW_NUMBER( 3) Incorrect PMC address A.
EW_ATTRIB( 4) Incorrect bit of PMC address A.
EW_DATA( 5) No message for specified address.
[Description]
Reads the specified PMC message data.
This function reads the corrsponding message to the specified PMC address A and bit
number.
The PMC message is stored in "buf.pmc_msg". The PMC message is the ASCII string as same
as one which is displayed in the CNC's alarm message screen. The 2-byte character such
as Japanese Kanji character is stored by Shift-JIS code. A 'NULL' character ('\x00')
is added at the end of the string. The length of the string stored in "buf.pcm_msg"
is stored in "buf.msg_len" with binary format.
- 801 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads all PMC message character strings and displays them on the
screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
- 802 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.4 Get the unit type of PMC currently being operated. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_get_current_pmc_unit
[Syntax]
#include <fwindow.h>
short pmc_get_current_pmc_unit ( long * unittype );
[Arguments]
unittype Specifies a pointer to the place in which the current PMC unit type is
stored.
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_FUNC( 1) No PMC is present.
[Description]
Gets the unit type of the PMC currently being operated.
- 803 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.5 Get the number of PMC paths. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_get_number_of_pmc
[Syntax]
#include <fwindow.h>
short pmc_get_number_of_pmc ( long * number );
[Arguments]
number Specifies a pointer to the place in which the number of PMC paths is
stored.
[Return]
The main return value is shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Gets the number of existing PMC paths (units).
- 804 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.6 Get PMC unit types. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_get_pmc_unit_types
[Syntax]
#include <fwindow.h>
short pmc_get_pmc_unit_types ( long unittypes[], long * count );
[Arguments]
unittypes Specifies a pointer to the place in which the PMC unit type is stored.
The number of PMC paths can be acquired by the pmc_get_number_of_pmc
function.
[Return]
The main return value is shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
[Description]
Acquires information as to which unit types of PMCs compose a multi-PMC system.
- 805 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.7 Select PMC unit to be operated. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_select_pmc_unit
[Syntax]
#include <fwindow.h>
short pmc_select_pmc_unit ( long unittype ) ;
[Arguments]
unittype Specifies the unit type of a PMC to be selected.
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_NOPMC( 1) The specified PMC is not present.
[Description]
Selects the unit type of a PMC to be operated.
- 806 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.8 Get PMC memory address information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_getpmcptr
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_getpmcptr(short adr_type, short number, short size,
struct odbpmcptr * p_pmcptr);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
adr_type [in] PMC memory type
G:0, F:1, Y:2, X:3, A:4, R:5, T:6,
K:7, C:8, D:9, M:10, N:11, E:12
* For details, see the pmc_rdpmcrng function.
number [in] PMC memory offset
size [in] Access size
Specify one of the following access sizes.
1: 1 byte, 2: 2 bytes, 4: 4 bytes
The memory access function, which is described later, returns an error
if memory access is performed using the size greater than this
setting.
*p_pmcptr [out] Address information of PMC memory
The members of the structure are described below.
Attr PMC memory attribute
#31: Valid bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH(2) Argument size is illegal.
EW_NUMBER(3) Argument number is illegal.
EW_ATTRIB(4) Argument adr_type is illegal.
EW_DATA(5) Argument p_pmcptr is NULL.
- 807 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Returns the address information of PMC memory.
If the acquired address information is set in the first argument of a memory access
function (pmc_rdpmcchar function, pmc_rdpmcshort function, pmc_rdpmclong function,
pmc_wrpmcchar function, pmc_wrpmcshort function, or pmc_wrpmclong function, which is
described later), it is possible to access PMC memory at high speed.
If the function aborts because, for example, the specified adr_type, number, or size
is illegal, invalid address information is returned. To determine whether the acquired
address information is valid, use the pmc_isvalidpmcptr function described later.
If the PMC memory access function is executed with invalid address information specified,
the memory access function does nothing.
If the PMC memory write function is executed with address information of the write inhibit
PMC memory (X or F address) specified, the write operation is not performed.
The PMC memory access function performs memory access of the PMC path selected during
acquisition of address information, not the PMC path selected during execution of the
memory access function.
Do not change address information structure odbpmcptr acquired by the pmc_getpmcptr
function using an application program. If the PMC memory access function is called with
changed address information, normal operation is not guaranteed.
- 808 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.9 Validate PMC memory address information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_isvalidpmcptr
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_getpmcptr(const struct odbpmcptr * p_pmcptr);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
p_pmcptr [in] Pointer to address information of PMC memory
The members of the structure are described below.
Attr PMC memory attribute
#31: Enable bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
[Description]
Checks whether the address information acquired by the pmc_getpmcptr function is valid.
- 809 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.10 Read 1-byte signed data from PMC memory. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_rdpmcchar
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_rdpmcchar(const struct odbpmcptr * p_pmcptr, char * p_data);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
p_pmcptr [in] Pointer to address information of PMC memory
Set the pointer to the address information acquired by the pmc_getpmcptr
function.
The members of the structure are described below.
attr PMC memory attribute
#31: Enable bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
*p_data [out] Returns the read data.
If the function abnormally ends, a value of 0 is returned.
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH(2) The access size is illegal.
EW_DATA(5) Argument p_pmcptr is NULL, address information is invalid, or argument
p_data is NULL.
- 810 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads PMC memory using the PMC memory address information acquired by the pmc_getpmcptr
function.
- 811 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.11 Read 2-byte signed data from PMC memory. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_rdpmcshort
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_rdpmcshort(const struct odbpmcptr * p_pmcptr,
short * p_data);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
p_pmcptr [in] Pointer to address information of PMC memory
Set the pointer to the address information acquired by the pmc_getpmcptr
function.
The members of the structure are described below.
attr PMC memory attribute
#31: Enable bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
*p_data [out] Returns the read data.
If the function abnormally ends, a value of 0 is returned.
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH(2) The access size is illegal.
EW_DATA(5) Argument p_pmcptr is NULL, address information is invalid, or argument
p_data is NULL.
- 812 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads PMC memory using the PMC memory address information acquired by the pmc_getpmcptr
function.
- 813 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.12 Read 4-byte signed data from PMC memory. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_rdpmclong
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_rdpmclong(const struct odbpmcptr * p_pmcptr, long * p_data);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
p_pmcptr [in] Pointer to address information of PMC memory
Set the pointer to the address information acquired by the pmc_getpmcptr
function.
The members of the structure are described below.
Attr PMC memory attribute
#31: Enable bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
*p_data [out] Returns the read data.
If the function abnormally ends, a value of 0 is returned.
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH(2) The access size is illegal.
EW_DATA(5) Argument p_pmcptr is NULL, address information is invalid, or argument
p_data is NULL.
- 814 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads PMC memory using the PMC memory address information acquired by the pmc_getpmcptr
function.
- 815 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.13 Write 1-byte signed data to PMC memory. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_wrpmcchar
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_wrpmcchar(const struct odbpmcptr * p_pmcptr, char data);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
p_pmcptr [in] Pointer to address information of PMC memory
Set the pointer to the address information acquired by the pmc_getpmcptr
function.
The members of the structure are described below.
attr PMC memory attribute
#31: Enable bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
data [in] Data to be written
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH(2) The access size is illegal.
EW_DATA(5) Argument p_pmcptr is NULL, address information is invalid, or argument
p_data is NULL.
EW_PROT(7) Write prohibition address
- 816 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Writes data to PMC memory using the PMC memory address information acquired by the
pmc_getpmcptr function.
- 817 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.14 Write 2-byte signed data to PMC memory. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_wrpmcshort
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_wrpmcshort(const struct odbpmcptr * pmcptr, short data);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
p_pmcptr [in] Pointer to address information of PMC memory
Set the pointer to the address information acquired by the pmc_getpmcptr
function.
The members of the structure are described below.
Attr PMC memory attribute
#31: Enable bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
data [in] Data to be written
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH(2) The access size is illegal.
EW_DATA(5) Argument p_pmcptr is NULL, address information is invalid, or argument
p_data is NULL.
EW_PROT(7) Write prohibition address
- 818 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Writes data to PMC memory using the PMC memory address information acquired by the
pmc_getpmcptr function.
- 819 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.14 Write 4-byte signed data to PMC memory. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_wrpmclong
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_wrpmclong(const struct odbpmcptr * p_pmcptr, long data);
struct odbpmcptr {
unsigned long attr; /* Attribute */
unsigned long ptr; /* Pointer */
} ;
[Arguments]
p_pmcptr [in] Pointer to address information of PMC memory
Set the pointer to the address information acquired by the pmc_getpmcptr
function.
The members of the structure are described below.
Attr PMC memory attribute
#31: Enable bit
(0: Pointer invalid, 1: Pointer valid)
#30: Write enable bit
(0: Write disabled, 1: Write enabled)
#0 to #15: Access size
ptr Pointer to PMC memory (physical address)
data [in] Data to be written
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH(2) The access size is illegal.
EW_DATA(5) Argument p_pmcptr is NULL, address information is invalid, or argument
p_data is NULL.
EW_PROT(7) Write prohibition address
- 820 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Writes data to PMC memory using the PMC memory address information acquired by the
pmc_getpmcptr function.
- 821 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.16 Get PMC address information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
pmc_rdpmcinfo
[Syntax]
#include <data.h>
#include <fwindow.h>
short pmc_rdpmcinfo(short adr_type, struct odbpmcinf * pmcif);
struct odbpmcinf {
short datano; /* PMC data information count */
struct odbpmcinf {
char pmc_adr; /* PMC address type */
char adr_attr; /* PMC address attribute */
short top_num; /* PMC address start number */
short last_num; /* PMC address end number */
} info[64];
}
[Arguments]
adr_type [in] Type of a PMC address
G:0, F:1, Y:2, X:3, A:4, R:5, T:6,
K:7, C:8, D:9, E:12, all types: -1
* For details, see the pmc_rdpmcrng function.
[Return]
The main return values are shown below. For information about other return values, see
Subsection 3.4.2, "Return values of data window fanctions" above in Part II,
"PROGRAMMING".
EW_OK( 0) Successful.
EW_LENGTH( 1) Address type error. (The adr_type value is illegal.)
- 822 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Reads the PMC address attribute for each type and PMC address information of the valid
range.
The following information can be acquired.
- PMC data information count (1 to 64)
* The same PMC address may be divided into multiple sections.
- Character indicating a PMC address type (ASCII code)
- PMC address attributes
#7 … 0: Write prohibition enabled
1: Write prohibition disabled
#0 to #6 … Not used
- PMC address start number
- PMC address end number
- 823 -
3.Function References PROGRAMMING B-64303EN-3/01
1. Outline
The application program can control the MDI-KEY using the MDI operation library.
MDI key matrix is a table where the relationship of the MDI key bit matrix which is defined
by the hardware specification and the key attributes and the key code is defined. This is
referenced to convert the MDI key bit matrix data read from MDI panel into key code for the
application program.
The MDI Key matrix consists of the key function table which defines key attributes and the
key code table which defines key codes. There are both matrix for the user application program
and one for CNC software.
The relationship of the MDI key bit matrix and the MDI key matrix is as follows.
MDI key bit matrix Function flag table Key code table
0th bit 0th byte 0th word
1st bit 1st byte 1st word
0th byte
: : :
7th bit 7th byte 7th word
: : : :
n-th byte m-th bit (n*8+m)-th byte (n*8+m)-th word
Each words of the key code table include both "Main code" and "Sub code".
It is impossible to push the SHIFT key and any ordinary keys simultaneously.
To input sub code, operate as following sequence.
- 824 -
B-64303EN-3/01 PROGRAMMING 3.Function References
The function flag is one byte flag which defines attributes of key for every key.
This flag defines following items bit by bit.
(3) Uppercase/Lowercase
This function is made ineffective by altering MDI key matrix of "Cursor[↑]" or "Cursor[↓]".
Only uppercase characters are always input to the CNC software regardless of this operation.
Also "Key input by application program" described in next section isn't influenced by this
operation.
- 825 -
3.Function References PROGRAMMING B-64303EN-3/01
(1) Functions
The application program can send an arbitrary character or string to the key input buffer of
the MDI-KEY by calling following functions.
These character and string are received regardless of any operation to the screen or MDI panel.
(2) Arguments
The application program sends a pair of the function flag and the key code to be output to
the above functions. The format of the function flag is same as the MDI key matrix. Any arbitrary
value is allowed to be specified for key code. Also any key code which isn't registered in the
standard key matrix. (It is possible to send a key code as a message from any auxiliary task
to the main task.)
The key input from the application program is handled more preferentially than one from the
MDI panel. Therefore, when any key is input from both the application and the MDI panel
simultaneously, the former is given to the software. Usually, inhibit the key input from the
MDI panel during inputting key from the application program using following functions.
Only RESET key is accepted during being inhibited key input from the MDI panel.
- 826 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[CAUTION] Use "aux_mdi_getmatrix" and "aux_mdi_putmatrix" functions in case that you must
needs them anyway.
These functions are very flexible, but very dangerous if you mistake those usage.
- 827 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1. Get MDI key matrix. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_getmatrix
[Syntax]
#include <bios.h>
int aux_mdi_getmatrix( void *matrix_ptr, int matrix_len,
int module_id ) ;
[Arguments]
matrix_ptr Buffer in which key matrix is stored.
matrix_len Byte size of key matrix buffer.
module_id Class of matrix.
[Return]
0 Successful.
-1 Incorrect byte size of key matrix buffer "matrix_len". Or incorrect class of
matrix "module_id".
[Description]
Reads the current key matrix (function flag table and key code table) of MDI key, and
stores them in the specified buffer.
This function is used to read the original key matrix for altering the part of the key
matrix.
Get the required table size of the key matrix before calling this function, and allocate
buffer area for reading.
- 828 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2. Put MDI key matrix. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_putmatrix
[Syntax]
#include <bios.h>
int aux_mdi_putmatrix( void *matrix_ptr, int matrix_len,
int module_id ) ;
[Arguments]
matrix_ptr Buffer in which key matrix is stored.
matrix_len Byte size of key matrix buffer.
module_id Class of matrix.
[Return]
0 Successful.
-1 Incorrect byte size of key matrix buffer "matrix_len". Or
incorrect class of matrix "module_id".
[Description]
Registers the specified key matrix as the new matrix.
This function is very dangerous. If there are any mistakes in the specified key matrix,
the key inputting process may not work correctly.
Take care to use this function.
All keys can be customized by this function. But you should not customize the important
key for CNC operation such as RESET key.
- 829 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
3. Reset MDI key matrix. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_rstmatrix
[Syntax]
#include <bios.h>
int aux_mdi_rstmatrix( int module_id ) ;
[Arguments]
module_id Class of matrix.
[Return]
0 Successful.
Negative Incorrect class of matrix "module_id".
[Description]
Restore the MDI key matrix to the initial (power-on) setting.
- 830 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
4. Alter MDI key matrix. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_altmatrix
[Syntax]
#include <bios.h>
int aux_mdi_altmatrix( int module_id, int category, int update ) ;
[Arguments]
module_id Class of matrix.
category Kind of key to be altered.
update New specification.
[Return]
0 Successful (No alteration was applied.).
Positive Successful ("Positive" is number of applied alteration.).
-1 Incorrect class of matrix "module_id".
-2 Incorrect kind of key to be altered "category".
-3 Incorrect new specification "update".
-4 Incorrect "MDI_SHIFT_xx" specification.
-5 Incorrect "MDI_TO_xx" specification.
-6 Incorrect "MDI_REPEAT_xx" specification.
-7 Attempted to alter the RESET key.
[Description]
Alters character code or character attribute which is assigned to the specified MDI key.
This function is used to alter character code assigned to the key or to enable automatic
key repeating of the cursor key or the page key, etc.
Specify one of following matrix class. The specified matrix will be altered.
Replaces the specified code in the current matrix with the new code.When there are
multiple specified codes in the matrix, all codes are replaced. This alteration can't
be executed with alteration of character attribute simultaneously.
- 831 -
3.Function References PROGRAMMING B-64303EN-3/01
The specified key is set as "invalid key" by specifying "NULL(0x00)" as new code.
- 832 -
B-64303EN-3/01 PROGRAMMING 3.Function References
(Note) The repeat attributes of the following key codes are valid regardless
of the MDI key matrix value, so it is impossible to switch the automatic
repeat function between enabled and disabled.
(Note) It is impossible to set the RESET key being inhibited to be read by CNC software.
- 833 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
5. Put one character to key input buffer. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_putc
[Syntax]
#include <bios.h>
int aux_mdi_putc( int c ) ;
[Arguments]
c Output data.
[Return]
1 Successful.
0 Key input buffer is full.
[Description]
Output the specified 1-byte character to the key input buffer.
Specify a function flag in the upper byte of "c" and a character code in the lower byte.
For example, specify as follows to output 'A'.
upper byte <- 0x20 (function flag)
lower byte <- 0x41 (character code)
This function outputs data to the key input buffer. Check buffer emptiness by calling
"aux_mdi_control" function to confirm completion of outputting data from the buffer.
- 834 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
6. Write block data to key input buffer. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_write
[Syntax]
#include <bios.h>
int aux_mdi_write( void *buffer, int size ) ;
[Arguments]
buffer Buffer in which the output data are stored.
size Byte size of output data.
[Return]
Positive Successful. (Byte size of actually output data.)
This value will be smaller than the specified size in case that
there are not enough room for specified size in the key input buffer.
0 Key input buffer is full.
[Description]
Output data for specified byte size from the specified buffer to the key input buffer.
This function outputs data to the key input buffer. Check buffer emptiness by calling
"aux_mdi_control" function to confirm completion of outputting data from the buffer.
- 835 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
7. Test or control key input buffer. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_control
[Syntax]
#include <bios.h>
int aux_mdi_control( int control ) ;
[Arguments]
control Control code.
[Return]
(1) In case of successful.
MDI_CHK_BUF Returns number of data in the buffer.
MDI_GET_MTXLEN Returns byte size of MDI key matrix.
MDI_CASE_ON Returns the previous status.
MDI_CASE_OFF Returns the previous status.
MDI_CHK_FKEY Returns the key code of pushed function key.
Others Returns "0".
[Description]
Test the key input buffer, or execute specified operation to the key input buffer.
control Operation
MDI_CHK_BUF Returns number of data in the application key input buffer.
MDI_CLR_BUF Clears the application key input buffer.
MDI_LOK_PNL Locks MDI key input except RESET key.
MDI_ULK_PNL Unlocks MDI key input.
MDI_GET_MTXLEN Return byte size of the MDI key matrix table.
MDI_CASE_ON Enables uppercase/lowercase character input from the MDI panel.
MDI_CASE_OFF Disables uppercase/lowercase character input from the MDI panel.
If the screen switching was disabled while any user screen was
MDI_CHK_FKEY displaying for some reason and any function key was pushed during
disabling screen switching, returns key code of that function key.
- 836 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
8. Set key repeating interval time. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_repeat
[Syntax]
#include <bios.h>
int aux_mdi_repeat( int delay, int repeat ) ;
[Arguments]
delay Delay time of automatic repeating.
repeat Interval time of automatic repeating.
[Return]
0 Successful.
-1 Incorrect delay time "delay".
-2 Incorrect interval time "repeat".
[Description]
Set the delay time and the interval time of automatic key repeating.
Specify the interval time 32 through 1024 [msec] in "repeat" with binary format. The
unit of the interval time is "millisecond". Only multiple of "32[msec]" are allowed to
set. The default setting value of the interval time is "MDI_KEY_REPEAT"
(32[msec]).
- 837 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
9. Read inputting status of MDI key. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_getstat
[Syntax]
#include <bios.h>
unsigned int aux_mdi_getstat( void ) ;
[Arguments]
------
[Return]
Returns inputting status of MDI key.
[Description]
Gets the inputting status of MDI key.
That is, once pushing [SHIFT] key makes "SHIFT state" ON, then, pushing any other key
makes "SHIFT state" released. Pushing [SHIFT]key again during "SHIFT state" makes
"SHIFT released.
It is impossible to input Sub code by pushing any key and [SHIFT] key simultaneously.
Bit8 through bit15 of return value indicate a number of characters input from the MDI
panel and not read yet by the application program.
This function gets the status of key input buffer while the C Language Executor's user
screen is being displayed. It can't get the status of the key input buffer of the CNC
software.
- 838 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program reads a line of alpha-numeric characters from the MDI panel.
Inputting operation is completed by inputting [INPUT] key. It displays one of '_' (in
normal state) and '^' as cursor.
#include <bios.h>
#include <ctype.h>
#include <stdio.h>
#define BUFSIZE 80
unsigned char buf[BUFSIZE] ;
- 839 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
10. Clear input buffer of MDI key. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
aux_mdi_clrbuf
[Syntax]
#include <bios.h>
void aux_mdi_clrbuf( void ) ;
[Arguments]
------
[Return]
------
[Description]
Clears input buffer of MDI key.
This function clears all characters which are input from MDI panel and not read by the
application program yet, and makes "SHIFT state" at the same time.
This function makes no effects to the key input buffer of the CNC software.
- 840 -
B-64303EN-3/01 PROGRAMMING 3.Function References
The following are the key code table of various keyboard which are supported by C Language
Executor. Lines and columns of "Key bit matrix", "Key function flag table" and "Key code table"
are correspond each other in every keyboard.
For example, to get key code and function flag for C application of "X" key in the machining
system's full key, search as follows.
(1) Search "X" key in "Key bit matrix". (7th line, 4th column)
(2) See the 7th line and 4th column of "Key function flag table" and "Key code table"
for C application.
(3) You get 0x10 for key function flag and "58 55" for key code.
This means that a code 0x58 will be generated by pushing "X" key individually, and
0x55 by pushing SHIFT + "X".
In the MDI key matrix, F0 to F9, FL, and FR are horizontal soft keys.
8.4-inch color LCD
[FL] [F5] [F6] [F7] [F8] [F9] [FR] 7 (5+2) horizontal soft keys
- 841 -
3.Function References PROGRAMMING B-64303EN-3/01
[FL] [F0] [F1] [F2] [F3] [F4] [F5] [F6] [F7] [F8] [F9] [FR] 12 (10+2) horizontal soft keys
- 842 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Setting bit 2 (EKY) of parameter(No.8650) in the NC to 1 causes the key BIOS of the C Language
Executor to scan the extension MDI keys. If a user application assigns key codes to the extension
of the key matrix, the assigned keys can be read.(If no key code is specified, it is impossible
to read the extension keys.)
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0
8 9 - ・ / EOB CAN
1
↓ ↑ PAGE PAGE I K R F
4
DOWN UP [ ] & SP
RESET
5 SKH12 SKH11 SKH10 SKH9
O N G P X Z C Y
7
( ) E Q A B D ?
U W H V M S T L
8
, J @ _ # = * +
- 843 -
3.Function References PROGRAMMING B-64303EN-3/01
- 844 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 845 -
3.Function References PROGRAMMING B-64303EN-3/01
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0
8 9 - ・ / EOB CAN
1
↓ ↑ PAGE PAGE F D H B
4
DOWN UP [ ] & SP
RESET
5 SKH12 SKH11 SKH10 SKH9
O N G P X Y Z Q
7
( ) E C U V W ?
I J K R M S T L
8
, A @ _ # = * +
- 846 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 847 -
3.Function References PROGRAMMING B-64303EN-3/01
- 848 -
B-64303EN-3/01 PROGRAMMING 3.Function References
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0
* , # = [ ] SP A
8 9 - ・ EOB CAN
1
B D + / E
↓ ↑ PAGE PAGE
4
DOWN UP
RESET
5
O N G X Z F
7
P Q R C Y L
U W M S T
8
H V I K J
- 849 -
3.Function References PROGRAMMING B-64303EN-3/01
- 850 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 851 -
3.Function References PROGRAMMING B-64303EN-3/01
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0
* , # = [ ] SP A
8 9 - ・ EOB CAN
1
B C + / E
↓ ↑ PAGE PAGE
4
DOWN UP
RESET
5
O N G X Y Z
7
P Q R U V W
F H M S T
8
L D I J K
- 852 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 853 -
3.Function References PROGRAMMING B-64303EN-3/01
- 854 -
B-64303EN-3/01 PROGRAMMING 3.Function References
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0
* , # = [ ] SP A
8 9 - ・ EOB CAN
1
B D + / E
↓ ↑ PAGE PAGE
4
DOWN UP
RESET
5 SKH12 SKH11 SKH10 SKH9
O N G X Z F
7
P Q R C Y L
U W M S T
8
H V I K J
- 855 -
3.Function References PROGRAMMING B-64303EN-3/01
- 856 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 857 -
3.Function References PROGRAMMING B-64303EN-3/01
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0
* , # = [ ] SP A
8 9 - ・ EOB CAN
1
B C + / E
↓ ↑ PAGE PAGE
4
DOWN UP
RESET
5 SKH12 SKH11 SKH10 SKH9
O N G X Y Z
7
P Q R U V W
F H M S T
8
L D I J K
- 858 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 859 -
3.Function References PROGRAMMING B-64303EN-3/01
- 860 -
B-64303EN-3/01 PROGRAMMING 3.Function References
80-column
[FL] [F0] [F1] [F2] [F3] [F4] [F5] [F6] [F7] [F8] [F9] [FR]<- 12 (10+2) horizontal soft keys
- 861 -
3.Function References PROGRAMMING B-64303EN-3/01
All display devices have 7 horizontal soft keys along the bottom of the screen.
40 columns
- 862 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 863 -
3.Function References PROGRAMMING B-64303EN-3/01
- 864 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.1 Get current screen index. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_getcurscrn
[Syntax]
#include <crt.h>
int crt_getcurscrn( void ) ;
[Arguments]
------
[Return]
Returns the index number of the currently displayed screen.
[Description]
Gets the index number of the currently displayed screen.
Refer the following screen index number list for index numbers of each screens. All
available index values are defined in crt.h as "CRT_xxx_xxx".
- 865 -
3.Function References PROGRAMMING B-64303EN-3/01
Index
Symbol Screen
number
POSITION
CRT_POS_ABS 0x0100 ABS
CRT_POS_REL 0x0200 REL
CRT_POS_ALL 0x0300 ALL
CRT_POS_HNDL 0x0400 HNDL
CRT_POS_MONI 0x0600 MONITOR
CRT_POS_CEXE 0x3200 C Language Executor
CRT_POS_CEXE2 0x3300 C Language Executor 2
CRT_POS_CEXE3 0x3400 C Language Executor 3
CRT_POS_CEXE4 0x3500 C Language Executor 4
CRT_POS_CEXE5 0x3600 C Language Executor 5
CRT_POS_CNC 0x3f00 Previous CNC screen
PROGRAM
CRT_PRG_PRG 0x0101 PROG
CRT_PRG_LIB 0x0201 FOLDER (EDIT/TJOG)
CRT_PRG_NEXT 0x0301 NEXT (MDI/MEM/JOG)
CRT_PRG_PCHK 0x0401 CHECK (MEM)
CRT_PRG_REST 0x0801 RSTR (MDI/MEM/JOG/TJOG)
CRT_PRG_LIB2 0x1101 FOLDER (OTHER)
CRT_PRG_MDI 0x1201 MDI (MDI)
CRT_PRG_CUR 0x1301 CURRENT(MDI/MEM/JOG)
CRT_PRG_GRAPHIC 0x2e01 C.A.P (EDIT)
CRT_PRG_TMAC_MG0I 0x2f01 Conversational Macro MANUAL GUIDE 0i (EDIT)
CRT_PRG_CEXE 0x3201 C Language Executor
CRT_PRG_CEXE2 0x3301 C Language Executor 2
CRT_PRG_CEXE3 0x3401 C Language Executor 3
CRT_PRG_CEXE4 0x3501 C Language Executor 4
CRT_PRG_CEXE5 0x3601 C Language Executor 5
CRT_PRG_CNC 0x3f01 Previous CNC screen
OFFSET
CRT_OFS_OFS 0x0102 OFFSET
CRT_OFS_SETP 0x0202 SETTING
CRT_OFS_WORK 0x0302 WORK
CRT_OFS_MCR 0x0602 MACRO
CRT_OFS_PTNMENU 0x0702 PATTERN MENU
CRT_OFS_OPR 0x0802 OPR
CRT_OFS_TOOLMNG 0x0902 TOOL MANAGER
CRT_OFS_YOFS 0x0b02 OFST.2
CRT_OFS_WSFT 0x0c02 W.SHFT
CRT_OFS_TLFM 0x0e02 TOOL.F
CRT_OFS_PRELEV 0x1102 PR-LEV
CRT_OFS_CHUCK 0x1502 CHUCK TAIL
CRT_OFS_LANG 0x1602 LANG.
CRT_OFS_PROTECT 0x1702 PROTECT
CRT_OFS_SAFEGUARD 0x1802 GUARD
CRT_OFS_CEXE 0x3202 C Language Executor
CRT_OFS_CEXE2 0x3302 C Language Executor 2
CRT_OFS_CEXE3 0x3402 C Language Executor 3
CRT_OFS_CEXE4 0x3502 C Language Executor 4
CRT_OFS_CEXE5 0x3602 C Language Executor 5
- 866 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Index
Symbol Screen
number
CRT_OFS_CNC 0x3f02 Previous CNC screen
CRT_OFS_WEAR_S 0x0112 OFFSET-WEAR(SUB)
CRT_OFS_GEOM_S 0x0212 OFFSET-GEOM(SUB)
CRT_OFS_WEAR_S2 0x0312 OFFSET-WEAR2(SUB)
CRT_OFS_GEOM_S2 0x0412 OFFSET-GEOM2(SUB)
SYSTEM
CRT_SYS_PRM 0x0103 PARAM
CRT_SYS_DGN 0x0203 DGNOS
CRT_SYS_SYS 0x0403 SYSTEM
CRT_SYS_MEM 0x0603 MEMORY
CRT_SYS_PIT 0x0703 PITCH
CRT_SYS_SVPR 0x0803 SV-PRM
CRT_SYS_SPPR 0x0903 SP.SET
CRT_SYS_MAINTENANCE 0x0b03 PMC MAINTE
CRT_SYS_LADDER 0x0c03 PMC LADDER
CRT_SYS_PMCCONFIG 0x0d03 PMC CONFIG
CRT_SYS_MTUNE 0x1003 M-TUN
CRT_SYS_ALIO 0x1103 ALL IO
CRT_SYS_OHIS 0x1303 OPEHIS
CRT_SYS_COLOR 0x1503 COLOR
CRT_SYS_MAINT 0x1603 MAINTE
CRT_SYS_MINFO 0x1703 M-INFO
CRT_SYS_WANL 0x1803 W.DGNS
CRT_SYS_TOUCH 0x1a03 TOUCH
CRT_SYS_FSSB 0x1b03 FSSB
CRT_SYS_PARAMTUNE 0x1c03 PRMTUN
CRT_SYS_PMM 0x1d03 PMM
CRT_SYS_EMB_ETH 0x1f03 EMBED PORT
CRT_SYS_PCM_ETH 0x2003 PCMCIA LAN
CRT_SYS_BOARD_ETH 0x2103 ETHER BOARD
CRT_SYS_MAS_PROFI 0x2203 PROFI MASTER
CRT_SYS_REMOTEDGN 0x2403 RMTDGN
CRT_SYS_MCOD 0x2503 M CODE
CRT_SYS_SLV_PROFI 0x2903 PROFI SLAVE
CRT_SYS_DCSDGN 0x2e03 DUAL CHECK
CRT_SYS_IDINF 0x4103 CNC ID INFORMATION
CRT_SYS_PRMCHKSUM 0x4303 PRM CHK SUM
CRT_SYS_CEXE 0x3203 C Language Executor
CRT_SYS_CEXE2 0x3303 C Language Executor 2
CRT_SYS_CEXE3 0x3403 C Language Executor 3
CRT_SYS_CEXE4 0x3503 C Language Executor 4
CRT_SYS_CEXE5 0x3603 C Language Executor 5
CRT_SYS_CNC 0x3f03 Previous CNC screen
MESSAGE
CRT_MSG_ALM 0x0104 ALARM
CRT_MSG_EMSG 0x0204 MSG
CRT_MSG_AHIS 0x0304 HISTRY
CRT_MSG_MHIS 0x0404 MSGHIS
CRT_MSG_EMB_ETHLOG 0x0604 EMBED LOG
CRT_MSG_PCM_ETHLOG 0x0704 PCMCIA LOG
CRT_MSG_BOARD_ETHLOG 0x0804 BOARD LOG
CRT_MSG_SYSAHIS 0x0a04 SYS ALM HISTRY
CRT_MSG_CEXE 0x3204 C Language Executor
- 867 -
3.Function References PROGRAMMING B-64303EN-3/01
Index
Symbol Screen
number
CRT_MSG_CEXE2 0x3304 C Language Executor 2
CRT_MSG_CEXE3 0x3404 C Language Executor 3
CRT_MSG_CEXE4 0x3504 C Language Executor 4
CRT_MSG_CEXE5 0x3604 C Language Executor 5
CRT_MSG_CNC 0x3f04 Previous CNC screen
GRAPHIC
CRT_GRH_PRM 0x0105 (M/T) PARAMETER
CRT_GRH_GRP 0x0205 (M) GRAPH
CRT_GRH_TGRP 0x0305 (T) GRAPH
CRT_GRH_SCALE 0x0405 (M/T) SCALE
CRT_GRH_DYNPRM 0x0605 (M) DYNAMIC GRAPH PARAMETER
CRT_GRH_DYNGRP 0x0705 (M) DYNAMIC GRAPH
CRT_GRH_DYNPOS 0x0905 (M) DYNAMIC GRAPH TOOL POS
CRT_GRH_ANIMEPRM1 0x0b05 (M) DYNAMIC GRAPH ANIME PARAMETER 1
CRT_GRH_ANIME 0x0d05 (M) DYNAMIC GRAPH ANIME
CRT_GRH_ANIMEPRM2 0x1005 (M) DYNAMIC GRAPH ANIME PARAMETER 2
CRT_GRH_ANIME3PLN 0x1105 (M) DYNAMIC GRAPH ANIME 3 PLANES
CRT_GRH_DYNTPRM 0x1505 (T) DYNAMIC GRAPH PARAMETER
CRT_GRH_DYNTGRP 0x1705 (T) DYNAMIC GRAPH
CRT_GRH_DYNTSCALE 0x1805 (T) DYNAMIC GRAPH SCALE
CRT_GRH_CEXE 0x3205 C Language Executor
CRT_GRH_CEXE2 0x3305 C Language Executor 2
CRT_GRH_CEXE3 0x3405 C Language Executor 3
CRT_GRH_CEXE4 0x3505 C Language Executor 4
CRT_GRH_CEXE5 0x3605 C Language Executor 5
CRT_GRH_CNC 0x3f05 Previous CNC screen
CUSTOM
CRT_CUS_TMAC1 0x0106 Conversational Macro 1
CRT_CUS_TMAC2 0x0206 Conversational Macro 2
CRT_CUS_TMAC3 0x0306 Conversational Macro 3
CRT_CUS_CEXE 0x3206 C Language Executor
CRT_CUS_CEXE2 0x3306 C Language Executor 2
CRT_CUS_CEXE3 0x3406 C Language Executor 3
CRT_CUS_CEXE4 0x3506 C Language Executor 4
CRT_CUS_CEXE5 0x3606 C Language Executor 5
CRT_CUS_CNC 0x3f06 Previous CNC screen
CUSTOM2
CRT_CS2_CEXE 0x3207 C Language Executor
CRT_CS2_CEXE2 0x3307 C Language Executor 2
CRT_CS2_CEXE3 0x3407 C Language Executor 3
CRT_CS2_CEXE4 0x3507 C Language Executor 4
CRT_CS2_CEXE5 0x3607 C Language Executor 5
CRT_CS2_CNC 0x3f07 Previous CNC screen
- 868 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program displays the index number of the current screen.
#include <crt.h>
#include <stdio.h>
- 869 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.2 Register user screen index. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_setuserscrn
[Syntax]
#include <crt.h>
int crt_setuserscrn( int num, int *scrntbl ) ;
[Arguments]
num Number of screen index to be registered.
scrntbl Pointer to the user screen index table.
[Return]
Returns zero if successful.
If any error, returns -1 and sets the following error code in the global variable "errno".
[Description]
Registers the screen index numbers of the CNC screens which is replaced by the user
application program.
The index numbers of the user screens are registered in CNC by calling of this function.
Then, the user application will be called by selection of registered screens.
Store the screen index numbers in "scrntbl" with the following format.
The storing order is arbitrary.
Refer the screen index number list of "Get current screen index(crt_getcurscrn)" for
index numbers of each screens. All available index values are defined in crt.h as
"CRT_xxx_xxx".
At the start time of the application program, no user screen is registered. In this
condition, screen switching from the user screen to the CNC's is not allowed because
it is impossible to return to the user screen from the CNC screen again if no user screen
is registered.
So, this function must be called in the beginning of the main task of the user application
program.
- 870 -
B-64303EN-3/01 PROGRAMMING 3.Function References
This function doesn't check integrity of the screen index numbers to be registered.
Re-registration of the user screen index numbers by calling of this function again is
allowable. In this case, this function must be called under condition that any screen
switching is disabled by "crt_setswt" function.
For Series 0i-D, "C Language Executor screen" is added to each large classification of
CNC screens. (C Language Executor screen) C Language Executor screen is exclusive screen
for C Language Executor. The CNC software doesn't use this screen.
By registering this "C Language Executor screen" as user screen using this function,
the new user screen is added without replacing any existing CNC screens.
[Example]
The following program registers all position screens([ABS]/[REL]/[ALL]) as user's
screen.
#include <crt.h>
- 871 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.3 Test screen switching status. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_isnewscrn
[Syntax]
#include <crt.h>
int crt_isnewscrn( void ) ;
[Arguments]
------
[Return]
Returns non-zero value if any screen switching has been done after the last calling this
function. If not, returns zero.
[Description]
Test whether any screen switching has been done or not.
This function is used to check the new entrance to the user screen by screen switching
such as
(any user screen) -> (CNC screen) -> (the same user screen).
[Example]
The following program displays whether any screen switching has been done or not.
#include <crt.h>
#include <stdio.h>
- 872 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.4 Get CRT information. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_gettype
[Syntax]
#include <crt.h>
unsigned int crt_gettype( void ) ;
[Arguments]
------
[Return]
Returns CRT information.
- 873 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Gets the equipped LCD specification and the current display mode.
This function is used to get whether LCD is 8.4 inch or 10.4 inch, etc.
The following informations are returned on each bits of the return value.
- 874 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program displays information of the current display equipment.
#include <crt.h>
#include <stdio.h>
- 875 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.5 Set CRT screen mode. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_setmode
[Syntax]
#include <crt.h>
int crt_setmode( unsigned int mode ) ;
[Arguments]
mode CRT screen mode.
[Return]
Returns zero if successful.
If any error, returns non-zero value.
[Description]
When this function has been executed successfully, screen display is switched to the
specified mode and the screen is initialized.
When the 8.4-inch display unit is used and 256 colors are specified by the
_setvideomode function, however, if this function is executed, an error (-1) is returned
because the number of characters to be displayed cannot be set or changed.
mode Description
CRT_MODE_80X25 80-column × 25-line mode
Monochrome mode (without intensity modulation) (Specified with
CRT_MODE_MONO
CRT_MODE_80X25)
VGA display, 40-column × 16-line (with no line of space left from the top)
CRT_MODE_V16_0
mode
CRT_MODE_V16_1 VGA display, 40-column × 16-line (with a line of space left from the top) mode
VGA display, 40-column × 16-line (with two lines of space left from the top)
CRT_MODE_V16_2
mode
VGA display, 40-column × 16-line (with three lines of space left from the top)
CRT_MODE_V16_3
mode
CRT_MODE_V19 VGA display, 40-column × 19-line mode (Valid only for the 8.4-inch LCD.)
VGA display, 80-column × 25-line (with no line of space left from the top)
CRT_MODE_V25_0
mode
CRT_MODE_V25_1 VGA display, 80-column × 25-line (with a line of space left from the top) mode
VGA display, 80-column × 25-line (with two lines of space left from the top)
CRT_MODE_V25_2
mode
- 876 -
B-64303EN-3/01 PROGRAMMING 3.Function References
mode Description
VGA display, 80-column × 25-line (with three lines of space left from the top)
CRT_MODE_V25_3
mode
VGA display, 80-column × 25-line (with four lines of space left from the top)
CRT_MODE_V25_4
mode
VGA display, 80-column × 25-line (with five lines of space left from the top)
CRT_MODE_V25_5
mode
CRT_MODE_V30 VGA display, 80-column × 30-line mode
CRT_MODE_MODE2 Performs reduced display using 10.4-inch LCD font on the 8.4-inch LCD.
CRT_MODE_CFLAG Specifies the display operation flag.
Enables the replacement of the JIS ruled line/98 ruled line with the FANUC
CFLAG_KEISEN
ruled line.
Sets the display language to simplified Chinese characters. For details, see
CFLAG_GBCODE Section 5.11, "Display of Simplified Chinese messages" in Part II,
"PROGRAMMING", later.
Sets the display language to Russian. For details, see Section 5.12
CFLAG_CYRILLIC
"Display/acquisition of Russian messages" in Part II, "PROGRAMMING", later.
Sets the display language to Turkish. For details, see Section 5.12
CFLAG_TURKISH
"Display/acquisition of Turkish messages" in Part II, "PROGRAMMING", later.
The expression "with n lines of space left from the top" in a VGA display indicates the
position of 25 lines (or 16 lines) of the display area relative to the entire screen
(30 lines or 19 lines).
n lines of
30 lines
25 lines
(19 lines) Display area
(16 lines)
- 877 -
3.Function References PROGRAMMING B-64303EN-3/01
- 878 -
B-64303EN-3/01 PROGRAMMING 3.Function References
When this function is executed, the console driver is initialized. Since the settings
related to the CRT are cleared, make settings again as needed. If this function is
executed during graphic display, the graphic display is also initialized.
This is equivalent to the _setvideomode function with "Text mode" specified.
- 879 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.6 Switch to CNC screen. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_cncscrn
[Syntax]
#include <crt.h>
int crt_cncscrn( int index ) ;
[Arguments]
index Index number of the CNC screen to be switched to.
[Return]
Returns zero if successful. If not, returns one of following values and sets the same
value in the global variable "errno".
[Description]
Changes into the CNC screen which is specified by the application program. Also execution
of program is switched from the application task to the CNC task. This is the same
operation as switching to CNC
screen by pressing of the function keys on MDI panel.
The CRT display will be switched into the specified CNC screen by the successful calling
of this function.
At the same time, the control of software will be switches to the CNC side, and then,
the application program is put into sleep state.
When the screen will be changed from the CNC side into the user's screen again, the
application program will restart from the next instruction to this function call.
Specify the screen index numbers in "index" with the following format.
Refer the screen index number list of "Get current screen index(crt_getcurscrn)" for
index numbers of each screens. All available index values are defined in crt.h as
"CRT_xxx_xxx".
It is possible to switch to any user's screen by specifying the index number of the user
screen.
[Example]
The following program changes into "PROGRAM CHECK" screen if the current mode is "MEM".
- 880 -
B-64303EN-3/01 PROGRAMMING 3.Function References
#include <crt.h>
#include <data.h>
#include <fwindow.h>
- 881 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.7 Output character by FANUC character code. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_fchar
[Syntax]
#include <crt.h>
int crt_fchar( unsigned int code ) ;
[Arguments]
code FANUC character code ( 0x0000 through 0x1fff ),
or FANUC character code | 0x8000 (0x8000 through 0x9fff).
[Return]
Returns always zero.
[Description]
Outputs a character that is included in FANUC character set and is specified by FANUC
character code on the current cursor position.
A character which is specified by FANUC character code is displayed on the current cursor
position. In case that (FANUC code | 0x8000) is specified, the function works as follows.
This function works like putchar() function except character code format.
That is, displaying a half-size character on the current cursor position with the
specified character attribute, and then forwarding a cursor for one character.
- 882 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program displays the specified integer value using bold numeric characters.
#include <crt.h>
#include <stdio.h>
#include <string.h>
- 883 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.8 Customize softkey on CNC screen. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_setuserskey
[Syntax]
#include <crt.h>
int crt_setuserskey( unsigned int index, unsigned int num,
struct user_softkey *skey ) ;
struct user_softkey {
unsigned int index ; /* Softkey index number. */
int op ; /* Operation code. */
unsigned int submode ; /* Small classification of */
/* user's screen. */
unsigned int *string ; /* Display string. */
} ;
[Arguments]
index Softkey table index number to be customized.
num Number of customizing item.
skey Customizing data table.
[Return]
Returns zero if successful. If any error, returns -1 and sets the following error code
in the global variable "errno".
EUSKEY Incorrect softkey table index number "index" or softkey index number
"skey.index".
[Description]
Alters the softkey displayed on the CNC screen as follows, adds new items, by which any
user screens are selected, moves the existent items, by which the CNC screens are selected,
deletes the existent items.
- 884 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Softkey index number is the sequential number for each softkey tables.
For example, the following sequential numbers are assigned to the softkeys on the POSITION
screen.
Specify the small classification number of the screen which is selected by the specified
softkey in "submode" when the operation code is "SKEY_OP_USER".
"submode" is not referenced when the operation code is "SKEY_OP_DEL" or moving softkey.
Specify display string of the softkey in "string" by FANUC code when the operation code
is "SKEY_OP_USER". The maximum string length is 12 characters (6 characters x 2-line).
Register the small classification number of the screen which is specified in "submode"
as the user's screen using "crt_setuserscrn" function when "SKEY_OP_USER" is specified.
- 885 -
3.Function References PROGRAMMING B-64303EN-3/01
Display item
submode (hexadecimal) index (decimal)
POSITION
ABSOLUTE RELATIVE ALL HANDLE
0x01 1 0x02 2 0x03 3 0x04 4
MONITOR
0x06 6
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 11 0x33 12 0x34 13 0x35 14 0x36 15
PROGRAM
MDI mode
PROGRAM CURRENT
0x01 1 0x13 3
RESTART
0x08 6
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 11 0x33 12 0x34 13 0x35 14 0x36 15
MEM/RMT mode
PROGRAM CURRENT
0x01 1 0x13 3
RESTART
0x08 6
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 11 0x33 12 0x34 13 0x35 14 0x36 15
- 886 -
B-64303EN-3/01 PROGRAMMING 3.Function References
EDIT mode
PROGRAM
0x01 1
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 11 0x33 12 0x34 13 0x35 14 0x36 15
HND/REF/JOG mode
PROGRAM CURRENT
0x01 1 0x13 3
RESTART
0x08 6
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 11 0x33 12 0x34 13 0x35 14 0x36 15
THND/TJOG mode
PROGRAM
0x01 1
RESTART
0x08 6
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 11 0x33 12 0x34 13 0x35 14 0x36 15
- 887 -
3.Function References PROGRAMMING B-64303EN-3/01
OFFSET/SETTING
OFFSET SETTING WORK
0x01 1 0x02 2 0x03 3
MACRO MENU OPERATE PANEL TOOL LIFE
0x06 6 0x07 7 0x08 8 0x09 9
Y OFFSET WORK SHIFT TOOL FORM BARIER
0x0b 11 0x0c 12 0x0d 13 0x15 14
PRECI LEVEL TL GEOM SIZE
0x11 17 0x0e 19
LANGUAGE PROTECT GUARD
0x16 22 0x17 23 0x18 24
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 26 0x33 27 0x34 28 0x35 29 0x36 30
- 888 -
B-64303EN-3/01 PROGRAMMING 3.Function References
SYSTEM
PATAMETER DIAGNOSIS SYSTEM
0x01 1 0x02 2 0x04 4
PITCH ERROR SERVO PARAM SPINDL SETING
0x07 7 0x08 8 0x09 9
WAVE DIAG ALL IO MCODE GROUP OPERAT HISTRY
0x18 11 0x11 12 0x25 13 0x13 14
PMC MAINTE PMC LADDER PMC CONFIG PMM
0x0b 16 0x0c 17 0x0d 18 0x1d 19
COLOR MAINTE MAINTE INFO
0x15 21 0x16 22 0x17 23
TOUCH PANEL FSSB PRMTUN
0x1a 26 0x1b 27 0x1c 28
EMBED PORT PCMCIA LAN ETHER BOARD
0x1f 31 0x20 32 0x21 33
- 889 -
3.Function References PROGRAMMING B-64303EN-3/01
MESSAGE
ALARM MESSAGE HISTRY
0x01 1 0x02 2 0x03 3
MESSAGE
HISTRY SYSALMHIS
0x04 7 0x0a 8
EMBED LOG PCMCIA LOG BOARD LOG
0x06 11 0x07 12 0x08 13
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 16 0x33 17 0x34 18 0x35 19 0x36 20
GRAPH
PARAMETER GRAPH GRAPH ZOOM
0x01 1 0x02 2 0x03 3 0x04 4
PARAMETER EXEC POS
0x06 6 0x07 7 0x09 9
PARAMETER EXEC
0x0b 11 0x0d 13
PARAMETER 3-PLN
0x10 16 0x11 17
PARAMETER GRAPH ZOOM
0x15 21 0x17 23 0x18 24
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 26 0x33 27 0x34 28 0x35 29 0x36 30
- 890 -
B-64303EN-3/01 PROGRAMMING 3.Function References
CUSTOM
TMAC1 TMAC2 TMAC3
0x01 1 0x02 2 0x03 3
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 6 0x33 7 0x34 8 0x35 9 0x36 10
CUSTOM2
CEXE CEXE2 CEXE3 CEXE4 CEXE5
0x32 1 0x33 2 0x34 3 0x35 4 0x36 5
- 891 -
3.Function References PROGRAMMING B-64303EN-3/01
The display string of the softkey must be defined by FANUC code when softkey item is
customized using this function. For FANUC character codes, see Appendix C, "Character
Code List".
(1) Define array of "int" type(or "unsigned int" type). The total number of elements is 12( 6
characters × 2-line). The exceeded elements are ignored.
[Example]
This is procedure to customize the softkey of POSITION screen as follows.
- 892 -
B-64303EN-3/01 PROGRAMMING 3.Function References
#include <crt.h>
- 893 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.9 Set switching method between CNC's screen and user's. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_setswt
[Syntax]
#include <crt.h>
unsigned int crt_setswt( unsigned int mode ) ;
[Arguments]
mode Screen switching mode.
[Return]
Returns the old setting value.
[Description]
Set switching method such as, disable/enable to switch to the CNC screen from the user's,
disable/enable to output video signal at switching to the user screen from the CNC's.
- 894 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Setting by this function goes on being effective until this function will be called newly.
"CRT_SWT_DIS" disables switching to the CNC screen by MDI key operation, so take care
of usage of this function.
Under condition that "CRT_SWT_DIS" is set, also screen switching by "crt_cncscrn"
function is disabled.
Under condition that "CRT_SWT_VOFF" is set, nothing is displayed on the screen after
screen switching from the CNC screen to the user's until the application program enables
video beam output. Output escape sequence "ESC [>9l" to console, or clear whole screen
by "ESC [2J" to enable beam output.("ESC [2J" enables video beam output.]
Under condition that "CRT_SWT_MFKY" is set, the screen switching by the function keys
is disabled. When this bit is set, the user application must read the status of the
function keys using "crt_readfkey" function and switch the screen. This setting is
effective on the CNC's screen.
During the CNC screen is being displayed, execute reading the function keys and switching
the screen in the auxiliary task.
When the application program manages the screen switching with setting this bit ON, set
parameter No.8650#1 CNA as "1" and manages also screen switching at CNC alarm rising
by the application program.
[Example]
The following program disables screen switching, executes foo() function and restores
the original status again.
#include <crt.h>
- 895 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.10 Set scroll area. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_setscrlarea
[Syntax]
#include <crt.h>
int crt_setscrlarea( unsigned int start, unsigned int height ) ;
[Arguments]
start Start line of the scroll area (1 - max line).
height Height of the scroll area (1 - max line).
[Return]
Returns zero if successful.
If any error (for example, the scroll area is out of the screen, etc.),returns "1".
[Description]
Set the scroll area for automatic scrolling by line-feeding.
Only specified scroll area is scrolled by line-feeding by this function. This function
doesn't clear the screen, and doesn't change the current cursor position.
The scroll area which is specified by this function is effective to both automatic
scrolling by line-feeding and scroll-up/scroll-down by escape-sequence ("ESC [nL", "ESC
[nM").
[Example]
The following program sets the scroll area in 2 through 24th line.
(The top line and the bottom line are not scrolled.)
#include <crt.h>
- 896 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.11 Open graphic display. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_opengr
[Syntax]
#include <crt.h>
int crt_opengr( void ) ;
[Arguments]
------
[Return]
Returns "0" or "1" if successful.
If any error (Graphic board is not equipped, or the graphic function option is not set.),
returns "-1".
The difference between return code "0" and "1" is as follows.
[Description]
Acquire authorization to use graphic display and become ready for the graphic display.
After the execution of this function, screen switching is disabled until crt_closegr()
function is executed.
Calling crt_setswt(CRT_SWT_GREN) prior to crt_opengr() enables screen switching while
graphics display is open.
- 897 -
3.Function References PROGRAMMING B-64303EN-3/01
When screen is switched from the user screen to the CNC screen while displaying
application graphics, graphic display to the display unit is disabled (BEAM OFF). However,
the graphics drawn by the user application program is retained as is, provided no graphic
screen is displayed by CNC. When screen is switched back to the user screen, the function
crt_opengr() returns the value '0' if graphics is retained.
But , to re-display the graphics on the CRT, beam should be made on by the function
crt_graphic(). If the "CRT_SWT_GRON" bit is set by the crt_setswt() function, "BEEM
ON" is automatically done when returned from the CNC screen to the user screen.
[Example]
Following program draws a line defined by two specified end points.
#include <crt.h>
#include <graph.h>
- 898 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.12 Close graphic display. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_closegr
[Syntax]
#include <crt.h>
void crt_closegr( void ) ;
[Arguments]
------
[Return]
------
[Description]
Stop using graphic display and become ready to release authorization for graphic display.
By calling this function, access to the graphic display function from the user application
program is disabled, and no user graphics display can be done until the crt_opengr()
function is called again. This function, at the same time, enables screen switching,
and the screen switching which has been suspended during open graphic display mode is
executed after the execution of this function.
This function does not always release authorization for graphic display at it's execution.
If there are no other application programs requiring authorization for graphic display
when this function is called, this function only prepares for releasing the authorization
of graphic display.
[Example]
Refer to the example of "Open graphic display (crt_opengr)".
- 899 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.13 Enable or disable graphic display. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_graphic
[Syntax]
#include <crt.h>
int crt_graphic( int mode ) ;
[Arguments]
mode Specify graphic output ON or OFF.
[Return]
Returns zero if successful and returns non zero if any error (graphic
function is not ready for use).
[Description]
Specify whether to display graphics on the CRT or not (GRAPHIC BEAM ON or OFF).
This function controls whether the graphics drawn by the user application program is
displayed on the display unit or not , and has no effect on the display of characters,
while BEAM ON/OFF command by using the escape sequences, "ESC [>9l"/"ESC [>9h", affects
both graphics and characters.
Graphics can be drawn even while the display of the graphics to the display unit is
disabled.
The default state of the "GRAPHIC BEAM" right after the graphic screen is initialized
(i.e. when returned from the "_setvideomode" function) is "ON".
Screen switching from the user screen to the CNC screen automatically turns the "GRAPHIC
BEAM" off. After switching the screen to the user's again, turn the "GRAPHIC BEAM" on
by this function to get graphic display on the display unit.
- 900 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
Following program tests the current screen, and turns the "GRAPHIC BEAM" on if it is
POSITION display screen. Turns the "GRAPHIC BEAM" off if else.
#include <crt.h>
- 901 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.14 Read the status of function keys. <Main,Alarm>
------------------------------------------------------------------------------------------
[Name]
crt_readfkey
[Syntax]
#include <crt.h>
int crt_readfkey( void ) ;
[Arguments]
------
[Return]
Returns zero if no function keys are depressed or CRT_SWT_MFKY bit of the "crt_setswt"
function is set to "0". When CRT_SWT_MFKY bit is set to "1", keycode for the
function key being depressed is returned.
Keycodes are shown below.
[Description]
This function reads the status of the function keys on the MDI panel, and is used by
the user application program to switch screens according to the status of the function
keys.
When reading the status of the function keys, set "CRT_SWT_MFKY" bit of the crt_setswt()
function to "1". This disables the ordinary screen switching caused by the function keys.
User application program reads the status of the function keys by means of this function
and switch the screens by using crt_cncscrn() function.
- 902 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
Following is a sample program which, when a function key is pressed, switches the screen
to the corresponding CNC screen.(Execute as auxiliary task)
#include <crt.h>
#include <oscall.h>
for (;;) {
os_wait_tim( 5 ) ; /* run every 40msec */
curscrn = crt_getcurscrn() ; /* get current screen index */
/* number */
savescrn[curscrn % 0x100] = curscrn ;
/* save index including small classification */
/* if function key is pressed */
if ( fkey = crt_readfkey() ) {
/* restore previous small classification number */
newscrn = savescrn[fkey - MDIKEY_POS] ;
if ( newscrn != curscrn ) {
crt_cncscrn( newscrn ) ;
crt_setswt( CRT_SWT_MFKY ) ;
}
}
}
}
- 903 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.15 Display the secondary cursor. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_2ndcursor
[Syntax]
#include <crt.h>
int crt_2ndcursor( unsigned int attrib, unsigned int start,
unsigned int end, unsigned int position,
unsigned int width ) ;
[Arguments]
attrib cursor attribute
start cursor start raster
end cursor end raster
position cursor position
width cursor width
[Return]
Returns zero if successful and returns "-1" if any error( invalid argument).
[Description]
The crt_2ndcursor() sets cursor display ON/OFF or other attributes for the 2nd cursor.
The 2nd cursor is a cursor which can freely be controlled by the user application program
independent of the usual character cursor.
The 2nd cursor is set to OFF(non display) state, after the screen is initialized by
crt_swtmode() function or "ESC [2J". Other than these two methods, crt_2ndcursor() is
the only means to control ON/OFF of the 2nd cursor.
- 904 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Specifiable
argument
range
start 0 to 15
end
0 to 15
(must satisfy end>=start)
position 0 to 2399
width 1 to 80
[Example]
Following program modifies the specified lines to be underlined.
#include <crt.h>
- 905 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.16 Set attribute of characters on VRAM. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_settextattr
[Syntax]
#include <crt.h>
int crt_settextattr( unsigned int y1, unsigned int x1,
unsigned int y2, unsigned int x2,
unsigned int attr, unsigned int op ) ;
[Arguments]
y1 Line number of the upper-left position of the
attribute setting region.
x1 Column number of the upper-left position of the
attribute setting region.
y2 Line number of the lower-right position of the
attribute setting region.
x2 Column number of the lower-right position of the
attribute setting region.
attr Set attribute value.
op Logical operation specification.
[Return]
Returns zero if successful. If any error (incorrect coordinate spec or incorrect logical
operation spec), returns non-zero value.
- 906 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Description]
Sets the specified attributes to the characters displayed on the screen.
This function doesn't change the already displayed character1 code but changes only its
attributes.
Specify line and column number of the upper-left and the lower-right position in "y1",
"x1" and "y2", "x2". (The upper-left position of the screen is (1st-column, 1st-line).)
(y1, x1)
(y2, x2)
(ymax, xmax)
ymax=30, xmax=80
This function changes the attributes of all characters included in the rectangle region
specified by y1,x1,y2,x2.
15 8 7 0
0 0 0 Ib Bb Gb Rb I B G R r b 0 0 0
B: Blue r: Reverse
G: Green b: Blink
R: Red
I: Low intensity
Bb: Background Blue
Gb: Background Green
Rb: Background Red
Ib: Background Low intensity
- 907 -
3.Function References PROGRAMMING B-64303EN-3/01
Actually, 4-bits of "IRGB" and "IbRbGbBb" indicate the palette index number of character
and background.
[Example]
The following program makes the top line of the screen "REVERSE" for a moment.
#include <crt.h>
- 908 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.17 Get attribute of character on VRAM. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_gettextattr
[Syntax]
#include <crt.h>
unsigned int crt_gettextattr( unsigned int y, unsigned int x ) ;
[Arguments]
y Line position of the character to be got the attribute.
x Column position of the character to be got the attribute.
[Return]
Returns the attribute of the character at the specified position.
If incorrect position specification, returns -1.
[Description]
Gets the attribute of the character at the specified position.
Specify line and column position of the character to be got the attribute in "y" and
"x". (The top-left position of the screen is (1st-column, 1st-line).)
[Example]
The following program reads the attribute of the character at (3rd-line, 30th-column)
of the screen.
#include <stdio.h>
#include <crt.h>
attr = crt_gettextattr( 3, 30 ) ;
printf( "attribute is 0x%04X\n", attr ) ;
}
- 909 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.18 Set color palette of VGA characters. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_setpalette
[Syntax]
#include <crt.h>
#include <graph.h>
int crt_setpalette( unsigned int index, unsigned long color ) ;
[Arguments]
index Index of color palette. (0..15,_PAL_COMP,_PAL_RVS)
color Color value.
[Return]
Returns zero if successful. If any error (incorrect color palette index or not a VGA
display device), returns non-zero value.
[Description]
Sets the color value to the color palette for character.
Specify the color palette index number (0..15) in "index" and the color value in "color".
The format of the color value specified in "color" is same as the color value used in
a graphic function "_remappalette". (The symbols of the color value defined in the header
file "graph.h" such as _98GREEN are available for "color"'s specification.)
32 0
0 0 0 0 0 0 0 0 0 0 B B B B B B 00GGGGGG 0 0 R R R R R R
Each data mean the intensity of each color in range 0x00 - 0x3F.
The larger value means more intensity color.
The color values of each palettes are initialized at the application start-up as follows.
(System initial values)
- 910 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Once "low intensity (dark)" mode is set by "ESC [1m" or "ESC [3m", all of the following
color specifications are assumed to be low intensity. For example,
this displays
To display normal intensity color after once low intensity mode was specified, cancel
low intensity mode positively. (similarly about background color.)
For LCD device, the lower 2 bits of each color are masked. That is,0x00,0x04,0x08,..,0x3C
are valid setting value for each color.
Even if the application program specifies "1" at the lower 2 bits, the VGA firmware masks
them.(In this case, max.4,096 colors are representable.)
- 911 -
3.Function References PROGRAMMING B-64303EN-3/01
The color values set by the C application program are effective to only the C user screen.
The other screens such as the CNC's screen are not affected by this setting. Similarly,
the color setting in the other screens are not effective to the C user screen. The color
palettes used for graphics are different from the palettes for characters, they are not
affected by this function's setting.
Use "remappalette" or "_remapallpalette" function to set the color palettes for graphics.
It is possible to set the priority of the palette of characters and graphics by specifying
"_PAL_COMP" in "index". In this case, specify the palette priority in "color".
"Composite" means that the intensity of each color of character and one of graphic pixel
are mixed. (logical OR). For example, in case that
This table indicates that the palette index 0 is the special part for overlapping the
character and the graphics. Allocate "Black" to the palette 0 as same as initial value
so far as there are no exceptional reasons.
- 912 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.19 Set all color palette of VGA characters. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_setallpalette
[Syntax]
#include <crt.h>
#include <graph.h>
int crt_setallpalette( unsigned long *colors ) ;
[Arguments]
colors Pointer to the color value array.
[Return]
Returns zero if successful. If any error (not a VGA display device),
returns non-zero value.
[Description]
Sets the color values to the all color palette for character.
Store 16 color values in "color". The format of the color value is same as data used
in "crt_setpalette" function.
This function stores 16 color values to the all 16 color palettes, and set the palette
priority as "Composite".
This function doesn't affect the color palettes of the other screen and the color palettes
of graphics.
All palettes are set as the system initial values by specifying NULL in "color". The
system initial values are listed in the description of "crt_setpalette" function.
- 913 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.20 Get color palette of CNC screen. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_getcncpalette
[Syntax]
#include <crt.h>
int crt_getcncpalette( unsigned long *cnccol ) ;
[Arguments]
cnccol Color palette table of CNC screen. (32 elements)
[Return]
Returns zero if successful. If any error (one of following cases),
returns non-zero value.
- Not VGA display device.
[Description]
Gets the color palette setting values of the CNC screen.
This function is used to display the user's screen with the same color as the CNC's screen
or to get the colors of the base CNC screen by the window task.
The color palette values of the CNC screen are stored in "cnccol" as follows
crt_setallpalette( &cnccol[0] ) ;
_remapallpalette( &cnccol[16] ) ;
Take care of palette index handling when VGA window screen is overlapped on any CNC screen
by the window task.
- 914 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program sets all color palettes as same as the CNC's screen.
#include <crt.h>
#include <graph.h>
if ( !crt_getcncpalette( cnccol ) ) {
crt_setallpalette( &cnccol[0] ) ;
_remapallpalette( &cnccol[16] ) ;
}
}
- 915 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.21 Output character string by FANUC character code. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_fstr
[Syntax]
#include <crt.h>
int crt_fstr( unsigned int *code, unsigned int len ) ;
[Arguments]
code Array of FANUC character code ( 0x0000 - 0xffff ).
len Length of the character string.
[Return]
Returns always zero.
[Description]
Outputs a character string that is included in FANUC character set and is specified by
FANUC character code on the current cursor position.
Store "len" of FANUC code (16-bit) for each half-size character in an array "code".
Store the character string length in "len".
unsigned int i ;
for ( i = 0 ; i < len ; i++ )
crt_fchar( code[i] ) ;
[Example]
The following program displays an icon of a tester on the current cursor position.
#include <crt.h>
- 916 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1.22 Get text data from VRAM. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_gettextimg
[Syntax]
#include <crt.h>
int crt_gettextimg( unsigned int y1, unsigned int len x1,
unsigned int y2, unsigned int len x2,
unsigned long *buf ) ;
[Arguments]
y1 Left, upper position of the area from where characters are got.
x1 Left, lower position of the area from where characters are got.
y2 Right, lower position of the area from where characters are got.
x2 Right, upper position of the area from where characters are got.
buf Area that characters data are stored.
[Return]
Returns zero when terminated normally, not zero when error, i.e. specified coordinates
is not correct, is occurred.
- 917 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Gets character codes, displayed on the screen, with their attribute.
This function is used with the function "crt_puttextimg" to backup or restore the text
image on the screen.
y1,x1 is top, left, y2,x2 is bottom, right position of the area from where characters
are got as follows.(The top of left side shows raw-1, and column-1.)
(y1, x1)
(y2, x2)
(ymax, xmax)
ymax=30, xmax=80
All character codes and their attributes, included the rectangular area that is enclosed
by (y1,x1)-(y2,x2),can be got.
(The characters which are enclosed in above area)*4 bytes area must be reserved as "BUF".
The data form, stored in "BUF", is as follows.
The character code is FANUC character code, and the type of the attribute is explained
the same as that of "crt_settextattr".
The position on the memory is corresponding to the position on the screen as follows.
- 918 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program backs up and restores the displayed characters of upper 3 rows
on the 10.4 inch LCD screen.
#include <crt.h>
#include <stdlib.h>
- 919 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.23 Put text data into VRAM. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_puttextimg
[Syntax]
#include <crt.h>
int crt_puttextimg( unsigned int y1, unsigned int len x1,
unsigned int y2, unsigned int len x2,
unsigned long *buf, unsigned int op ) ;
[Arguments]
y1 Left,upper position of the area where characters are put.
x1 Left,lower position of the area where characters are put.
y2 Right, lower position of the area where characters are put.
x2 Right, upper position of the area where characters are put.
buf Area that characters data are stored.
op The way to put characters or attributes into VRAM.
[Return]
Returns zero when terminated normally, not zero when error, i.e.
specified coordinates is not correct, is occurred.
[Description]
Puts character codes on the screen, with their attribute.
This function is used with the function "crt_gettextimg" to back up or restore the text
image on the screen.
y1,x1 is top, left, y2,x2 is bottom, right position of the area into where characters
are put.(The top of left side shows raw-1, and column-1.)
This position specification is same as "crt_gettextimg" function.
Character codes and their attributes are read out from "buf" where is regarded that the
data, got by "crt_gettextimg" function, exist. The data, got by "crt_gettextimg" function,
is put on the screen usually but it is also possible to put originally prepared data
if they have the same type as the data, got by "crt_gettextimg" function. It is possible
to put the data, got by "crt_gettextimg" function, into the different area from where
they are got, if the size of the rectangular area is the same.
- 920 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Put data is selected from character codes or attributes or both of them by "op" as follows.
op Put Data
0 Character codes and attributes
1 Character codes
2 Attributes
When either characters or attributes are put on the screen, the attributes or character
codes originally present in the rectangular area on the screen are kept as is.
[Example]
The following program makes the characters and attributes that are displayed on the
specified area to move to right by 3 digits.
#include <crt.h>
#include <stdio.h>
#include <stdlib.h>
- 921 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.24 Select graphic page to use. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_setgraphpage
[Syntax]
#include <crt.h>
int crt_setgraphpage( int page ) ;
[Arguments]
page Graphic page number to use. (0, 1 or -1)
[Return]
Returns zero if successful.
If any error (i.e. invalid page number was specified),returns non-zero value.
[Description]
Select graphic page to use for graphic drawing.
The graphic system of Series 0i-D has two pages for graphic drawing.
"_setactivepage" and "_setvisualpage" functions select graphic page for drawing and
displaying.
"_setvideomode" function initializes both two pages.
This function selects the page that is initialized by "_setvideomode" function. Specify
one of 0, 1 and -1 in "page".
Each value means as follows.
When "_setvideomode" function initializes one of page #0 and #1, the contents of the
other page are kept.
This function affects only behavior of "_setvideomode" function which is called after
calling of this function. Even if any value is specified by this function, you can
specify an arbitrary page number in "_setactivepage" and "_setvisualpage" function.
By calling this function with "page=1", both drawing and displaying pages are set as
#1 after calling "_setvideomode" function. With "page=0" or "page=-1", both drawing and
displaying page are #0.
- 922 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program draws graphics using only graphic page #1.
#include <crt.h>
#include <graph.h>
crt_closegr() ;
}
- 923 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1.25 Select drawing method of 6x sized character. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_set6chmode
[Syntax]
#include <crt.h>
int crt_set6chmode( int mode ) ;
[Arguments]
mode Drawing method of 6x sized character.
0: High speed mode
1: Complete mode
[Return]
0 Successful.
1 Invalid value (other than 0 and 1) is specified.
2 Ineffective in the current display mode.
[Description]
Selects drawing method of 6x sized character.
This function selects the drawing method of 6x sized character that is displayed over
"CNC screen display function" application program on PC side of Series 0i-D.
Specify one of the followings.
* The text window displayed by "win_***" functions overlaps 6x sized characters drawn
over the base screen.
In this case, any elements of 6x sized character which adjoins the window border may
not be drawn correctly. To avoid this, select "Complete mode" by this function.
- 924 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Setting by this function is effective to all 6x sized character drawing until terminating
the current "CNC screen display function" session.
[Remarks]
This function is available only with the CNC screen display function at the PC side on
the Series 0i-D system.
- 925 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.1 Open window. <Main>
------------------------------------------------------------------------------------------
[Name]
win_open
[Syntax]
#include <crt.h>
whandle win_open( winfo *spec, char *title, int flag ) ;
[Arguments]
spec window geometry(position& size) structure
title window title string
flag window attribute
[Return]
Returns window handle if successful.
When failed, returns "-1" and sets following error code to the global variable "errno".
[Description]
Creates new window on the screen.
A window of the specified size is created and placed on the screen at the specified
position.
- 926 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Values set for each member of the structure "spec" are as follows.
□ window
↑
(posl, posc)
sizev
sizeh
↑
Window frame
←Line N
↑ ↑
Column 1 Column M
N=30, M=80
Specify window title string by the argument "title". The length of the window title string
should be less than 32 single byte characters.
(single byte alpha-numeric and Katakana characters, symbols and double byte
alpha-numeric, Hirakana, Kanji characters and symbols can be used.)
- 927 -
3.Function References PROGRAMMING B-64303EN-3/01
A new window is placed over existing windows and both screen output and key input are
bound to this window (active window).
When new window is opened, cursor is placed on the upper-left corner (home position)
of the window and cursor display attribute is set to non-display state.
While more than one windows are open, access to the screen areas other than window areas
is disabled. Generally, full screen should be cleared before opening the first window,
or the first window should be full-screen window. When opening windows over the usual
screen display, display the base usual screen in the full-screen window.
Calling this function at the start of the application program as shown in the following
example will do this.
winfo mainwin ;
whandle win_main ;
mainwin.posl = 2 ;
mainwin.posc = 2 ;
mainwin.sizev = 23 ;
mainwin.sizeh = 78 ;
win_main = win_open( &mainwin, "Main Window", WIN_F_FULL ) ;
- 928 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.2 Close window. <Main>
------------------------------------------------------------------------------------------
[Name]
win_close
[Syntax]
#include <crt.h>
int win_close( void ) ;
[Arguments]
------
[Return]
Returns zero if successful.
When failed, returns "-1" and sets following error code to the global variable "errno".
[Description]
Close active window.
When the last window is closed, screen display returns to the default screen state where
no windows are open. Otherwise, the window underneath the closed window become active
and whole screen is redrawn.
- 929 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.3 Select window. <Main>
------------------------------------------------------------------------------------------
[Name]
win_select
[Syntax]
#include <crt.h>
int win_select( whandle handle ) ;
[Arguments]
handle window handle of the window to be selected
[Return]
Returns zero if successful.
When failed, returns "-1" and sets following error code to the global variable "errno".
[Description]
Select one of the open windows on the screen for display window.
After this function is called and a window is selected, all succeeding screen output
is drawn on the selected window.
This function does not change the overlapping order of the window.
When window is selected by this function, former cursor position of that window is
restored.
- 930 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.4 Activate window. <Main>
------------------------------------------------------------------------------------------
[Name]
win_activate
[Syntax]
#include <crt.h>
int win_activate( whandle handle ) ;
[Arguments]
handle window handle for the window to be activated
[Return]
Returns zero if successful.
When failed, returns "-1" and sets following error code to the global variable "errno".
[Description]
Select one of the open windows on the screen for keyboard input.
After this function is called, succeeding input from MDI keyboard is valid only while
the window is selected for display by win_select().
This function changes the overlapping order of the windows so that the selected window
comes on top of other windows.
- 931 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.5 Move window. <Main>
------------------------------------------------------------------------------------------
[Name]
win_move
[Syntax]
#include <crt.h>
int win_move( int dy, int dx ) ;
[Arguments]
dy vertical displacement
dx horizontal displacement
[Return]
Returns zero if successful. When failed, returns "-1" and sets
following error code to the global variable "errno".
[Description]
Move active window .
Whole screen is redrawn after the window is moved. Overlapping order does not change.
Displacement value which would cause whole or a part of the window to be off the screen
cannot be specified.
- 932 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.6 Alter window size. <Main>
------------------------------------------------------------------------------------------
[Name]
win_size
[Syntax]
#include <crt.h>
int win_size( int dy, int dx ) ;
[Arguments]
dy vertical expansion/reduction value
dx horizontal expansion/reduction value
[Return]
Returns zero if successful.
When failed, returns "-1" and sets following error code to the global variable "errno".
[Description]
Change active window size.
Window size expansion or reduction takes place so that the bottom or the right side border
is moved by the specified value relative to the upper-left corner of the window.
The size expansion value which would cause a part of the window to be off the screen
cannot be specified. Also the size reduction value which would shrink the window less
than the size of 1 line/1 column cannot be specified.
- 933 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.7 Let active window be full screen size. <Main>
------------------------------------------------------------------------------------------
[Name]
win_full
[Syntax]
#include <crt.h>
int win_full( void ) ;
[Arguments]
------
[Return]
Returns zero if successful.
When failed, returns "-1" and sets following error code to the global variable "errno".
[Description]
Let the size of the active window be full screen size.
- 934 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.8 Let active window be window size. <Main>
------------------------------------------------------------------------------------------
[Name]
win_window
[Syntax]
#include <crt.h>
int win_window( void ) ;
[Arguments]
------
[Return]
Returns zero if successful.
When failed, returns "-1" and sets following error code to the global variable "errno".
[Description]
Active full screen window is shrunk to be a normal window.
Size and position of the shrunk window is that of original window before being expanded
to be full size window.
- 935 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.9 Get window information. <Main>
------------------------------------------------------------------------------------------
[Name]
win_info
[Syntax]
#include <crt.h>
int win_info( whandle handle, winfo *spec ) ;
[Arguments]
handle window handle of the target window
spec pointer to the window geometry(size&position) structure
[Return]
Returns zero if successful. When failed, returns "-1" and sets
following error code to the global variable "errno".
[Description]
Get the position and size of the specified window. Position and size is set to the
corresponding member of the structure "spec".
- 936 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.10 Set color of window frame and title string. <Main>
------------------------------------------------------------------------------------------
[Name]
win_col
[Syntax]
#include <crt.h>
void win_col( int colf, int colt, int colh,
int colfa, int colta, int colha ) ;
[Arguments]
colf window frame color
colt window title color
colh window handle color
colfa active window frame color
colta active window title color
colfa active window handle color
[Return]
------
- 937 -
3.Function References PROGRAMMING B-64303EN-3/01
[Description]
Set color for window frame and window title string.
15 8 7 0
0 0 0 Ib Bb Gb Rb I B G R r b 0 0 0
Actually, 4-bits of "IRGB" and "IbRbGbBb" indicate the palette index number of character
and background.
Colors and attributes set by this function are applied to the window frames, titles or
window handles which are displayed after this function call. Colors or attributes of
those already displayed when this function is called is not affected. To change them,
redraw the window by calling functions to move, change size or hide/show the window.
- 938 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.11 Hide window. <Main>
------------------------------------------------------------------------------------------
[Name]
win_hide
[Syntax]
#include <crt.h>
int win_hide( whandle handle ) ;
[Arguments]
handle window handle for the window to be hidden
[Return]
Returns zero if successful. When failed, returns "-1" and sets
following error code to the global variable "errno".
[Description]
Win_hide() hides specified window.
- 939 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.12 Show window. <Main>
------------------------------------------------------------------------------------------
[Name]
win_show
[Syntax]
#include <crt.h>
int win_show( whandle handle ) ;
[Arguments]
handle window handle of the window to be hidden
[Return]
Returns zero if successful. When failed, returns "-1" and sets
following error code to the global variable "errno".
[Description]
Windows hidden by win_hide() function become visible by this function.
- 940 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.13 Set window title string. <Main>
------------------------------------------------------------------------------------------
[Name]
win_setttl
[Syntax]
#include <crt.h>
int win_setttl( whandle handle, char *title ) ;
[Arguments]
handle window handle of the window whose title string is to
be changed
title window title string
[Return]
Returns zero if successful. When failed, returns "-1" and sets
following error code to the global variable "errno".
[Description]
Change title string for a window.
The length of the window title string should be less than 32 single byte characters.
(single byte alpha-numeric and Katakana characters, symbols and double byte
alpha-numeric, Hiragana, Kanji characters and symbols can be used.)
- 941 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2.14 Set window frame line character. <Main>
------------------------------------------------------------------------------------------
[Name]
win_setfrm
[Syntax]
#include <crt.h>
void win_setfrm( unsigned int *frame ) ;
[Arguments]
frame character code array which defines window frame line style
[Return]
------
[Description]
Set user defined line style for window frame.
Set the FANUC character code for each window frame line to the argument "frame" in the
following order(horiz.-0, horiz.-1,vert.-2, vert.-3, upper-left corner-4......).
[4]-----[0]-----[6]
| |
| |
[2] [3]
| |
| |
[5]-----[1]-----[7]
For example, following character cord array is to be specified to set usual frame line.
Window frame lines set by this function are applied to the windows which are opened with
WIN_F_FRM3 attribute after this function call.
Frame lines of those windows already opened with WIN_F_FRM3 attribute are changed to
the specified style when they are redrawn.
The line style set by this function is applied to all windows with WIN_F_FRM3 attribute.
- 942 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.15 Get window display status. <Main>
------------------------------------------------------------------------------------------
[Name]
win_getstat
[Syntax]
#include <crt.h>
void win_getstat( struct winstat *stat ) ;
struct winstat {
whandle selected ; /* Window handle of the
currently selected window*/
whandle active ; /* Window handle of the
currently active window. */
unsigned int numwin ; /* Number of opened window. */
unsigned int winstack[MAX_WIN] ; /* Stacking order of
opened windows. */
} ;
[Arguments]
stat Windows status information.
[Return]
------
[Description]
Gets the current window display status.
The window handle the currently selected window and the currently active window are stored
in each "stat.selected" and "stat.active".
The number of the currently opened windows is stored in "stat.numwin".
The number in "stat.numwin" includes the windows hidden by "win_hide" function. The
stacking order of the all opened windows is stored in "stat.winstack". The handles of
all of the opened windows are stored like this, the window handle of the top window is
stored in "winstack[0]", the next in "winstack[1]".
- 943 -
3.Function References PROGRAMMING B-64303EN-3/01
[1]
[2] Selected
[3]
Active
stat.selected = 1
stat.active = 3
stat.numwin = 3
stat.winstack[0] = 3
stat.winstack[1] = 1
stat.winstack[2] = 2
(stat.winstack[3] and later are undefined.)
When "stat.numwin" = 0, that is, no window is opened, the contents of "selected", "active"
and "winstack" are undefined.
[Example]
The following program tests if the currently active window is selected or not, then,
if not, selects it.
#include <crt.h>
win_getstat( &stat ) ;
if ( ( numwin != 0 ) && ( stat.selected != stat.active ) )
win_select( stat.active ) ;
}
- 944 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2.16 Redraw windows. <Main>
------------------------------------------------------------------------------------------
[Name]
win_redraw
[Syntax]
#include <crt.h>
void win_redraw( void ) ;
[Arguments]
------
[Return]
------
[Description]
Redraws all opening windows.
This function just redraw the opening and displayed window keeping the current window
status (open/close, displayed/hidden, overlapping order of windows).
When the screen has been switched from/to NC side and PC side on "CNC screen display
function", use function to redraw windows.
- 945 -
3.Function References PROGRAMMING B-64303EN-3/01
3-1. scope
User defined character is a character which is defined by machine tool builders. (usually
referred to as extended character) C Language Executor allows the user application program to
define and use extended characters. Up to 256 single byte characters can be defined and registered.
Arbitrary character code in single byte character set dedicated for user defined characters or
in standard JIS Kanji character set can be assigned to the registered extended character.
(1) 10.4-inch color LCD and other equivalent display units (display units which usually use
half-size 80-column x 25-line display)
8 dots 16 dots
| | | |
- -
16 dots 16 dots
- -
2-byte character is composed of two consecutive single byte character patterns.
- 946 -
B-64303EN-3/01 PROGRAMMING 3.Function References
b) Binary notation
c) Example
pattern □□□□□□□□
□□□□□□□□
□□□□□□□□
□□■■■□□□
□■□□□■□□
■□□□□□■□
■□□□□□■□
■□□□□□■□
■■■■■■■□
■□□□□□■□
■□□□□□■□
■□□□□□■□
□□□□□□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
Binary 0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,
notation 0xFE,0x82,0x82,0x82,0x00,0x00,0x00,0x00
- 947 -
3.Function References PROGRAMMING B-64303EN-3/01
pattern □□□□□□□□□□□□□□□□
□□□□□□□■□□□■□□□□
□■■□□■■■■■■■■■□□
□□□■□□□■□□□■□□□□
□□□□□□■■■■■■■□□□
□■■□□□■□□■□□■□□□
□□□■□□■■■■■■■□□□
□□□□□□□□□■□□□□□□
□□□■□□■■■■■■■□□□
□□□■□□□□□■□□□□□□
□□□■□■■■■■■■■■□□
□□■□□□□□■□■□□□□□
□□■□□□□■□□□■□□□□
□■■□□■■□□□□□■■□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
Binary 0x00,0x01,0x67,0x11,0x03,0x62,0x13,0x00,
notation 0x13,0x10,0x17,0x20,0x21,0x66,0x00,0x00,
0x00,0x10,0xFC,0x10,0xF8,0x48,0xF8,0x40,
0xF8,0x40,0xFC,0xA0,0x10,0x0C,0x00,0x00
(2) 8.4-inch color LCD, and other equivalent display units (display units which usually use
half-size 40-column x 16-line display)
25 dots 25 dots
- -
A full-size character consists of two consecutive half-size patterns.
- 948 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Bit order → #7 #0 #7 #0 #7 #0 #7 #0 #7 #0 #7 #0
1 26 1 26 51 76
25 50 25 50 75 100
- 949 -
3.Function References PROGRAMMING B-64303EN-3/01
c) Example
Pattern □□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□■□□□□□□□□
□□□□□□□■□□□□□□□□
□□□□□□■■■□□□□□□□
□□□□□□■■■□□□□□□□
□□□□□■■□■■□□□□□□
□□□□□■■□■■□□□□□□
□□□□□■□□□■□□□□□□
□□□□■■□□□■■□□□□□
□□□□■□□□□□■□□□□□
□□□■■■■■■■■■□□□□
□□□■■□□□□□■■□□□□
□□■■□□□□□□□■■□□□
□□■■□□□□□□□■■□□□
□■■■■□□□□□■■■■□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□
Binary 0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,
notation 0x06,0x06,0x04,0x0C,0x08,0x1F,0x18,0x30,
0x30,0x78,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x80,0xC0,0xC0,0x40,0x60,0x20,0xF0,0x30,
0x18,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00
- 950 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Pattern □□□□□□□■■□□□□□■■■□■■■□□□□□□□□□□□
□□□□□□□□■■□□□□□■■□□■■□□□■■□□□□□□
□□□□□□□□■■□■■■■■■■■■■■■■■■■□□□□□
□□□□□□□□□□□□□□□■■□□■■□□□□□□□□□□□
□□□□□□□□□□□□□□□■■□□■■□□□□□□□□□□□
□□□□□□□□□□■□■□□□□□□□□□■■□□□□□□□□
□□□□□■■□□□■□■■■■■■■■■■■■■□□□□□□□
□□□□□□■■□□■□■■□□□■■□□□■■□□□□□□□□
□□□□□□■■□■■□■■□□□■■□□□■■□□□□□□□□
□□□□□□□□□■□□■■■■■■■■■■■■□□□□□□□□
□□□□□□□□□■□□□□□□□■■□□□□□□□□□□□□□
□□□□□□□□■■□□□□□□□■■□□□■■□□□□□□□□
□□□□□□□□■■□□■■■■■■■■■■■■■□□□□□□□
□□□□□□□■■□□□□□□□□■■□□□□□□□□□□□□□
□□□□□□□■■□□□□□□□□■■□□□□■■□□□□□□□
□□□□□■■■□□■■■■■■■■■■■■■■■■□□□□□□
□□□□□□■■□□□□□□□□■■■□□□□□□□□□□□□□
□□□□□□□■□□□□□□□■■□■■□□□□□□□□□□□□
□□□□□□□■□□□□□□■■□□□■■□□□□□□□□□□□
□□□□□□■■□□□□□■■□□□□□■■■■□□□□□□□□
□□□□□□■■□□□■■■□□□□□□□□■■■■■□□□□□
□□□□□□□□□■■■□□□□□□□□□□□□■■□□□□□□
□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
Binary 0x01,0x00,0x00,0x00,0x00,0x00,0x06,0x03,
notation 0x03,0x00,0x00,0x00,0x00,0x01,0x01,0x07,
0x03,0x01,0x01,0x03,0x03,0x00,0x00,0x00,
0x00,0x83,0xC1,0xDF,0x01,0x01,0x28,0x2F,
0x2C,0x6C,0x4F,0x40,0xC0,0xDF,0x80,0x80,
0x3F,0x00,0x01,0x03,0x06,0x1C,0x70,0x00,
0x00,0x00,
0xB8,0x98,0xFF,0x98,0x98,0x03,0xFF,0x63,
0x63,0xFF,0x60,0x63,0xFF,0x60,0x61,0xFF,
0xE0,0xB0,0x18,0x0F,0x03,0x00,0x00,0x00,
0x00,0x00,0xC0,0xE0,0x00,0x00,0x00,0x80,
0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,
0xC0,0x00,0x00,0x00,0x00,0xE0,0xC0,0x00,
0x00,0x00
- 951 -
3.Function References PROGRAMMING B-64303EN-3/01
The above single byte character codes are those in single byte user defined character mode
that can be selected by the sequence "ESC (8".
In case of 2-byte characters, one of the following two methods can be employed.
(1) When registering the JIS Kanji characters, which are not included in the FANUC Kanji
character set, as user defined characters.
Assuming that the character "TORA", not included in the FANUC Kanji character set, is
to be displayed on the screen, make dot pattern for the character, register it as an
user defined character, and assign the standard shift JIS code for the character "TORA"
(0x8CD5) to it. Thus, printing "TORA" by using printf() function as usual will display
the character "TORA" on the CNC screen.
Make dot pattern of the user defined character referring to the section 3.2.
After making dot patterns for all user defined characters, describe them in binary notation
and store in an unsigned character string.
- 952 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Whole character patterns for all user defined characters to be registered have to be stored
in one unsigned character string. User defined characters cannot be registered separately. They
can only be registered all characters at one time. Put this character string in the user
application program.
Registered user defined characters can be displayed by using crt_fchar() function. The
character code given to this function as an argument is the code automatically assigned to the
character in the order of its registration (0x4100,..).
If JIS code is assigned to the user defined character by using crt_mapuch() function, standard
character output functions as putchar(), printf(),etc.,can be used to display the character.
In the case of single byte character, switch the code set to the single byte user character mode
by the sequence "ESC (8" to specify the user character.
In the case of 2-byte character, directly output the shift JIS code assigned to the user defined
character.
(Example)printf( "\x93\xC8\x96\xD8" ) ;
(This is Japanese string "TOCHI-GI".)
If the dot pattern of the character "TOCHI" is registered as an user defined character
and the code 0x93C8, which is the shift JIS code for the standard JIS character "TOCHI",
is assigned to the character, the character "TOCHI" can be output to the screen as if
it were included in the FANUC Kanji character set.
printf( "\xEB\xA0" ) ;
When the code greater than 0xEB9F (0xEBA0 in this case), which is vacant in shift JIS
code area, is assigned, directly specify the code.
- 953 -
3.Function References PROGRAMMING B-64303EN-3/01
Function reference
------------------------------------------------------------------------------------------
3.1 Register user character. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_reguserchar
[Syntax]
#include <crt.h>
int crt_reguserchar( unsigned int number, unsigned char *table ) ;
[Arguments]
number the number of registered user defined characters in
bytes ( 1-- 256)
table pointer to the character pattern table
[Return]
0 normal completion
1 invalid number of user defined characters
[Description]
Register the character pattern of the user defined character.
After the execution of this function, user defined characters will become available for
the user application program.
Character pattern table must be statically allocated. Such kind of usage that storing
the character pattern table in the memory area reserved by the malloc() function,
specifying the table as an argument of this function, and after that releasing the memory
area by free() function, is not allowed. The character pattern table should be defined
as, for example, usual constant data array. This is because the character table is
sometimes referred to again internally, when re-registration of the character pattern
become necessary inside the library as a result of screen switching.
- 954 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
3.2 Map user character. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_mapuch
[Syntax]
#include <crt.h>
int crt_mapuch( unsigned int code, unsigned int ucode ) ;
[Arguments]
code code to be assigned
0x0020 through 0x00DF for single byte character
0x8140 through 0xEFFF for 2-byte character (limited
to those allowed in shift JIS code)
ucode FANUC code for the user defined character
(0x4100 through 0x41FF)
[Return]
0 normal completion
1 illegal character code assigned
[Description]
Assign single byte character code or JIS Kanji code for the user defined character.
To put a character on the screen by using the assigned JIS code,select either "ESC (8"
mode (single byte mode) or "ESC (B" mode( 2 bytes mode).
This function does not check the validity of the specified charactercode. Care should
e taken not to specify wrong character codes.
- 955 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
3.3 Get CG pattern. <Main>
------------------------------------------------------------------------------------------
[Name]
crt_getcgpttn
[Syntax]
#include <crt.h>
int crt_getcgpttn( unsigned int code, unsigned char *buf ) ;
[Arguments]
code the FANUC code for the character of which the
character pattern is to be get
buf buffer area where character pattern is stored
( 16 bytes )
[Return]
0 normal completion
1 reading the character pattern is not supported by this version of Hardware
[Description]
Read the character pattern data stored in the character generator.
This function does not check the validity of the specified character code. Care should
be taken not to specify wrong character codes.
- 956 -
B-64303EN-3/01 PROGRAMMING 3.Function References
/* Character pattern */
unsigned char pattern[ UCH_NUM * CHAR_SIZE_14 ] = {
0x00,0x3F,0x02,0x02,0x02,0x3F,0x22,0x22, /* 0x4100 */
0x22,0x22,0x22,0x3F,0x02,0x02,0x02,0x7F,
0x00,0xFE,0x20,0x20,0x20,0xFE,0x22,0x22, /* 0x4101 */
0x22,0x22,0x22,0xFE,0x20,0x20,0x20,0xFF,
0x00,0x01,0x3C,0x24,0x24,0x25,0x25,0x25, /* 0x4102 */
0x25,0x25,0x25,0x25,0x3C,0x00,0x00,0x03,
0x00,0xFE,0x48,0x48,0x48,0xCE,0x02,0x02, /* 0x4103 */
0x02,0x02,0x02,0xCE,0x48,0x48,0x48,0xFF,
0x10,0x10,0x10,0x7E,0x12,0x12,0x12,0x22, /* 0x4104 */
0x22,0x24,0x24,0x14,0x08,0x14,0x22,0x41,
0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0xFF, /* 0x4105 */
0x00,0x10,0x10,0xFE,0x10,0x10,0x10,0xFF,
0x00,0x3E,0x22,0x22,0x24,0x24,0x28,0x24, /* 0x4106 */
0x22,0x22,0x22,0x22,0x3C,0x20,0x20,0x20,
0x00,0xFF,0x02,0x02,0x02,0xFA,0x8A,0x8A, /* 0x4107 */
0x8A,0x8A,0x8A,0xFA,0x02,0x02,0x02,0x0E,
0x00,0x00,0x7F,0x00,0x1F,0x10,0x10,0x10, /* 0x4108 */
0x1F,0x02,0x04,0x1C,0x64,0x04,0x07,0x1C,
0x80,0x80,0xFF,0x00,0xFC,0x04,0x04,0x04, /* 0x4109 */
0xFC,0x80,0x44,0x48,0x30,0x10,0x8C,0x03,
} ;
- 957 -
3.Function References PROGRAMMING B-64303EN-3/01
"VGA window" is an overlapping window provided by VGA display device. This VGA window has the
following features.
* Overlapping on any arbitrary screen such as CNC, PMC and C-EXE screen.
Full screen
VGA window #0
Also VGA
window is over VGA window #1
lapped on the
other window. Both character and
graphics are
overlapped.
- 958 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Each two VGA windows have their own screen buffers of character and graphics display It is
possible to output to the base screen during displaying VGA windows. Output operation to hidden
area of the base screen displays nothing to the real screen but writes to the screen buffer memory.
When the VGA window closed, all contents of the base screen, including on the hidden
area, are output automatically.
* Color palettes are common with the base screen. So, if any color palette is changed in
the base screen or the VGA window, the corresponding color palette of the other screen is changed.
* The control of graphic display enabling/disabling is common with the base screen. So,
if the graphic display is disabled in the base screen, the contents of graphics in the
VGA window are disabled at the same time.
* VGA window is available on only 16-color mode, unavailable on 256-color mode. While the
following modes are specified in "_setvideomode()" function, VGA window is unavailable.
* Size and position of VGA window are specified by character size unit.
* When the screen mode is changed, all VGA windows are closed automatically.
* The VGA window cannot be used together with the CNC subscreen/help screen.
To use the VGA window, set parameter NSH(No.8654#0)=1 to hide the subscreen/help screen.
* If the VGA window is used, it is impossible to use the debug function of the macro
compiler/executor. Set parameter DBG(No.9033#0)=0.
- 959 -
3.Function References PROGRAMMING B-64303EN-3/01
Usually VGA window is used in the window task. It is possible to only output to VGA window
in the window task. VGA window is used in also the main task. In the following section, usages
of VGA window is described for each cases.
Execute the following procedures to display VGA window in the window task.
(1) Call "vwin_open()" function to open VGA window. "vwin_open()" function doesn't always
succeed. Checking the return value of this function is needed.
_98RESS16COLOR, _98RESS8COLOR,
_VRES16COLOR, _VRES16EXCOLOR
(4) Call "vwin_close()" function to close the VGA window after required displays.
Don't execute both character and graphics output before calling "vwin_open()" function and
after calling "vwin_close()" function.
Color palettes are common with the base screen. Changing color palette in the VGA window makes
changing the same color palette in the base screen, and vice versa. Especially, take care to
change and to refer the color palettes in the VGA window on the CNC and the PMC screen. To get
the contents of color palettes in the CNC screen, use "crt_getcncpalette()" function.
Also enabling/disabling graphic output status is common with the base screen.
Graphic output must always be enable in the base screen for graphic drawing in VGA window. Note,
however, that if tool path drawing is underway in tool path drawing or background drawing
processing or if a tool path that was drawn before has not been erased, enabling graphics drawing
causes the tool path to appear on the CNC screen.
Once VGA window is opened, it keeps opened until calling "vwin_close()" function by the
application program. (except in case of changing screen mode.) Call "vwin_close()" function
positively to close the VGA window by the application program.
- 960 -
B-64303EN-3/01 PROGRAMMING 3.Function References
The procedures to display VGA window in the main task is basically same asin the window task.
There are some differences as follows.
(1) Once "vwin_open()" function is called, all of the following output are displayed in the
VGA window. (both character and graphics) After closing all VGA window, output is
displayed to the base screen again.
(2) Various settings about display are taken over between the base screen and the VGA window
as they are. Generally, it is necessary to re-initialize the display environment after
changing display between the base screen and the VGA window. Call "_setvideomode()"
function after opening the VGA window, "crt_setmode()" and "_setvideomode()" functions
after returning the base window from the VGA window.
(3) The opened VGA window is still displayed as it is even if the base screen is changed
to another screen (CNC screen, etc.). It is impossible to control the VGA window on the
CNC screen by the main task.
So, it is better to disable screen switching during opening the VGA window.
It is impossible to resize the opened VGA window. Close the VGA window by "vwin_close()"
function first, then open with new size specification again.(Redrawing is required.)
Hide the VGA window by "vwin_hide()" function once, then call "vwin_show()" function with the
new position.
Hide the VGA window which you want display on the top by "vwin_hide()" function once, then
display it by "vwin_show()" with the same position again.
- 961 -
3.Function References PROGRAMMING B-64303EN-3/01
Function Reference
------------------------------------------------------------------------------------------
4.1 Open VGA window. <Main,Win>
------------------------------------------------------------------------------------------
[Name]
vwin_open
[Syntax]
#include <crt.h>
int vwin_open( unsigned int widx,
unsigned int posl, unsigned int posc,
unsigned int sizev, unsigned int sizeh ) ;
[Arguments]
widx VGA window index. (=0,1)
posl Line number of the upper left corner of VGA window.
(the top line in the screen = 0)
posc Column position of the upper left corner of VGA window.
(the left-end column in the screen = 0)
sizev Line size of VGA window. (=1 - LMAX)
sizeh Column size of VGA window. (=1 - CMAX)
For the 10.4-inch LCD: CMAX = 80, LMAX = 30
[Return]
0 Successful.
Non-0 Error. (one of the following cases)
- Incorrect window index (widx).
- Specified window has been already opened.
- Incorrect position or size of window.
- The other software already uses the VGA window.
[Description]
Makes a VGA window and displays it on the screen.
A VGA window with the specified size is opened and displayed on the screen at the specified
position. It is allowed to specify position that a part of the window is put out of the
screen.
The window created by this function is selected and is put on the other window which
is already displayed.
After successful execution of this function, the following printing and drawing are
output to the window opened by this function until closing this window or the other window
is selected.
- 962 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
4.2 Close VGA window. <Main,Win>
------------------------------------------------------------------------------------------
[Name]
vwin_close
[Syntax]
#include <crt.h>
int vwin_close( unsigned int widx ) ;
[Arguments]
widx VGA window index. (=0,1)
[Return]
0 Successful.
Non-0 Error. (one of the following cases)
- The window specified by "widx" is not opened.
[Description]
Closes the opened VGA window.
When all VGA windows are closed in the main task, the base screen (ordinary screen) is
selected.
- 963 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
4.3 Select VGA window. <Main,Win>
------------------------------------------------------------------------------------------
[Name]
vwin_select
[Syntax]
#include <crt.h>
int vwin_select( unsigned int widx ) ;
[Arguments]
widx VGA window index. (=0,1)
[Return]
0 Successful.
Non-0 Error. (one of the following cases)
- The window specified by "widx" is not opened.
[Description]
Selects the specified VGA window as the target screen of character and graphics output.
After successful execution of this function, the following printing and drawing are
output to the window opened by this function until closing this window or the other window
is selected.
- 964 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
4.4 Show VGA window. <Main,Win>
------------------------------------------------------------------------------------------
[Name]
vwin_show
[Syntax]
#include <crt.h>
int vwin_show( unsigned int widx,
unsigned int posl, unsigned int posc ) ;
[Arguments]
widx VGA window index. (=0,1)
posl Line number of the upper left corner of VGA window.
(the top line in the screen = 0)
posc Column position of the upper left corner of VGA window.
(the left-end column in the screen = 0)
[Return]
0 Successful.
Non-0 Error. (one of the following cases)
- The window specified by "widx" is not opened.
- The window specified by "widx" is not hidden window.
[Description]
Redisplays the invisible VGA window.
To move VGA window on the screen, once hide the window by "vwin_hide" function, then
display with a new position by this function again.
- 965 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
4.5 Hide VGA window. <Main,Win>
------------------------------------------------------------------------------------------
[Name]
vwin_hide
[Syntax]
#include <crt.h>
int vwin_hide( unsigned int widx ) ;
[Arguments]
widx VGA window index. (=0,1)
[Return]
0 Successful.
Non-0 Error. (one of the following cases)
- The window specified by "widx" is not opened.
[Description]
Hides the specified VGA window.
This function makes the opened VGA window invisible with keeping the window's status.
It is possible to output characters and graphics to the invisible window.
By executing "vwin_show" function to the invisible window, the contents of the window
including contents output during being hidden are redisplayed.
- 966 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
4.6 Get VGA window information. <Main,Win>
------------------------------------------------------------------------------------------
[Name]
vwin_info
[Syntax]
#include <crt.h>
int vwin_info( unsigned int widx, struct vwinfo *buf ) ;
struct vwinfo {
unsigned int stat ; /* status */
unsigned int posl ; /* line position */
unsigned int posc ; /* column position */
unsigned int sizev ; /* vertical size */
unsigned int sizeh ; /* horizontal size */
} ;
[Arguments]
widx VGA window index. (=0,1)
buf Window information buffer.
[Return]
0 Successful.
Non-0 Error. (one of the following cases)
- Incorrect window index (widx).
[Description]
Gets the status information of the specified VGA window.
The position, size and status of the specified window are stored into "buf".
The meanings of each bit of the status flag "buf.stat" are as follows.
- 967 -
3.Function References PROGRAMMING B-64303EN-3/01
The application program can access a memory card which is inserted in the card slot equipped
on the LCD/MDI panel of Series 0i-D as a disk device.
(2) Mount the memory card as a disk device by the application program.
(Call "aux_file_mount" function.)
(3) Open files using "fopen", "fcreate" function, etc. with drive name "B:".
128 MB to 4 GB flash ATA cards and compact flash cards recommended by FANUC or purchased
from FANUC
Logical format of a memory card that this library can handle is MS-DOS format used on the generic
MS-DOS Personal computers. C Language Library doesn't support formatting function of a memory
card. It can read/write only formatted memory cards. Format memory cards using a personal
computer with
PC card slots or the boot software of Series 0i-D.
[Note]
* The drive name to access a memory card is "B:". It is fixed.
* The C application program can't access the memory card while the other software (CNC software,
etc.) is accessing it.
* The C application program may fail to access the memory card just after insertion the memory
card (for a few minutes). ("aux_file_mount" function returns "EAUTHREJ".) The CNC program
causes this problem because it always poring the card slot to detect card insertion. In this
case, the application program must retry to access.
- 968 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 969 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1. Format specified drive <Main>
------------------------------------------------------------------------------------------
[Name]
aux_file_format
[Syntax]
#include <auxfile.h>
int aux_file_format( unsigned char drive ) ;
[Arguments]
drive Drive name ( ='A' )
[Return]
0 normal completion
9 invalid drive name
[Description]
This function formats the drive specified by the argument.
When this function is called, whole data stored in the specified drive is lost.
It is not possible to format the memory card. Don’t specify the drive B.
- 970 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2. Mount memory card. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_file_mount
[Syntax]
#include <auxfile.h>
int aux_file_mount( unsigned char drive ) ;
[Arguments]
drive Drive name. ( ='B' )
[Return]
Returns 0 if successfully mounted the memory card.
If failed, returns non-0, and store one of the following values in the global variable
"errno".
[Description]
Mounts the memory card.
- 971 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
The following program reads character by character from "TESTFILE.DAT" in the memory
card and writes them to the stdout.
#include <stdio.h>
#include <auxfile.h>
- 972 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
3. Unmount memory card. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_file_unmount
[Syntax]
#include <auxfile.h>
int aux_file_unmount( unsigned char drive ) ;
[Arguments]
drive Drive name. ( ='B' )
[Return]
Returns 0 if successfully unmounted the memory card.
If failed, returns non-0, and store one of the following values in
the global variable "errno".
[Description]
Unmounts the memory card.
[Example]
See example of "Mount memory card (aux_file_mount)".
- 973 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
4. Get memory card information. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_file_memcinfo
[Syntax]
#include <auxfile.h>
int aux_file_memcinfo( unsigned int *stat ) ;
[Arguments]
stat Buffer in which memory card information is stored.
[Return]
Returns 0 if successfully got the memory card information.
If failed, returns non-0.
[Description]
Reads the status of the memory card.
[Example]
See example of "Mount memory card (aux_file_mount)".
- 974 -
B-64303EN-3/01 PROGRAMMING 3.Function References
1. Outline
Serial Library is a set of general functions which are used to send/receive data to/from devices
via RS-232C communication interface. Character or block type data can be handled by these
functions.
[1] Protocol
- 975 -
3.Function References PROGRAMMING B-64303EN-3/01
application program
Status
Tx buffer Rx buffer
check
Serial device
Application program sends data to the serial device via transmit buffer(Tx buffer) and receives
data from the serial device through receive buffer(Rx buffer). Status information is directly
read from the serial device.
- 976 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Each communication channels have authorization control mechanism independent of each other.
Application program has to get authorization to use a channel by calling rs_open() function,
before using the serial communication interface. If the channel is already occupied by CNC control
program or any other task, that channel can neither be opened by rs_open() nor used. It is
allowed for the application program to use two channels at the same time.
Also, two channels can be used simultaneously if one is used by application program and the other
by CNC control program. But, while CNC control program is using serial interface, generally whole
CPU resources are dedicated to the program, so that the execution of the application program
will be stopped.
When a communication channel is opened by rs_open(), the state of the signal ER becomes ON
to announce external device that the channel is ready for communication. While ER is ON, connecting
or detaching the communication cable should not be done so as not to give damage to the hardware.
When a communication channel is closed by rs_close() function, the channel is released and
becomes free for other tasks, and the signal ER becomes OFF.
Two flow control methods are supported: one uses hardware signals (CS,ER) for handshaking and
the other uses DC code for it ( referred to as "hardware flow ctrl" and " DC code flow ctrl"
respectively). Following parameters can be selected.
(Note) When "none" is selected for hardware flow ctrl, RS signal becomes always ON.
When "DC code flow ctrl" is selected, data transmission is controlled by the DC codes as follows.
Stop or restart sending data, according to the DC code received from destination device.
- 977 -
3.Function References PROGRAMMING B-64303EN-3/01
DC code is used to request the source device to stop or restart sending data according to the
state of receiving buffer.
These DC1 or DC3 codes are automatically transmitted by the serial communication driver.
Application program can select one of the three communication modes,"transmit only", "receive
only", and "transmit and receive"
Only data transmission from application program to external device can take place in this mode.
Application program cannot use library functions for receiving data. Data received from external
device are ignored except DC codes.
Only data transmission from external device to application program can take place in this mode.
Application program cannot use library functions for sending data. All received data from external
devices are passed to application program.
Both data sending and receiving can take place in this mode. Application program can use all
serial library functions. Received data code from external device is interpreted as follows in
accordance with the selected flow control mode.
DC codes included in the receiving data from external device are interpreted as flow control
characters and they are not passed to the application program.
Because external device would not send DC codes to the application program for flow control
purposes in this mode, all receiving data including DC codes are passed to the application program.
- 978 -
B-64303EN-3/01 PROGRAMMING 3.Function References
In this mode, care should be taken for the relationship between flow control method and
transmitted data. When bi-directional "DC code flow ctrl" is employed, DC codes in transmitted
data, if included as data, cannot be discriminated from flow control DC characters. And these
data not only are blocked to pass to the application program but cause flow control failure.
Moreover, the DC code to announce "send stop/send restart" cannot be sent to the destination,
if "send data" is inhibited by the hardware signal. For these reasons, only text data should
be transmitted when "DC code flow ctrl" is employed. If hardware signal handshake is employed,
there is no restriction in the code of transmitted data.
2. Interface
[1] Connection
SD RD
RD SD
RS CS
CS RS
ER DR
DR ER
CD CD
SG SG
FG FG
(Cross cable)
This signal is used for flow control by hardware signal handshake. This signal requests
or allows external serial device to send data. The serial communication driver will bring
this signal OFF, when receive buffer is full. External device must not send more than
10 characters after RS is OFF.
- 979 -
3.Function References PROGRAMMING B-64303EN-3/01
Only difference between "hardware flow ctrl" and "no hardware flow ctrl" is that signals CS
and DR are deemed always ON if "no hardware flow ctrl" is selected.
- 980 -
B-64303EN-3/01 PROGRAMMING 3.Function References
(*1) RS becomes OFF when receive buffer is full and returns to ON when there
are free space in the buffer
(*2) ER becomes OFF when receive data overflows the receive buffer. This happens,
for example, when data transmission does not stop even if RS is brought
OFF to request stopping data transmission.
- 981 -
3.Function References PROGRAMMING B-64303EN-3/01
(Note 1) Even if communication interface is in erroneous state, the serial library functions
do not return errors. The functions, rs_putc, rs_getc, rs_write, rs_read returns error
only when inadequate manipulation of send or receive buffer is attempted. To know the
state of the communication interface, use the function, rs_status().
(Note 2) The serial library functions do not check the signal, DR. It should be checked by
application program if necessary.
- 982 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1. Initialize communication channel <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_open
[Syntax]
#include <bios.h>
int rs_open( int channel, ser_t *param, char *mode ) ;
struct RS_PACKET {
unsigned baud ; /* baud rate */
unsigned stop_bit ; /* stop bit length */
unsigned parity ; /* parity check */
unsigned data_bit ; /* character length */
unsigned hardflow ; /* hardware flow ctrl */
unsigned dc_enable ; /* DC code flow ctrl */
unsigned dc_put ; /* send DC code */
unsigned dc1_code ; /* DC1 code */
unsigned dc2_code ; /* DC2 code */
unsigned dc3_code ; /* DC3 code */
unsigned dc4_code ; /* DC4 code */
} ;
typedef struct RS_PACKET ser_t ;
[Arguments]
channel channel number ( = 1, 2 )
param communication parameter
mode communication mode
[Return]
Returns zero if successful. If any error, returns non-zero value.
[Description]
Specified communication channel is initialized with specified condition and opened for
data transmission.
- 983 -
3.Function References PROGRAMMING B-64303EN-3/01
- 984 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Every parameter must have it's value specified. If not, correct communication will not
be done.
To utilize communication function with Serial Library, "Reader/Punch Interface A" option
has to be equipped in the CNC.
If "1" is specified for param->dc_put, DC1 code(for receive mode) or DC2 code (for send
mode) is sent via communication channel.
- 985 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2. Close communication channel <Main,Alarm,Comm >
------------------------------------------------------------------------------------------
[Name]
rs_close
[Syntax]
#include <bios.h>
int rs_close( int channel ) ;
[Arguments]
channel channel number ( = 1, 2 )
[Return]
Returns zero if successful. If any error, returns non-zero value.
[Description]
Stops using specified communication channel.
If "1" is specified for param->dc_put of rs_open() function, DC3 code(for receive mode)
or DC4 code (for send mode) is sent via communication channel.
- 986 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
3. Put one byte data into transmit buffer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_putc
[Syntax]
#include <bios.h>
int rs_putc( int c, int channel ) ;
[Arguments]
c data to be sent
channel channel number ( = 1, 2 )
[Return]
Returns "1" if successful.
Returns zero if transmit buffer is full and has no room to accept new data. Returns "-1"
if any error. The error comes from transmit buffer and has nothing to do with the state
of communication interface.
[Description]
Puts one byte data into the transmit buffer of the specified communication channel.
This function outputs data to the transmit buffer. To know if the data is actually
transmitted , read the status of the transmit buffer by “rs_buffer” function and check
the vacancy of the buffer.
- 987 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
4. Get one byte data from receive buffer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_getc
[Syntax]
#include <bios.h>
int rs_getc( int channel ) ;
[Arguments]
channel channel number ( = 1, 2 )
[Return]
Returns a data read from receive buffer if successful. Returns "-1" if any error occurs
or if there is no data in the buffer. The error comes from receive buffer and has nothing
to do with the state of communication interface.
[Description]
Gets one byte data from the receive buffer of the specified communication channel.
- 988 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
5. Put block of data into transmit buffer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_write
[Syntax]
#include <bios.h>
int rs_write ( char *buffer, int size, int channel ) ;
[Arguments]
buffer output data storage area
size output data size
channel channel number ( = 1, 2 )
[Return]
Returns the size of the data output to the transmit buffer if successful. If free space
of the transmit buffer is smaller than the specified data size, returned value will be
smaller than the specified data size. Returns "-1"if any error. The error comes from
the transmit buffer and has nothing to do with the state of communication interface.
[Description]
Gets specified bytes of data from the specified buffer area and puts them into the transmit
buffer of the specified channel
This function outputs data to the transmit buffer. To know if the data is actually
transmitted, read the status of the transmit buffer by rs_buffer() function and check
the vacancy of the buffer.
- 989 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
6. Get block of data from receive buffer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_read
[Syntax]
#include <bios.h>
int rs_read ( char *buffer, int size, int channel ) ;
[Arguments]
buffer input data storage area
size input data size
channel channel number ( = 1, 2 )
[Return]
Returns the number of data bytes read from the receive buffer if successful. If size
of the data in the receive buffer is less than specified size, return value will be smaller
than specified size. Returns "-1" if any error. This error comes from receive buffer
and has nothing to do with the state of communication interface.
[Description]
Gets specified bytes of data from the receive buffer of the specified channel and puts
them into the specified buffer area.
- 990 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
7. Test or clear transmit/receive buffer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_buffer
[Syntax]
#include <bios.h>
int rs_buffer( int channel, int cmnd ) ;
[Arguments]
channel Channel number ( = 1, 2 )
cmnd buffer command
[Return]
If successful;
RS_GET_BUF_R, RS_GET_BUF_W commands return buffer size,
RS_CHK_BUF_R, RS_CHK_BUF_W commands return data size in the buffer
RS_CLR_BUF_R, RS_CLR_BUF_W commands return zero.
Returns "-1", if any error.
[Description]
Tests or clears the specified buffer of the specified channel.
cmnd function
RS_GET_BUF_R return receive buffer size
RS_GET_BUF_W return transmit buffer size
RS_CHK_BUF_R return data size in receive buffer
RS_CHK_BUF_W return data size in transmit buffer
RS_CLR_BUF_R clear receive buffer
RS_CLR_BUF_W clear transmit buffer
- 991 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
8. Get status of communication buffer and interface <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_status
[Syntax]
#include <bios.h>
int rs_status( int channel ) ;
[Arguments]
channel channel number ( = 1, 2 )
[Return]
Returns status of the communication interface and communication buffers.
0x0080 DR ON
0x0040 ( reserved )
0x0020 Framing error
0x0010 Overrun error
0x0008 Parity error
0x0004 ( reserved )
0x0002 ( reserved )
0x0001 ( reserved )
[Description]
Gets status information of the communication interface and communication buffers of the
specified channel.
- 992 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
9. Wait for communication interface event <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
rs_wait
[Syntax]
#include <bios.h>
#include <oscall.h>
int rs_wait( int channel, int param, int mode,
unsigned long time_out ) ;
[Arguments]
channel channel number ( = 1, 2 )
param character code or number of characters
mode operation mode
time_out maximum time to wait
[Return]
Returns zero if specified condition is satisfied.
Returns "EC_TIMOUT" if time limit set by time_out has elapsed.
When mode = rtx_size, this function returns "rtx_size_ok" if the number of data bytes
in the receive buffer is greater than or equal to the specified value. When mode = trx_size,
this function returns "trx_size_ok" if the number of data bytes in the transmit buffer
is less than or equal to the specified value. Returns the value other than described
above if any error.
[Description]
Waits for the specified communication channel to become given state.
According to the operation mode described above, either the number of data characters
or a character code should be specified for the argument "param".
mode param
rtx_size number of data characters in the receive buffer
trx_size number of data characters in the transmit buffer
rtx_code character code
- 993 -
3.Function References PROGRAMMING B-64303EN-3/01
After this function call, the task from which this function is called is switched to
the "wait state" until specified condition is satisfied. For this reason, this function
especially suits with communication tasks.
This waits for the number of untransmitted characters in the transmit buffer
to become less than or equal to the specified value given by "param".
If param = 0, above function call waits for the completion of transmission. This
is used to know that whole data is sent to the destination. By setting param
as param="Tx buffer size" - "Tx data size", above function call informs that
there is enough space in the transmit buffer to accept new data. This is useful
for efficient data transmission.
This waits for the number of received characters in the receive buffer to become
greater than or equal to the specified value given by "param". This is efficient
compared to the polling method.
This function call waits for the character specified by "param" to arrive.
This function is used for the case to know the arrival of the data packet which
ends with specific code.
Above wait state finishes when receiving data ,which arrives after “rs_wait” function
is called, matches the character specified by "param".
Those data, which have arrived before the execution of this function and are not yet
read by the application, are not examined for character matching.
- 994 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Specifying the maximum wait time by "time_out" avoids application program to hang up
when no answer comes back from the external device.
There can be some problem in the communication interface when timeout error occurs.
In this case, examine the state of the interface by using “rs_buffer” function or
“rs_status” function.
- 995 -
3.Function References PROGRAMMING B-64303EN-3/01
Following functions are provided to control execution of the application programs or to manage
execution of multiple tasks.
1. Time management
2. Semaphore control
3. Event flag
1. Time management
The time management functions can suspend execution of tasks for specified period of time or
can make tasks wait for events with limited wait time option which avoids tasks to become
dead-locked. The timer which can be used by the application program is a local timer dedicated
for the task. Time unit of the timer is "Tick"(1 Tick = 8 msec).
NAME FUNCTION
os_show_tim read timer
os_set_tim set timer
os_sync_tim suspend execution of task until specified time of timer
os_wait_tim suspend execution of task for specified time period
* Execution of the current task is suspended by os_sync_tim() until the timer reaches
the specified time. ( Absolute wait)
* os_wait_tim() function suspends execution of the current task for specified period
of time ,like waiting for time-out. ( Relative wait)
The time referred to in all task management library functions is based on the software-timer
of 8 msec unit. This timer is the basis of the operation of the task management programs. Note
that the contents of this timer does not always agree with the actual passage of time. This is
because the task management programs are suspended while the CNC task of higher priority is
being executed and the timer is not updated during this period.
- 996 -
B-64303EN-3/01 PROGRAMMING 3.Function References
wait for
get release
Wait SEM Wait SEM
Signal Wait
Signal
release get
NAME FUNCTION
os_make_sem create semaphore
os_delt_sem delete semaphore
os_wait_sem wait until semaphore is signaled
os_sign_sem signal semaphore
* The semaphore is not exclusively given to a task. (The system does not register the
task which has gotten the semaphore.) So, the semaphore can be signaled by even a task
that did not get the semaphore.
- 997 -
3.Function References PROGRAMMING B-64303EN-3/01
* os_wait_sem() decrements the semaphore counter, and suspends the execution of the
calling task if the value of the semaphore counter is negative.
semaphore
operation semaphore queue
counter
1 none
Wait 0 none
Wait -1 ==> ----X
Wait -2 ==> ----O----X
Wait -3 ==> ----O----O----X
Signaling semaphore
~~~~~~~~~~~~~~~~~~~
semaphore
operation semaphore queue
counter
-3 ==> ----O----O----X
Signal -2 ==> ----O----X
Signal -1 ==> ----X
Signal 0 none
Signal 1 none
- 998 -
B-64303EN-3/01 PROGRAMMING 3.Function References
As an example, here it is assumed that there are three sets of resources which are shared
between five tasks. The following example shows a method to manage assignment of these
resources among tasks.
1) Create semaphore by os_make_sem() and specify "3", which is the number of available
resource set, for the initial value of the semaphore counter.
In the following example, maximum three tasks can have resources assigned, and the
execution of the other tasks, for which there are no available resources, are suspended
to wait for the release of resources.
semaphore
TASK-A TASK-B TASK-C TASK-D TASK-E
counter value
3
Wait SEM 2
Wait SEM 1
Wait SEM 0
Wait SEM -1
Wait SEM
-2
Signal SEM -1
Signal SEM 0
Signal SEM 1
Signal SEM 2
Signal SEM 3
- 999 -
3.Function References PROGRAMMING B-64303EN-3/01
semaphore
TASK-A TASK-B TASK-C TASK-D TASK-E
counter value
3
Wait SEM 2
Wait SEM 1
Wait SEM 0
Wait SEM -1
Wait SEM
-2
Signal SEM -1
Signal SEM 0
Signal SEM 1
Signal SEM 2
Signal SEM 3
- 1000 -
B-64303EN-3/01 PROGRAMMING 3.Function References
This is a sample case that a task is waiting for another task to complete, and assumes
that TASK-A waits for TASK-B and TASK-B waits for TASK-C. This task synchronization can
be achieved by using two semaphores.
* Priority of each task is assumed to be A>B>C (C being lowest) in the following example.
0 0
Wait D -1
Wait E -1
running
Signal E 0
running
Signal D 0
running
- 1001 -
3.Function References PROGRAMMING B-64303EN-3/01
A method of sending or receiving data between tasks by means of ring buffer (or circulating
buffer) is considered in the following example.
Assume that the TASK-A writes a data into the buffer and the TASK-B reads the data from
the buffer. Writing a data into the buffer where a data is remaining unread, or reading
the buffer when no data is written, is not allowed.
SEM C
SEM D
Read
TASK-A TASK-B
Write
- 1002 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Event flag is used to synchronize execution of tasks. The event flags relating to the specific
operation are grouped and it forms an event group.
(For example, consider a case that a task detects a signal and notifies that to other tasks.)
Maximum 32 flags can be grouped for an event group.
Execution of tasks can be suspended until the state of an event group matches a specific data
pattern.
MSB LSB
31 0
・・・・・
flag 1
:
:
flag 32
Event group
~~~~~~~~~~~
A signal can wake all of the suspended tasks of which the triggering condition is satisfied.
event flag
- 1003 -
3.Function References PROGRAMMING B-64303EN-3/01
Name Function
os_make_flg create event flag
os_delt_flg delete event flag
os_sign_flg signal event flag (modal type)
os_puls_flg signal event flag (pulse type)
os_wait_flg wait for being signaled
os_clar_flg clear event flag
(Note) The event flag signaled by modal type signal is memorized in the event flag image.
This image is retained until it is cleared by os_clar_flg().
os_wait_flg() sets the wait condition and suspends execution of the calling task.
For example, to wait for the event flag 1,2,3 to become ON, specify 0x00000007 for the parameter
of os_wait_flg(). (This parameter is referred to as "wait message".) In addition, specify "AND
wait" or "OR wait" by the argument of os_wait_flg().
(a) OR wait
The execution of the calling task is suspended until at leased one of the flags 1,2 or
3 is signaled. The task is not suspended, if any of the flags 1,2 or 3 in the event flag
image is set before the function is called. (This is the case that a flag is signaled
by os_sign_flg() before.)
- 1004 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Operation
~~~~~~~~~
AND
!=0
0..0XXX NO wait
==0
The execution of the calling task is suspended until all three flags 1,2 and 3 are signaled.
Flags, set ON in the event flag image before the function is called, are not accounted
as flags to be waited.
For example, if flags 1 and 2 are ON in the event flag image, the task waits for only
flag 3 to be signaled.
If three flags 1,2 and 3 are all ON in the event flag image before the function is called,
the calling task is not suspended.
operation
~~~~~~~~~
wait message = ~image & wait message
if( wait message != 0 )
Wait ==> wait until "wait massage" is satisfied
- 1005 -
3.Function References PROGRAMMING B-64303EN-3/01
NOT
1..1111XXX AND
==0
0..0XXX NO wait
!=0
(Note) Those flags signaled in the past by os_sign_flg() is memorized in the event flag
image. Whether the execution of the task is suspended or not depends on the
contents of the event flag image.
- 1006 -
B-64303EN-3/01 PROGRAMMING 3.Function References
For example, to signal the event flag 1,2 and 3 to become ON, specify 0x00000007 for the parameter
of os_sign_flg(). (This parameter is referred to as "signal message".)
The suspended tasks which are waiting for the flags, that are specified by this function call,
to be signaled are waked.
os_puls_flg() does not memorize the signaled flags in the event flag image.
Accordingly, subsequent 0s_wait_flg() function call specifying the signaled flags as
"wait message" will suspend the calling task again.
operation
~~~~~~~~~
if( signal message & wait message != 0 )
Ready ===> waked
AND
!=0
0..0XXX waked
==0
suspended
- 1007 -
3.Function References PROGRAMMING B-64303EN-3/01
operation
~~~~~~~~~
wait message = ~signal message & wait message
if( wait message == 0 )
Ready ===> waked
NOT
1..1111XXX AND
==0
0..0XXX waked
!=0
suspended
os_clar_flg() function call clears specified bit of the event flag image.
For example, to clear flag 1 ,specify "0x00000001" for the parameter of os_clar_flg(). (This
parameter is referred to as "clear message".)
operation
~~~~~~~~~
flag image = ~clear message & flag image
- 1008 -
B-64303EN-3/01 PROGRAMMING 3.Function References
NOT
1..1111110 AND
(Note) Clearing the event flag image does not affect the state of suspending tasks.
- 1009 -
3.Function References PROGRAMMING B-64303EN-3/01
Following example explains the state transition of the flags to be waited and the event
flag image when they are signaled by modal type and pulse type signaling functions.
Parameter flags to be
Function event flag image
(message) waited
os_wait_flg
11111111 11111110 00000001 (*1)
(AND wait)
↓ ↓
os_sign_flg 00000110 → 11111000 00000111 (*2)
↓ ↓
os_puls_flg 00011000 → 11100000 00000111 (*3)
↓ ↓
os_clar_flg 00000011 → 11100000 00000100 (*4)
↓ ↓
os_sign_flg 01100000 → 10000000 01100100 (*5)
↓ ↓
os_puls_flg 10000000 → 00000000 01100100 (*6)
↓
wake up from suspended state
- 1010 -
B-64303EN-3/01 PROGRAMMING 3.Function References
- 1011 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1. Read timer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_show_tim
[Syntax]
#include <oscall.h>
void os_show_tim( unsigned long *current_timer_value ) ;
[Arguments]
current_timer_value value read from the timer
[Return]
------
[Description]
Reads current value of the timer.
The time value read by this function is that of local timer dedicated for the calling
task.
The contents of the timer read by this function does not always agree with the actual
passage of time. To read the time of day, use clock() function which is more accurate.
- 1012 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
2. Set timer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_set_tim
[Syntax]
#include <oscall.h>
void os_set_tim( unsigned long new_timer_value,
unsigned long *old_timer_value ) ;
[Arguments]
new_timer_value new timer value
old_timer_value old timer value
[Return]
------
[Description]
The timer set by this function is the local timer dedicated for the calling task.
The contents of the timer read by this function does not always agree with the actual
passage of time. To read the time of day, use clock() function which is more accurate.
- 1013 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
3. Suspend execution of task until specified time of timer <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_sync_tim
[Syntax]
#include <oscall.h>
unsigned short os_sync_tim( unsigned long wakeup_time ) ;
[Arguments]
wakeup_time time to wake up
[Return]
0 successful completion
EC_TIMOUT Time Out
[Description]
This function suspends the execution of the calling task until timer reaches the specified
time value.
This function cannot suspend the execution of tasks other than the calling task.
This function does not return error value, zero. When the timer reaches the specified
time, returns error value, EC_TIMOUT.
Internally, this function suspends execution of the task for a period of time
given by subtracting current time from the wakeup_time. (wakeup_time - current time)
If wakeup_time is less than current time, the task is not suspended.
Before calling this function, current time must be read by os_show_tim() function.
The maximum value of the wakeup_time is 7FFFFFFFh which corresponds to 198 days, 20 hours,
11 minutes, 9 seconds, and 180 milli seconds.
- 1014 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
4. Suspend execution of task for specified time period <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_wait_tim
[Syntax]
#include <oscall.h>
unsigned short os_wait_tim( unsigned long timeout_value ) ;
[Arguments]
timeout_value time period to wait
[Return]
0 successful completion
EC_TIMOUT Time Out
[Description]
Suspends execution of the calling task for the specified time period.
This function cannot suspend the execution of tasks other than the calling task.
This function does not return error value, zero. When specified time period is elapsed,
returns error value, EC_TIMOUT.
The maximum value of the timeout_value is FFFFFFFFh which corresponds to 397 days, 16
hours, 22 minutes, 18 seconds, and 360 milli seconds.
Note 1: The start cycle becomes waiting time when +8 msec was done from the value that
timeout_value set for 8 msec. Therefore, timeout_value=1 (waiting time 8msec)
becomes the waiting time of 16 msec. Set 0 to timeout_value when you want to
set waiting time as minimum 8 msec.
Note 2: It starts after the end of a high-ranking task is waited when a more high-ranking
task executes it even if released from the event waiting state. Therefore, the
start by the event might be delayed, and there are no guarantee at the start
cycle.
- 1015 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
5. Create event flag <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_make_flg
[Syntax]
#include <oscall.h>
unsigned short os_make_flg( unsigned char event_flag_id ) ;
[Arguments]
event_flag_id event flag ID
[Return]
0 successful completion
EC_FLGID Event-flag ID error
EC_EXSTFLG Already existing event-flag
[Description]
Creates event group with specified event flag ID.
- 1016 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
6. Delete event flag <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_delt_flg
[Syntax]
#include <oscall.h>
unsigned short os_delt_flg( unsigned char event_flag_id ) ;
[Arguments]
event_flag_id event flag ID
[Return]
0 successful completion
EC_FLGID Event-flag ID error
EC_NXSTFLG Non-existent event-flag
[Description]
This function deletes the event group specified by "event_flag_id".
Error code, "EC_DELFLG", is returned to the tasks that have been waiting for the deleted
event flags to be signaled.
- 1017 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
7. Signal event flag <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_sign_flg
[Syntax]
#include <oscall.h>
unsigned short os_sign_flg( unsigned char event_flag_id,
unsigned long flag_on_message ) ;
[Arguments]
event_flag_id event flag ID
flag_on_message signal message
[Return]
0 successful completion
EC_FLGID Event-flag ID error
EC_NXSTFLG Non-existent event-flag
[Description]
Signals event flags specified by "event_flag_id" and signal message.
- 1018 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
8. Wait for being signaled <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_wait_flg
[Syntax]
#include <oscall.h>
unsigned short os_wait_flg( unsigned char event_flag_id,
unsigned long wait_message,
unsigned short and_or, long wait_limit,
unsigned long *return_message ) ;
[Arguments]
event_flag_id event flag ID
wait_message wait message
and_or AND -- 0, OR -- 1
wait_limit Set 0.
return_message
[Return]
0 successful completion
EC_FLGID Event-flag ID error
EC_NXSTFLG Non-existent event-flag
EC_DELFLG Event-flag was deleted
EC_TIMOUT Time out
[Description]
When the value of the argument "and_or" is AND_W(0), this function suspends the calling
task and waits for all the signals specified by wait_message to be signaled. This is
referred to as "AND wait" mode. Always, "0" is returned as return_message in this mode.
When the value of the argument "and_or" is OR_W(1), this function suspends the calling
task and waits for at least one of the signals specified by wait_message to be signaled.
This is referred to as "OR wait" mode. Signaled flag is returned as return_message
in this mode.
- 1019 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
9. Clear event flag <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_clar_flg
[Syntax]
#include <oscall.h>
unsigned short os_clar_flg( unsigned char event_flag_id,
unsigned long clear_message ) ;
[Arguments]
event_flag_id event flag ID
clear_message clear message
[Return]
0 successful completion
EC_FLGID Event-flag ID error
EC_NXSTFLG Non-existent event-flag
[Description]
Clears the event flag image.
This function clears the flags in the event flag image which are specified by the
clear_message.
- 1020 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
10. Signal event flag (pulse type) <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_puls_flg
[Syntax]
#include <oscall.h>
unsigned short os_puls_flg( unsigned char event_flag_id,
unsigned long puls_message ) ;
[Arguments]
event_flag_id event flag ID
puls_message signal message
[Return]
0 successful completion
EC_FLGID Event-flag ID error
EC_NXSTFLG Non-existent event-flag
[Description]
Signals the event flags specified by the puls_message argument.
- 1021 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
11. Create semaphore <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_make_sem
[Syntax]
#include <oscall.h>
unsigned short os_make_sem( unsigned char semaphore_id,
char initial_value ) ;
[Arguments]
semaphore_id semaphore ID
initial_value initial value of the semaphore counter
[Return]
0 successful completion
EC_SEMID Semaphore ID error
EC_EXSTSEM Already existing semaphore
[Description]
Creates a counter type semaphore.
Initial value of the semaphore counter represents the number of resources managed by
the semaphore.
- 1022 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
12. Delete semaphore <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_delt_sem
[Syntax]
#include <oscall.h>
unsigned short os_delt_sem( unsigned char semaphore_id ) ;
[Arguments]
semaphore_id semaphore ID
[Return]
0 successful completion
EC_SEMID Semaphore ID error
EC_NXSTSEM Non-existent semaphore
[Description]
Deletes semaphore.
Error code "EC_DELSEM" is returned to the tasks which have been waiting for the deleted
semaphore.
- 1023 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
13. Signal semaphore <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_sign_sem
[Syntax]
#include <oscall.h>
unsigned short os_sign_sem( unsigned char semaphore_id ) ;
[Arguments]
semaphore_id semaphore ID
[Return]
0 successful completion
EC_SEMID Semaphore ID error
EC_NXSTSEM Non-existent semaphore
EC_SEMOVF Semaphore overflow
[Description]
Signals the semaphore specified by the "semaphore_id" argument.
This function increments the semaphore counter, and runs the task at the top of the
semaphore queue if the value of the semaphore counter becomes less than or equal to zero.
- 1024 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
14. Wait until semaphore is signaled <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
os_wait_sem
[Syntax]
#include <oscall.h>
unsigned short os_wait_sem( unsigned char semaphore_id,
long wait_limit ) ;
[Arguments]
semaphore_id semaphore ID
wait_limit Set 0.
[Return]
0 successful completion
EC_SEMID Semaphore ID error
EC_NXSTSEM Non-existent semaphore
EC_DELSEM Semaphore was deleted
EC_TIMOUT Time out
EC_SEMUDF Semaphore underflow
[Description]
Waits until semaphore is signaled.
os_wait_sem() decrements the semaphore counter, and suspends the execution of the calling
task if the value of the semaphore counter is negative.
- 1025 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
15. Start window task <Main>
------------------------------------------------------------------------------------------
[Name]
os_strt_wtsk
[Syntax]
#include <oscall.h>
unsigned short os_strt_wtsk( unsigned int wghs ) ;
[Arguments]
wghs It is an argument set to be compatible with Series 16i C Language
Executor. It doesn’t have the meaning in the value of the argument.
[Return]
0 Successful.
0x010C No window task exists.
0x011B Not enough memory to start the window task.
[Description]
Starts the window task.
This function starts the window task. Until calling this function, the window task keeps
"start pending" status and is not executed.
[Example]
The following program which is called in the main task starts the window task.
#include <oscall.h>
#include <stdio.h>
- 1026 -
B-64303EN-3/01 PROGRAMMING 3.Function References
1. Outline
FCA(FANUC CASSETTE ADAPTOR) Library is a library of functions which are used to send or receive
data between CNC and FANUC's peripheral devices like FANUC Handy File or FANUC CASSETTE ADAPTOR.
[1] Function
Available functions are listed below. Note that actually available functions are limited by
the function of the connected peripheral device. For more details refer to the operating manuals
for each FCA devices.
[2] Protocol
- 1027 -
3.Function References PROGRAMMING B-64303EN-3/01
Application
FCA Library
Serial Library
Serial Device
- 1028 -
B-64303EN-3/01 PROGRAMMING 3.Function References
When the FCA Library Function, fca_setparam(), is called, the serial port is switched to
the FCA mode. In this mode, it is recommended not to use standard Serial Library Functions,
rs_xxx. Though these functions can be used in the FCA mode, detailed understandings of the
FCA devices are required to do that.
When a serial port is switched to the FCA mode, the port becomes being under control of
the application program and the signal "ER" becomes "ON". In this state, communication cable
should not be disconnected or connected to protect devices from hardware damage.
By calling the FCA Library Function, fca_bye(), the serial port is returned to the idle
state. That is, the port is released from the control of the application program and the
signal "ER" becomes "OFF".
fca_setparam
FCA mode
fca_bye
Idle state
rs_open
rs_close
General mode
While in FCA mode, other FCA Library Functions, fca_xxx(), can be called. If they are called
prior to the fca_setparam() function, the operation of those functions are not guaranteed.
One task can put multiple serial ports into FCA mode, but the port actually used is the one
which is specified by the last fca_setparam() function called.
- 1029 -
3.Function References PROGRAMMING B-64303EN-3/01
Though "Protocol B" is the standard protocol, the FCA Library Function does not set the
protocol automatically, because protocols other than that can also be set on the FCA devices.
Select appropriate protocol according to the setting of the connected device. As to the
setting method of the protocol,refer to the General mode function, rs_open().
Transmit and receive mode is selected and data can be sent or received at any time when
required.
- 1030 -
B-64303EN-3/01 PROGRAMMING 3.Function References
(Note 1) Even when an error occurs in FCA device, FCA functions do not return error status.
- 1031 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1. Initialize communication line. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_setparam
[Syntax]
#include <bios.h>
int fca_setparam( int channel, ser_t *param ) ;
struct RS_PACKET {
unsigned baud ; /* baud rate */
unsigned stop_bit ; /* stop bit length */
unsigned parity ; /* parity check */
unsigned data_bit ; /* character length */
unsigned hardflow ; /* hardware flow ctrl */
unsigned dc_enable ; /* DC code flow ctrl */
unsigned dc_put ; /* send DC code */
unsigned dc1_code ; /* DC1 code */
unsigned dc2_code ; /* DC2 code */
unsigned dc3_code ; /* DC3 code */
unsigned dc4_code ; /* DC4 code */
} ;
typedef struct RS_PACKET ser_t ;
[Argument]
channel Channel number. ( = 1 or 2 )
param Communication parameter.
[Return]
Returns zero if successful. If any error, returns non-zero value.
[Description]
Specified communication channel is initialized with specified condition and opened for
data transmission.
When this function is called, the serial port is switched to the FCA mode. In this mode,
it is recommended not to use standard Serial Library functions, rs_xxx. Though these
functions can be used in the FCA mode, detailed understandings of the FCA devices are
required to do that. When a serial port is switched to the FCA mode, the port becomes
being under control of the application program and the signal "ER" becomes "ON". In this
state, communication cable should not be disconnected or connected to protect devices
from hardware damage.
- 1032 -
B-64303EN-3/01 PROGRAMMING 3.Function References
While in FCA mode, other FCA Library Functions, fca_xxx(), can be called. If they are
called prior to the fca_setparam() function, the operation of those functions are not
guaranteed.By calling fca_bye(), the serial port is returned to the idle state.
For the parameters set in the structure, ser_t, refer to the rs_open function. In case
"Protocol B" is used for data transmission,following settings are recommended.
param->baud = BAUD_4800 ;
param->stop_bit = STOP_2 ;
param->parity = PARITY_N ;
param->data_bit = DATA_8 ;
param->hardflow = 2 ;
param->dc_enable = 3 ;
param->dc_put = 0 ;
param->dc1_code = 0x11 ;
param->dc2_code = 0x12 ;
param->dc3_code = 0x93 ;
param->dc4_code = 0x14 ;
[Example]
Refer to the example in "Read binary data from the file. (fca_read)".
- 1033 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2. Close communication line. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_bye
[Syntax]
#include <bios.h>
int fca_bye( int channel ) ;
[Argument]
channel Channel number. (= 1, 2)
[Return]
Returns zero if successful. If any error, returns non-zero value.
[Description]
This function releases the serial port which has been put in the FCA mode by the
fca_setparam() function. Signals "RS" and "ER" of the port is set "OFF".
[Example]
Refer to the example in "Read binary data from the file. (fca_read)".
- 1034 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
3. Open a binary file on FCA device. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_open
[Syntax]
#include <bios.h>
int fca_open( char *name, int mode ) ;
[Argument]
name File name on FCA device. (max. 17 characters)
mode Access mode. (= 0: read, 1: write )
[Return]
Returns zero if successful. Returns -1 if any error occurs.
[Description]
This function opens a binary file in the FCA device under control.
When the character '#' is used for the first character of the argument "name", which
passes the file name of the FCA device, it is assumed that file number is designated.
Following formats are available.
(Note) This function can be used only when the device connected to the port is FANUC
Handy File.It cannot be used for FANUC CASSETTE ADAPTOR etc.
[Example]
Refer to the example in "Read binary data from the file. (fca_read)".
- 1035 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
4. Close a binary file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_close
[Syntax]
#include <bios.h>
int fca_close( void ) ;
[Argument]
------
[Return]
Returns zero if successful. Returns -1 if any error occurs.
[Description]
This function closes the binary file which has been opened by fca_open() function.
(Note) This function can be used only when the device connected to the port is FANUC
Handy File.It cannot be used for FANUC CASSETTE ADAPTOR etc.
[Example]
Refer to the example in "Read binary data from the file. (fca_read)".
- 1036 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
5. Read binary data from the file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_read
[Syntax]
#include <bios.h>
int fca_read( char *buffer, unsigned int bytes ) ;
[Argument]
buffer Memory area to store read data.
bytes Number of data bytes to be read. (= 1 - 65534)
[Return]
Returns the number of data bytes actually read when successfully completed.
Returns -1 if any error occurs.
[Description]
When called this function reads data from the binary file opened by the fca_open()
function.
Because the FCA devices require the size of the transmitted data to exactly match with
the size of its unit input/output data block, it can happen, when returned from this function
call, that extra null characters ('\0') are added at the end of the data read. When a value
smaller than the specified byte count is returned, it should be assumed that the last block
of the file is read by that function call.
(Note) This function can be used only when the device connected to the port is FANUC
Handy File.It cannot be used for FANUC CASSETTE ADAPTOR etc.
- 1037 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
Following sample program displays the specified file in the FCA device connected to the
first channel in binary dump format.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
#define BUFSIZE 256
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
for ( ;; ){
ret = fca_read( buffer, bytes ) ;
if ( ret == -1 ) {
printf( "error in fca_read\n" ) ;
- 1038 -
B-64303EN-3/01 PROGRAMMING 3.Function References
fca_close() ;
fca_bye( 1 ) ;
return( ret ) ;
}
ret = fca_close() ;
if ( ret ) {
printf( "error in fca_close\n" ) ;
fca_bye( 1 ) ;
return ( ret ) ;
}
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye\n" ) ;
}
return ( ret ) ;
}
- 1039 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
6. Write binary data to the file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_write
[Syntax]
#include <bios.h>
int fca_write( char *buffer, unsigned int bytes ) ;
[Argument]
buffer Memory area to store write data.
bytes Number of data bytes to be written. (= 1 - 65534)
[Return]
Returns the number of data bytes actually written when successfully
completed. Returns -1 if any error occurs.
[Description]
This function is called to write data into a binary file opened by the fca_open() function.
Because the FCA devices require the size of the transmitted data to exactly match with
the size of its unit input/output data block, the data is padded with null characters,
'\0', when it is shorter than the unit size. As a result, it can happen that extra null
characters,'\0', are added at the end of the destination file.
(Note) This function can be used only when the device connected to the port is FANUC
Handy File. It cannot be used for FANUC CASSETTE ADAPTOR etc.
[Example]
Following sample program writes the NC part program of specified program number into
the device connected to the first channel as a file with specified name.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
#define BUFSIZE 256
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
- 1040 -
B-64303EN-3/01 PROGRAMMING 3.Function References
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
for (;;) {
number = BUFSIZE - 1 ;
ret = cnc_upload( (struct odbup *)(&buf), &number ) ;
if ( ret ) {
printf( "error in cnc_upload\n" ) ;
cnc_upend() ;
fca_close() ;
fca_bye( 1 ) ;
return ( ret ) ;
}
ret = fca_write( &buf[4], number ) ;
if ( ret == -1 ) {
printf( "error in fca_write\n" ) ;
cnc_upend() ;
- 1041 -
3.Function References PROGRAMMING B-64303EN-3/01
fca_close() ;
fca_bye( 1 ) ;
return ( ret ) ;
}
for ( i = 0 ; i < number ; i++ ) {
printf( "%c", buf[4+i] ) ;
}
if ( buf[4+number-1] == '%' ) {
printf( "\n" ) ;
break ;
}
}
ret = cnc_upend() ;
if ( ret ) {
printf( "error in cnc_upend\n" ) ;
fca_close() ;
fca_bye( 1 ) ;
return ( ret ) ;
}
ret = fca_close() ;
if ( ret ) {
printf( "error in fca_close\n" ) ;
fca_bye( 1 ) ;
return ( ret ) ;
}
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye\n" ) ;
}
return ( ret ) ;
}
- 1042 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
7. Open a text file on FCA device. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_fopen
[Syntax]
#include <bios.h>
int fca_fopen( char *name, char *mode ) ;
[Argument]
name File name on FCA device. (max. 17 characters)
mode Access mode. (= "r": read, "w": write )
[Return]
Returns zero if successful. Returns -1 if any error occurrs.
[Description]
This function opens a text file in the FCA device under control.
When the character '#' is used for the first character of the argument "name", which
passes the file name of the FCA device, it is assumed that file number is designated.
Following formats are available.
(Note) When MS-DOS format is used in the FANUC Handy File, this function cannot be used.
ISO code and EIA code are the only codes that this function and fca_putc() and
fca_getc() functions can handle.
[Example]
Refer to the example in "Read a character from the text file.(fca_getc)".
- 1043 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
8. Close a text device. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_fclose
[Syntax]
#include <bios.h>
int fca_fclose( void ) ;
[Argument]
------
[Return]
Returns zero if successful. Returns -1 if any error occurrs.
[Description]
This function closes the text file which has been opened by fca_open() function.
(Note) When MS-DOS format is used in the FANUC Handy File, this function cannot be used.
ISO code and EIA code are the only codes that this function and fca_putc() and
fca_getc() functions can handle.
[Example]
Refer to the example in "Read a character from the text file. (fca_getc)".
- 1044 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
9. Read a character from the text file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_getc
[Syntax]
#include <bios.h>
int fca_getc( void ) ;
[Argument]
------
[Return]
Returns the number of characters read when successful. Return -1 if any error occurrs
or EOF is detected.
[Description]
When called, this function reads one character from the text file opened by the
fca_fopen() function.
(Note) When MS-DOS format is used in the FANUC Handy File, this function cannot be used.
ISO code and EIA code are the only codes that this function can handle.
[Example]
Following sample program reads and displays a file, character by character, from the
device connected to the first channel.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
- 1045 -
3.Function References PROGRAMMING B-64303EN-3/01
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
ret = fca_fclose() ;
if ( ret ) {
printf( "error in fca_fclose\n" ) ;
fca_bye( 1 ) ;
return ( ret ) ;
}
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye\n" ) ;
}
return ( ret ) ;
- 1046 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
10. Write a character to the text file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_putc
[Syntax]
#include <bios.h>
int fca_putc( int c ) ;
[Argument]
c A character data to be written.
[Return]
Returns the written character if successful. Returns -1 if any error occurrs.
[Description]
When called, this function writes one character into the text file opened by the
fca_fopen() function.
(Note) When MS-DOS format is used in the FANUC Handy File, this function cannot be used.
ISO code and EIA code are the only codes that this function can handle.
[Example]
Following sample program writes the NC part program of specified program number,
character by character, into the device connected to the first channel as a file with
the specified name.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
#define BUFSIZE 256
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
- 1047 -
3.Function References PROGRAMMING B-64303EN-3/01
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
for (;;) {
number = BUFSIZE - 1 ;
ret = cnc_upload( (struct odbup *)(&buf), &number ) ;
if ( ret ) {
printf( "error in cnc_upload\n" ) ;
cnc_upend() ;
fca_fclose() ;
fca_bye( 1 ) ;
return ( ret ) ;
}
- 1048 -
B-64303EN-3/01 PROGRAMMING 3.Function References
fca_bye( 1 ) ;
return ( ret ) ;
}
printf( "%c", buf[4+i] ) ;
}
if ( buf[4+number-1] == '%' ) break ;
}
printf( "\n" ) ;
ret = cnc_upend() ;
if ( ret ){
printf( "error in cnc_upend()\n" ) ;
fca_fclose() ;
fca_bye( 1 ) ;
return ( ret ) ;
}
ret = fca_fclose() ;
if ( ret ) {
printf( "error in fca_close()\n" ) ;
fca_bye( 1 ) ;
return ( ret ) ;
}
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye()\n" ) ;
}
return ( ret ) ;
}
- 1049 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
11. Delete a file on FCA device. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_delete
[Syntax]
#include <bios.h>
int fca_delete( char *name ) ;
[Argument]
name Name of the file to be deleted. (max. 17 characters)
[Return]
Returns zero if successful. Returns -1 if any error occurrs.
[Description]
This function deletes a file from the FCA device.
When the character '#' is used for the first character of the argument "name", which
passes the file name of the FCA device, it is assumed that file number is designated.
[Example]
Following sample program deletes the specified file from the FCA device connected to
the first channel.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
- 1050 -
B-64303EN-3/01 PROGRAMMING 3.Function References
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye\n" ) ;
}
return ( ret ) ;
}
- 1051 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
12. Change name of a file on FCA device. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_rename
[Syntax]
#include <bios.h>
int fca_rename( char *oldname, char *newname ) ;
[Argument]
oldname Old file name. (max. 17 characters)
newname New file name. (max. 17 characters)
[Return]
Returns zero if successful. Returns -1 if any error occurrs.
[Description]
This function changes the name of the file in the FCA devices.
[Example]
Following sample program changes the name of the specified file in the device connected
to the first channel.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
- 1052 -
B-64303EN-3/01 PROGRAMMING 3.Function References
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye\n" ) ;
}
return ( ret ) ;
}
- 1053 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
13. Read directory information of FCA device. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_readdir
[Syntax]
#include <bios.h>
int fca_readdir( fca_dir *buffer, int ndir, int NFILE ) ;
typedef struct {
char file_name[18] ;/* file name (max. 17 alpha numeric */
/* characters+null) */
/* first byte:0xFF->not used */
/* :0x00->deleted file */
char file_size[9] ; /* file size(8 digit + null character) */
char wrt_protect ; /* write protect */
/* 'P'-> ON */
/* ' '-> OFF */
char record_code ; /* code */
/* 'B'->Binary */
/* 'E'->EIA */
/* ' '->ISO */
char vol_no[3] ; /*volume number(2 digit+null character)*/
/* ' '->single volume */
char multi_vol ; /* multi volume */
/* ' '->single volume */
/* 'C'->succeeding volume exists */
/* 'L'->last volume */
} fca_dir;
[Argument]
buffer Pointer to the buffer which directory information is stored in.
ndir Starting file number.
NFILE Number of files to read.
[Return]
Returns the number of directory information read if successful.
Returns -1 if any error occurrs.
[Description]
This function acquires the directory information from the FCA devices.
(1) Call the function with the argument (buffer,ndir,NFILE) specified as (NULL,1,0).
- 1054 -
B-64303EN-3/01 PROGRAMMING 3.Function References
(2) The number of directory information from the "ndir"th file to the last file is given
as the return value. Allocate memory area sufficient to store above directory
information and specify the pointer to this memory area as the argument "buffer".
(3) Call this function again with the number of directory information given in (2)
specified as the argument "NFILE".
(Note) When using MS-DOS format on FANUC Handy File, information other than file name
and file size are not valid, and file size value differs from the value gotten
when read by personal computer.
[Example]
Following sample program acquires and displays the directory information of the device
connected to the first channel.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
- 1055 -
3.Function References PROGRAMMING B-64303EN-3/01
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye\n" ) ;
}
return ( ret ) ;
}
- 1056 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
14. Read status information of FCA device. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_status
[Syntax]
#include <bios.h>
int fca_status( char *buffer ) ;
[Argument]
buffer Memory area to store status information.
(Two bytes are required for this area.)
[Return]
Returns zero if successful. Returns -1 if any error occurrs.
[Description]
This function reads status information of the FCA devices.
SD 0 PT ERROR CODE
- - - C5 - C3 C2 -
(Note) It can happen that "ERROR CODE" does not indicate correct error code.
- 1057 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example]
Refer to the example in "Delete a file on FCA device.(fca_delete)".
- 1058 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
15. Read free space size of a floppy disk. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
fca_remains
[Syntax]
#include <bios.h>
int fca_remains( long *remains ) ;
[Argument]
remains Memory area to store the amount of remaining free space of Floppy Disk.
[Return]
Returns zero if successful. Returns -1 if any error occurrs.
[Description]
This function reads the amount of remaining free space (byte count of the free space)
in Floppy Disk.
(Note) When using MS-DOS format on FANUC Handy File, file size differs from that given
by a personal computer.
[Example]
Following sample program reads and displays the amount of remaining free Tsapce in the
Floppy Disk connected to the first channel.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
r_para.dc3_code = 0x93 ;
- 1059 -
3.Function References PROGRAMMING B-64303EN-3/01
r_para.dc4_code = 0x14 ;
ret = fca_bye( 1 ) ;
if ( ret ) {
printf( "error in fca_bye\n" ) ;
}
return ( ret ) ;
}
- 1060 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Included in the F-ROM Library are the functions which are used to read the data files for the
C Language Executor that are stored in the Flush ROM Module for Series 0i-D (referred to as "F-ROM"
hereafter). The data file for the C Language Executor (referred to as "C Language Executor data
file" hereafter) is the file with the format which can be read by the C Language Executor
applications.
There are following three types of C Language Executor related files which are stored in the
F-ROM.
C Language Executor
program
The contents of this file is a C Language Executor application program which is compiled and
converted to the memory card format file.
- 1061 -
3.Function References PROGRAMMING B-64303EN-3/01
This type is composed of a C Language Executor program file and C Language Executor data files
combined together.
C Language Executor
program
Data file
directory entry
Data file 1
Data file 2
:
:
:
Data file n
A C Language Executor application program is compiled and converted to the memory card format
file. Then, Data files are combined to the C Language Executor program file by executing
"dat2mem.com". When power is applied to the CNC, only program part of this type of file is
loaded into D-RAM to run.
- 1062 -
B-64303EN-3/01 PROGRAMMING 3.Function References
Data file
directory entry
Data file 1
Data file 2
:
:
:
Data file n
"dat2mem" combines multiple data files into a file and converts it to Memory_Card format file.
The C Language Executor data file is not loaded into D-RAM in CNC.
For details on creating a memory card file, see Section 5.5, "Dat2mem utility manual" in
Part II, "PROGRAMMING".
- 1063 -
3.Function References PROGRAMMING B-64303EN-3/01
- 1064 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
1. Open the specified F-ROM file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_open
[Syntax]
#include <bios.h>
int aux_from_open( char *filename, char *mode ) ;
[Arguments]
filename Specify the name of the C Language Executor file in F-ROM to open.
mode Specify access mode.
Mode should always be read mode, "r".
[Return]
0 : Successful.
-3 : The aux_from_open function has opened the F-ROM file.
This value is also returned when MANUAL GUIDEi executes this function while
accessing the F-ROM file.
-5 : The F-ROM file having the specified file name is not present.
-10 : Access was denied because another function was accessing the F-ROM file.
1 : A mode other than read mode "r" was specified for mode.
[Description]
This function opens a C Language Executor file in the F-ROM and makes it ready to be
read.
The F-ROM file which can be opened by this function is C Language Executor file only.
Following F-ROM file names can be specified.
* "CEX x.xM" ( specify either "1.0", "1.5", "2.0", "2.5", "3.0", "3.5","4.0", "6.0",
for "x.x" )
F-ROM file name has to be specified only by upper case letters. Also, the name should
be specified in exactly eight characters. In case a file name is shorter than 8 characters,
add space characters (20H) to make it 8 character long.
- 1065 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2. Close the F-ROM file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_close
[Syntax]
#include <bios.h>
int aux_from_close( void ) ;
[Arguments]
------
[Return]
Returns zero if successful. Returns non-zero value if any error occurs. Error occurs
in the following case.
* When no F-ROM file is opened by aux_from_open() function.
[Description]
This function closes an opened C Language Executor file.
- 1066 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
3. Select data in the F-ROM file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_select
[Syntax]
#include <bios.h>
int aux_from_select( char *name ) ;
[Arguments]
name Specify file name to be selected.
[Return]
Returns zero if successful. Returns non-zero value if any error occurs. Error occurs
in the following case.
* When specified file does not exist.
[Description]
This function selects one of the data files in the C Language Executor data file.
- 1067 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
4. Move read pointer. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_moveptr
[Syntax]
#include <bios.h>
int aux_from_moveptr( long offset, int origin ) ;
[Arguments]
offset Byte count from base point.
origin Base point, see description.
[Return]
Returns zero if successful. Returns non-zero value if any error occurs. Error occurs
in the following cases.
* When pointer is moved backward beyond top of file
* When pointer is moved forward beyond end of file.
[Description]
This function moves the position of the read pointer on currently selected file.
Moving pointer forward beyond end of file or backward beyond top of file causes error.
- 1068 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
5. Read data from the F-ROM file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_read
[Syntax]
#include <bios.h>
int aux_from_read( unsigned char *buffer, unsigned int size ) ;
[Arguments]
buffer Buffer area to store read data.
size Size of the data to be read.
[Return]
Returns size of the data being read if successful. Returns zero if any error occurs.
[Description]
This function reads data from the selected data file and stores the data in the specified
buffer area.
Before calling this function, a data file, which data is read from, must be selected
by aux_from_select() function.
- 1069 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
6. Read directory information of a F-ROM file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_getdir
[Syntax]
#include <bios.h>
int aux_from_getdir( struct infodir *buf, unsigned int *num ) ;
struct infodir {
char name[13] ; /* file name */
char reserve_1[3] ; /* reserved(not used) */
unsigned long address ; /* address of the first byte of
the file */
unsigned long size ; /* file size */
char reserve_2[8] ; /* reserved(not used) */
} ;
[Arguments]
buf Area to store directory information.
num Area to store the number of directory entry.
[Return]
Returns zero if successful, and returns non-zero value if any error occurs.
[Description]
This function reads the directory information contained in C Language Executor data file.
When "NULL" is specified for "buf", only the number of directory entry is read and stored
in "num".
Directory information for one data file occupies 32 bytes.
- 1070 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
7. Read F-ROM file information. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_getinfo
[Syntax]
#include <bios.h>
int aux_from_getinfo( char *name ) ;
[Arguments]
name C Language Executor file name in the F-ROM.
[Return]
Returns following value if successful.
CEXEC C Language Executor program file
CEXEC_DATA C Language Executor program file + C Language Executor data file
C_DATA C Language Executor data file
If the specified file is absent or inappropriate for C Language
Executor, this function returns -1.
[Description]
This function reads information about files stored in the F-ROM.
There are following three types of C Language Executor files which is stored in the F-ROM.
This function gives the type of the specified file.
* "CEX x.xM" ( specify either "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "5.0",
"6.0", for "x.x" )
F-ROM file name has to be specified only by upper case letters. Also, the name should
be specified in exactly eight characters. In case a file name is shorter than 8 characters,
add space characters (20H) to make it 8 character long.
- 1071 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
8. Read a character from the F-ROM file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_getc
[Syntax]
#include <bios.h>
unsigned int aux_from_getc( void ) ;
[Arguments]
------
[Return]
Return the character being read if successful. Returns 0xFF if any error occurs.
[Description]
This function gets one character from selected data file.
This function replaces line termination code, "Carriage Return + Line Feed ( CR + LF)",
with single Line Feed character LF.
When error occurs or end of file is detected, 0xFF is returned.
Before calling this function, a data file, which data is read from, must be selected
by aux_from_select() function.
- 1072 -
B-64303EN-3/01 PROGRAMMING 3.Function References
------------------------------------------------------------------------------------------
9. Read a line from the F-ROM file. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_from_gets
[Syntax]
#include <bios.h>
int aux_from_gets( unsigned char *buffer, unsigned int size ) ;
[Arguments]
buffer Buffer area to store data being read.
size Data size to be read.
[Return]
Returns zero if successful. Returns -1 if any error occurs.
[Description]
This function reads one line of data from the selected data file and stores the data
in the specified buffer area.
A line is made up with all characters read before Line Feed character ('\n').
Line Feed character being read is stored in the buffer.
A NULL character ('\0') is added at the end of the line.
Reading character continues until Line Feed character ('\n) is encountered, end of file
is detected or "size - 1" number of characters are read. This function replaces line
termination code,
"Carriage Return + Line Feed (CR + LF)", with single Line Feed character LF.
Before calling this function, a data file, which data is read from, must be selected
by aux_from_select() function.
- 1073 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example 1]
/*
Select a file, TEST02.DAT, read and display 10 bytes of data from the beginning of the
file. Then move read pointer 50 bytes ahead of current position, and read and display
50 bytes of data.
*/
void sample1(){
int i, ret ;
unsigned char read_buf[SIZE] ;
int read_size, offset ;
- 1074 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example 2]
/*
Open F-ROM file of combined C Language Executor program file and C Language Executor
data file and display directory list.
*/
void sample2() {
- 1075 -
3.Function References PROGRAMMING B-64303EN-3/01
[Example 3]
/*
Get information of F-ROM file CEX 1.0M, and display.
*/
void sample3() {
int file_type ;
- 1076 -
B-64303EN-3/01 PROGRAMMING 3.Function References
1. Overview
In case that the display device is "10.4-inch LCD with touch-panel", the C application can
read status of the touch-panel. The information to be read is;
2. Touch-panel coordinate
The touch-panel library uses the following X-Y coordinate system whose origin is put at the
upper-left point to represent points on the touch-panel.
(0,0)
(xxxx,yyyy)
The coordinate on the touch-panel is represented as (X,Y) format using this coordinate
system.(X:horizontal position, Y:vertical position)
- 1077 -
3.Function References PROGRAMMING B-64303EN-3/01
In the 10.4-inch LCD, the whole coordinate range is (X,Y)=(0,0) - (639,479). This coordinate
corresponds with the C Language Executor screen as below.
The display screen of the C Language Executor corresponds to the coordinate range as shown below.
(0,0)
(0,48)
B A
(639,447)
(639,479)
The touch-panel coordinate is same as the graphic coordinate (physical coordinate) for
both X and Y.
B: 640x400 dots
The relation of the touch-panel and the graphic (physical) coordinate is as follows.
X(touch-panel) = X(graphic)
Y(touch-panel) = Y(graphic) + 48
- 1078 -
B-64303EN-3/01 PROGRAMMING 3.Function References
The relationship between touch-panel and graphic coordinate mentioned here establishes
while the touch-panel is calibrated correctly.
If the touch-panel is not exactly calibrated, there are little differences between
display position and touch-panel coordinate.
[Note]
The touch-panel can sense only one point at a time. When multiple points are pushed
simultaneously, the center point of all pushed points (in consideration of each pressure)
is read. For example, when (100,100) and (200,300) are pushed simultaneously, touch-panel
senses that somewhere between (100,100) and (200,300) is pushed.
This is caused by the physical specification (analog sensing) of the touch-panel.
- 1079 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
1. Read the status and (X,Y) coordinate of the touch-panel. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_tpl_read
[Syntax]
#include <bios.h>
int aux_tpl_read( struct tpl_xy_coord *buf ) ;
struct tpl_xy_coord {
unsigned int tpl_x_coord ; /* X-coordinate */
unsigned int tpl_y_coord ; /* Y-coordinate */
} ;
[Arguments]
buf X-Y coordinate structure of touch-panel.
[Return]
0x80 - 0x82
Touch-panel is being pushed.
0x00 Touch-panel is not being pushed, or any error occurs.
[Description]
Reads the touch-panel status and the coordinate value of the pushed point when touch-panel
is pushed.
- 1080 -
B-64303EN-3/01 PROGRAMMING 3.Function References
One of 0x80, 0x81 or 0x82 is returned as the return value when the touch-panel is pushed.
The difference of these values is as follows.
Value Status
0x80 Start pushing. (received HEAD data)
0x81 Keep pushing. (received BODY data)
0x82 End pushing. received TAIL data)
HEAD TAIL
BODY
The status of touch-panel is not buffered. The status at calling this function by the
application program is just returned. So, HEAD, BODY, TAIL are not exactly read as this
order according to timing of calling by the application program. Usually it is not needed
for the application program to distinguish return values, 0x80, 0x81 and 0x82. It is
possible to assume that "Touch-panel is pushed" for all return value 0x80 - 0x82. When
the return value of this function changes 0x00 -> 0x8N (N=0,1,2), assume that "start
pushing". In the same way, "0x8N -> 0x8N" is "keep pushing" and "0x8N -> 0x00" is "end
pushing".
When the touch-panel is pushed, X and Y coordinates of the pushed points are stored in
each "buf.tpl_x_coord" and "buf.tpl_y_coord" with binary format.
- 1081 -
3.Function References PROGRAMMING B-64303EN-3/01
Value Status
0x88 Received HEAD data.
0x89 Received BODY data.
0x8A Received TAIL data.
That is, the bit3 of the return value indicates that the no-calibrated coordinate data
are received.
When "Touch-panel control" option doesn't exist in CNC, this function returns "0".
- 1082 -
B-64303EN-3/01 PROGRAMMING 3.Function References
[Example]
The following program wait until touch-panel is pushed, and displays coordinate of the
pushed point.
#include <bios.h>
#include <stdio.h>
- 1083 -
3.Function References PROGRAMMING B-64303EN-3/01
------------------------------------------------------------------------------------------
2. Disable the output of the key code of a soft key by the touch-panel. <Main,Alarm,Comm>
------------------------------------------------------------------------------------------
[Name]
aux_tpl_invalskey
[Syntax]
#include <bios.h>
int aux_tpl_invalskey( int num ) ;
[Arguments]
num Enabling or disabling the output of the key code of a soft key by the
touch-panel
[Return]
0 Successful
1 Argument num is set incorrectly.
[Description]
This function enables or disables the output of the key code of a soft key by the
touch-panel.
0 : Enables output.
1 : Disables output.
By default, the output of the key code of a soft key by the touch panel is enabled.
- 1084 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING
Displayable characters
- 1085 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
4.1.1 Keycode
0x 1x 2x 3x 4x 5x 6x 7x
x0 SP 0 @ P
x1 1 A Q
x2 2 B R
x3 # 3 C S
x4 4 D T
x5 5 E U
x6 & 6 F V
x7 7 G W
x8 CAN ( 8 H X
x9 ) 9 I Y
xA EOB * J Z
xB + K [
xC , L
xD INPUT - M ]
xE . N
xF / ? O
8x 9x Ax Bx Cx Dx Ex Fx
x0 RESET F0
x1 F1
x2 F2
x3 F3
x4 INSERT F4
x5 DELETE F5
x6 ALTER F6
x7 F7
x8 Curs→ POS F8
x9 Curs← PROG F9
xA Curs↓ HELP OFS/SET
xB Curs↑ SYSTEM
xC MESSAGE
xD GRAPH
xE Page↓ CUSTOM1 FR
xF Page↑ CUSTOM2 FL
- Usage : For example, the keycode for the key 'A' is given as "41" (hex) by combining
"4x" and "x1".
- SP stands for space(white space).
- Function keys or screen selection keys, POS .. CUSTOM2, usually cannot be read from
application program.
- Keys F0 .. F9,FR,FL are soft-keys.
- 1086 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING
Displayable characters
- 1087 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
- 1088 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING
Displayable characters
Escape
Function
sequence
ESC [H Move cursor to the home position.
Move cursor to the c th column of the first line.
ESC [l;cH
(upper left corner of the screen is addressed as line 1, column 1)
ESC [nA Move cursor up n lines. (move 1 line if n is omitted.)
ESC [nB Move cursor down n lines. (move 1 line if n is omitted.)
ESC [nC Move cursor right n columns. (move 1 column if n is omitted.)
ESC [nD Move cursor left n columns. (move 1 column if n is omitted.)
Move cursor down 1 line. Scroll up one line if cursor is at the bottom
ESC D
line.
Move cursor to the left most column of the next line.
ESC E
Scroll up one line if cursor is at the bottom line.
ESC M Move cursor up 1 line. Scroll down one line if cursor is at the top line.
ESC [s Save current cursor position.
ESC [u Restore cursor to the position saved by "ESC [s".
(2) Deleting
Escape
Function
sequence
ESC [K Delete from current cursor position to end of line.
ESC [0K Delete from current cursor position to end of line.
ESC [1K Delete from current cursor position to beginning of line.
ESC [2K Delete current line.
ESC [J Delete from current cursor position to end of screen.
ESC [0J Delete from current cursor position to end of screen.
ESC [1J Delete from current cursor position to beginning of screen.
ESC [2J Delete whole screen.
- 1089 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
Escape
Function
sequence
Scroll current cursor line and succeeding lines down n lines, insert n blank
ESC [nL
lines and move cursor to the beginning of the first newly inserted blank line.
Delete n lines beginning from current cursor line to downward, scroll up
ESC [nM following lines and move cursor to the beginning of the first line of those
scrolled up.
Escape
Function
sequence
ESC [7h Turn on automatic wrapping around. (Default)
ESC [?7h Same as above.
ESC [7l Turn off automatic wrapping around.
ESC [?7l Same as above.
ESC [>5l Make cursor visible. (Default)
ESC [>5h Make cursor invisible.
ESC [>9l Output video signals to CRT. (Default)
ESC [>9h Not output video signals to CRT.
Escape
Function
sequence
ESC [0m Restore default attribute. (White, no blinking, no reverse video)
ESC [5m Turn on blinking.
ESC [7m Turn on reverse video mode.
ESC [25m Turn off blinking.
ESC [27m Turn off reverse video mode.
ESC [30m Black.
ESC [31m Red.
ESC [32m Green.
ESC [33m Yellow.
ESC [34m Blue.
ESC [35m Magenta.
ESC [36m Cyan.
ESC [37m White.
- 1090 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING
Displayable characters
For VGA display device, additional escape sequences are available as follows.
Escape
Function
sequence
ESC [1m Turn on low intensity color.
ESC [2m Don't draw background part of character.
ESC [3m Turn on low intensity color for background.
ESC [21m Draw background part of character. (Default)
ESC [22m Turn off low intensity color.
ESC [23m Turn off low intensity color for background.
ESC [40m Background black.
ESC [41m Background red.
ESC [42m Background green.
ESC [43m Background yellow.
ESC [44m Background blue.
ESC [45m Background magenta.
ESC [46m Background cyan.
ESC [47m Background white.
On VGA display device, actual displayed colors for each escape sequence are defined by
setting of color palettes for character display.
The color palettes for character display are changeable by crt_setpalette function.
- 1091 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
Escape
Function
sequence
Select special characters and fragment set of 6x magnified numeric
ESC (1
characters.
ESC (2 Select fragment set of 6x magnified alphabetic characters.
ESC (3 Select graphic character set.
ESC (4 Select standard character set.(Default)
ESC (6 Select 6x magnified character set.
ESC (7 Select European character set (umlaut etc.)
ESC (8 Select user defined character set.
ESC (A Select JIS Kanji character set (Shift-JIS code).
ESC (B Select FANUC Kanji character set (Shift-JIS code).(Default)
ESC (C Select FANUC Kanji character set(Shift-FANUC code).
ESC (a Select JIS character set (half-size, large font).
ESC (b Select JIS character set (half-size, small font).
ESC (E Select 8.4-inch font.
ESC (F Select 10.4-inch font. (Default)
- 1092 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
The characters, 20-7F, A0-DF, shown in the following table can be displayed on the screen.
0 1 2 3 4 5 6 7 8 9 A B C D E F
0000
0010
0020 ! " # $ % & ' ( ) * + , - . /
0030 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
0040 @ A B C D E F G H I J K L M N O
0050 P Q R S T U V W X Y Z [ ¥ ] ^ _
0060 ` a b c d e f g h i j k l m n o
0070 p q r s t u v w x y z { | } ~
0080
0090
00A0 。 「 」 、 ・ ヲ ァ ィ ゥ ェ ォ ャ ュ ョ ッ
00B0 ー ア イ ウ エ オ カ キ ク ケ コ サ シ ス セ ソ
00C0 タ チ ツ テ ト ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ マ
00D0 ミ ム メ モ ヤ ム ヨ ラ リ ル レ ロ ワ ン ゙ ゚
00E0
00F0
(Note) Mesh mark is displayed for the character code 7F, and wave mark for A0.
Above is the code table for the standard character set. ( "ESC (4" )
- 1093 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
Following KANJI characters of JIS 1st level character set are available in C Language Executor.
The characters in parentheses cannot be displayed. If these characters are output, double width
space is displayed instead. FANUC original special marks are assigned to 885F through 889D of
SJIS code. These special marks are described later.
SJIS [ JIS ] +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
8140 [2121] 、 。 , . ・ : ; ? ! ゛ ゜ ´ ` ¨ ^
8150 [2131]  ̄ _ ヽ ヾ ゝ ゞ 〃 仝 々 〆 〇 ー ― ‐ / \
8160 [2141] ~ ∥ | … ‥ ‘ ’ “ ” ( ) 〔 〕 [ ] {
8170 [2151] } 〈 〉 《 》 「 」 『 』 【 】 + - ± ×
8180 [2160] ÷ = ≠ < > ≦ ≧ ∞ ∴ ♂ ♀ ° ′ ″ ℃ ¥
8190 [2170] $ ¢ £ % # & * @ § ☆ ★ ○ ● ◎ ◇ ◆
81A0 [2222] □ ■ △ ▲ ▽ ▼ ※ 〒 → ← ↑ ↓ 〓
81B0 [2232]
81C0 [2242]
81D0 [2252]
81E0 [2262]
81F0 [2272]
8240 [2321] 0
8250 [2331] 1 2 3 4 5 6 7 8 9
8260 [2341] A B C D E F G H I J K L M N O P
8270 [2351] Q R S T U V W X Y Z
8280 [2360] a b c d e f g h i j k l m n o
8290 [2370] p q r s t u v w x y z ぁ
82A0 [2422] あ ぃ い ぅ う ぇ え ぉ お か が き ぎ く ぐ け
82B0 [2432] げ こ ご さ ざ し じ す ず せ ぜ そ ぞ た だ ち
82C0 [2442] ぢ っ つ づ て で と ど な に ぬ ね の は ば ぱ
82D0 [2452] ひ び ぴ ふ ぶ ぷ へ べ ぺ ほ ぼ ぽ ま み む め
82E0 [2462] も ゃ や ゅ ゆ ょ よ ら り る れ ろ ゎ わ (ゐ) (ゑ)
82F0 [2472] を ん
8340 [2521] ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク グ
8350 [2531] ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ ダ
8360 [2541] チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ バ
8370 [2551] パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ
8380 [2560] ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ
8390 [2570] (ヰ) (ヱ) ヲ ン ヴ ヵ ヶ (Α)
83A0 [2622] (Β) (Γ) Δ (Ε) (Ζ) (Η) (Θ) (Ι) (Κ) (Λ) (Μ) (Ν) (Ξ) (Ο) (Π) (Ρ)
83B0 [2632] Σ (Τ) (Υ) (Φ) (Χ) (Ψ) Ω α
83C0 [2642] β γ (δ) ε (ζ) (η) θ (ι) (κ) (λ) μ (ν) (ξ) (ο) π (ρ)
83D0 [2652] (σ) (τ) (υ) φ (χ) (ψ) ω
83E0 [2662]
83F0 [2672]
8440 [2721] (А) (Б) (В) (Г) (Д) (Е) (Ё) (Ж) (З) (И) (Й) (К) (Л) (М) (Н) (О)
- 1094 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
SJIS [ JIS ] +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
8450 [2731] (П) (Р) (С) (Т) (У) (Ф) (Х) (Ц) (Ч) (Ш) (Щ) (Ъ) (Ы) (Ь) (Э) (Ю)
8460 [2741] (Я)
8470 [2751] (а) (б) (в) (г) (д) (е) (ё) (ж) (з) (и) (й) (к) (л) (м) (н)
8480 [2760] (о) (п) (р) (с) (т) (у) (ф) (х) (ц) (ч) (ш) (щ) (ъ) (ы) (ь) (э)
8490 [2770] (ю) (я)
84A0 [2822]
84B0 [2832]
84C0 [2842]
84D0 [2852]
84E0 [2862]
84F0 [2872]
8840 [2F21]
8850 [2F31] 01
8860 [2F41] 02 03 04 05 06 07 08 09 10 11 12 13 14
8870 [2F51] 15 16 17
8880 [2F60] 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
8890 [2F70] 34 35 36 37 38 39 40 41 42 43 44 45 46 47 亜
88A0 [3022] (唖) (娃) 阿 哀 愛 挨 (姶) 逢 (葵) (茜) (穐) 悪 握 (渥) 旭 (葦)
88B0 [3032] 芦 (鯵) (梓) 圧 斡 扱 宛 (姐) (虻) (飴) (絢) (綾) (鮎) (或) (粟) (袷)
88C0 [3042] 安 (庵) (按) 暗 案 闇 鞍 (杏) 以 伊 位 依 偉 囲 (夷) 委
88D0 [3052] 威 尉 (惟) 意 慰 易 椅 為 (畏) 異 移 維 緯 胃 萎 衣
88E0 [3062] (謂) 違 遺 医 井 (亥) 域 育 郁 (磯) 一 壱 (溢) 逸 稲 (茨)
88F0 [3072] 芋 (鰯) (允) 印 (咽) 員 因 姻 引 飲 (淫) (胤) (蔭)
8940 [3121] 院 陰 隠 韻 (吋) 右 宇 (烏) 羽 (迂) 雨 (卯) (鵜) (窺) (丑) (碓)
8950 [3131] (臼) 渦 嘘 唄 (欝) (蔚) (鰻) (姥) (厩) 浦 瓜 (閏) 噂 (云) 運 雲
8960 [3141] (荏) (餌) (叡) 営 (嬰) 影 映 (曳) 栄 永 泳 洩 (瑛) (盈) (穎) (頴)
8970 [3151] 英 衛 詠 鋭 液 疫 益 駅 悦 謁 越 閲 (榎) (厭) 円
8980 [3160] 園 (堰) (奄) 宴 延 (怨) (掩) 援 沿 演 炎 (焔) 煙 (燕) 猿 縁
8990 [3170] (艶) (苑) (薗) 遠 鉛 (鴛) 塩 (於) 汚 (甥) 凹 央 奥 往 応 押
89A0 [3222] (旺) 横 欧 殴 王 翁 (襖) (鴬) (鴎) 黄 岡 沖 (荻) 億 屋 憶
89B0 [3232] 臆 (桶) 牡 乙 (俺) 卸 恩 温 穏 音 下 化 仮 何 (伽) 価
89C0 [3242] 佳 加 可 (嘉) 夏 嫁 家 (寡) 科 暇 果 架 歌 河 火 (珂)
89D0 [3252] 禍 (禾) 稼 箇 花 (苛) (茄) 荷 華 菓 (蝦) 課 (嘩) 貨 (迦) 過
89E0 [3262] (霞) 蚊 (俄) (峨) 我 牙 画 (臥) 芽 (蛾) 賀 雅 餓 (駕) 介 会
89F0 [3272] 解 回 塊 壊 廻 快 怪 悔 (恢) 懐 戒 拐 改
8A40 [3321] (魁) (晦) 械 海 灰 界 皆 絵 (芥) (蟹) 開 階 貝 (凱) 劾 外
8A50 [3331] (咳) 害 (崖) 慨 概 涯 (碍) (蓋) 街 該 (鎧) (骸) (浬) (馨) (蛙) 垣
8A60 [3341] (柿) (蛎) (鈎) (劃) 嚇 各 (廓) 拡 (撹) 格 核 殻 獲 確 穫 覚
8A70 [3351] 角 (赫) 較 郭 閣 隔 革 学 岳 楽 額 (顎) 掛 笠 樫
8A80 [3360] (橿) (梶) (鰍) 潟 割 喝 (恰) 括 活 渇 滑 (葛) 褐 轄 且 (鰹)
8A90 [3370] (叶) (椛) (樺) (鞄) 株 (兜) (竃) (蒲) (釜) (鎌) (噛) (鴨) (栢) (茅) (萱) (粥)
8AA0 [3422] 刈 (苅) (瓦) 乾 (侃) 冠 寒 刊 勘 勧 巻 喚 堪 (姦) 完 官
8AB0 [3432] 寛 干 幹 患 感 慣 憾 換 敢 (柑) (桓) 棺 款 歓 汗 漢
8AC0 [3442] (澗) (潅) 環 甘 監 看 (竿) 管 簡 緩 缶 (翰) 肝 艦 (莞) 観
8AD0 [3452] (諌) 貫 還 鑑 間 閑 関 陥 韓 館 (舘) 丸 含 岸 (巌) (玩)
8AE0 [3462] (癌) 眼 岩 (翫) (贋) (雁) 頑 顔 願 企 (伎) 危 喜 器 基 奇
- 1095 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
SJIS [ JIS ] +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
8AF0 [3472] (嬉) 寄 岐 希 幾 忌 揮 机 旗 既 期 棋 棄
8B40 [3521] 機 帰 毅 気 汽 (畿) 祈 季 稀 紀 徽 規 記 貴 起 軌
8B50 [3531] 輝 飢 騎 鬼 (亀) 偽 儀 (妓) 宜 戯 技 擬 欺 犠 疑 (祇)
8B60 [3541] 義 (蟻) (誼) 議 (掬) 菊 (鞠) 吉 (吃) 喫 (桔) (橘) 詰 (砧) (杵) (黍)
8B70 [3551] 却 客 脚 虐 逆 丘 久 (仇) 休 及 吸 宮 弓 急 救
8B80 [3560] 朽 求 (汲) 泣 (灸) 球 究 窮 (笈) 級 糾 給 旧 牛 去 居
8B90 [3570] 巨 拒 拠 挙 (渠) 虚 許 距 (鋸) 漁 (禦) 魚 亨 享 京 供
8BA0 [3622] (侠) (僑) (兇) 競 共 凶 協 (匡) (卿) 叫 (喬) 境 峡 強 (彊) (怯)
8BB0 [3632] 恐 恭 挟 教 橋 況 狂 狭 矯 胸 脅 興 (蕎) 郷 鏡 響
8BC0 [3642] (饗) 驚 仰 凝 (尭) 暁 業 局 曲 極 玉 桐 (粁) (僅) 勤 均
8BD0 [3652] 巾 錦 斤 (欣) (欽) 琴 禁 (禽) 筋 緊 (芹) 菌 (衿) 襟 謹 近
8BE0 [3662] 金 吟 銀 九 (倶) 句 区 (狗) (玖) 矩 苦 (躯) 駆 (駈) (駒) 具
8BF0 [3672] 愚 虞 (喰) 空 偶 (寓) 遇 隅 (串) (櫛) (釧) 屑 屈
8C40 [3721] 掘 (窟) (沓) 靴 (轡) (窪) 熊 隈 (粂) (栗) 繰 桑 (鍬) 勲 君 薫
8C50 [3731] 訓 群 軍 郡 (卦) (袈) (祁) 係 傾 刑 兄 啓 (圭) (珪) 型 契
8C60 [3741] 形 径 恵 慶 (慧) 憩 掲 携 敬 景 (桂) 渓 (畦) (稽) 系 経
8C70 [3751] 継 (繋) (罫) 茎 (荊) 蛍 計 (詣) 警 軽 (頚) 鶏 芸 迎 鯨
8C80 [3760] 劇 (戟) 撃 激 隙 桁 傑 欠 決 潔 穴 結 血 (訣) 月 件
8C90 [3770] 倹 (倦) 健 兼 券 剣 (喧) 圏 堅 嫌 建 憲 懸 拳 (捲) 検
8CA0 [3822] 権 (牽) 犬 献 研 (硯) 絹 県 肩 見 謙 賢 軒 遣 鍵 険
8CB0 [3832] 顕 験 (鹸) 元 原 厳 幻 弦 減 源 玄 現 (絃) (舷) 言 (諺)
8CC0 [3842] 限 (乎) 個 古 呼 固 (姑) 孤 己 庫 弧 戸 故 枯 湖 狐
8CD0 [3852] (糊) (袴) (股) (胡) (菰) (虎) 誇 (跨) (鈷) 雇 顧 鼓 五 互 (伍) 午
8CE0 [3862] 呉 (吾) 娯 後 御 悟 (梧) (檎) (瑚) 碁 語 誤 護 (醐) (乞) (鯉)
8CF0 [3872] 交 (佼) 侯 候 (倖) 光 公 功 効 勾 厚 口 向
8D40 [3921] 后 喉 坑 (垢) 好 孔 孝 (宏) 工 巧 (巷) 幸 広 (庚) 康 弘
8D50 [3931] 恒 慌 抗 拘 控 攻 (昂) (晃) 更 (杭) 校 (梗) 構 江 洪 浩
8D60 [3941] 港 溝 甲 皇 硬 稿 (糠) 紅 (紘) 絞 綱 耕 考 肯 (肱) (腔)
8D70 [3951] (膏) 航 荒 行 衡 講 貢 購 郊 酵 鉱 (砿) 鋼 (閤) 降
8D80 [3960] 項 香 高 (鴻) 剛 (劫) 号 合 (壕) 拷 (濠) 豪 (轟) (麹) 克 刻
8D90 [3970] 告 国 穀 酷 (鵠) 黒 獄 (漉) 腰 (甑) (忽) (惚) 骨 (狛) 込 此
8DA0 [3A22] 頃 今 困 (坤) 墾 婚 恨 懇 (昏) 昆 根 (梱) 混 (痕) 紺 (艮)
8DB0 [3A32] 魂 (些) 佐 (叉) 唆 (嵯) 左 差 査 (沙) (瑳) 砂 詐 鎖 (裟) (坐)
8DC0 [3A42] 座 挫 債 催 再 最 (哉) (塞) 妻 宰 彩 才 採 栽 歳 済
8DD0 [3A52] 災 (采) (犀) 砕 (砦) 祭 斎 細 菜 裁 載 際 剤 在 材 罪
8DE0 [3A62] 財 (冴) 坂 阪 (堺) (榊) (肴) 咲 崎 (埼) (碕) (鷺) 作 削 (咋) 搾
8DF0 [3A72] 昨 (朔) 柵 (窄) 策 索 錯 桜 (鮭) (笹) (匙) 冊 刷
8E40 [3B21] 察 拶 撮 擦 札 殺 (薩) 雑 (皐) (鯖) (捌) (錆) (鮫) 皿 (晒) 三
8E50 [3B31] 傘 参 山 惨 撒 散 桟 (燦) (珊) 産 算 (纂) 蚕 讃 賛 酸
8E60 [3B41] (餐) (斬) 暫 残 仕 (仔) 伺 使 刺 司 史 嗣 四 士 始 姉
8E70 [3B51] 姿 子 (屍) 市 師 志 思 指 支 (孜) (斯) 施 旨 枝 止
8E80 [3B60] 死 氏 (獅) 祉 私 糸 紙 紫 肢 脂 至 視 詞 詩 試 誌
8E90 [3B70] 諮 資 賜 雌 飼 歯 事 似 侍 児 字 寺 慈 持 時 次
8EA0 [3C22] 滋 治 (爾) 璽 (痔) 磁 示 (而) 耳 自 (蒔) 辞 (汐) (鹿) 式 識
8EB0 [3C32] (鴫) (竺) 軸 (宍) (雫) 七 (叱) 執 失 (嫉) 室 (悉) 湿 漆 疾 質
8EC0 [3C42] 実 (蔀) (篠) (偲) (柴) 芝 (屡) (蕊) 縞 舎 写 射 捨 赦 斜 煮
- 1096 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
SJIS [ JIS ] +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
8ED0 [3C52] 社 (紗) 者 謝 車 遮 蛇 邪 借 勺 尺 (杓) (灼) 爵 酌 釈
8EE0 [3C62] (錫) 若 寂 弱 (惹) 主 取 守 手 朱 殊 狩 珠 種 (腫) 趣
8EF0 [3C72] 酒 首 儒 受 (呪) 寿 授 樹 (綬) 需 囚 収 周
8F40 [3D21] 宗 就 州 修 愁 拾 (洲) 秀 秋 終 (繍) 習 臭 舟 (蒐) 衆
8F50 [3D31] 襲 (讐) 蹴 (輯) 週 (酋) 酬 集 醜 (什) 住 充 十 従 (戎) 柔
8F60 [3D41] 汁 渋 獣 縦 重 銃 叔 (夙) 宿 淑 祝 縮 粛 塾 熟 出
8F70 [3D51] 術 述 俊 (峻) 春 瞬 (竣) (舜) (駿) 准 循 旬 (楯) 殉 (淳)
8F80 [3D60] 準 潤 盾 純 巡 遵 (醇) 順 処 初 所 暑 (曙) (渚) 庶 緒
8F90 [3D70] 署 書 (薯) (藷) 諸 助 叙 女 序 徐 (恕) (鋤) 除 傷 償 勝
8FA0 [3E22] 匠 升 召 (哨) 商 唱 (嘗) 奨 (妾) (娼) 宵 将 小 少 尚 (庄)
8FB0 [3E32] 床 (廠) 彰 承 抄 招 掌 (捷) 昇 昌 昭 晶 松 (梢) (樟) (樵)
8FC0 [3E42] 沼 消 渉 (湘) 焼 焦 照 症 省 硝 礁 祥 称 章 笑 粧
8FD0 [3E52] 紹 肖 (菖) (蒋) (蕉) 衝 (裳) 訟 証 詔 詳 象 賞 (醤) (鉦) (鍾)
8FE0 [3E62] 鐘 障 (鞘) 上 丈 (丞) 乗 冗 剰 城 場 壌 嬢 常 情 (擾)
8FF0 [3E72] 条 (杖) 浄 状 畳 (穣) 蒸 譲 醸 錠 嘱 (埴) 飾
9040 [3F21] (拭) 植 殖 (燭) 織 職 色 触 食 (蝕) 辱 (尻) 伸 信 侵 唇
9050 [3F31] 娠 寝 審 心 慎 振 新 (晋) 森 (榛) 浸 深 申 (疹) 真 神
9060 [3F41] (秦) 紳 臣 芯 薪 親 診 身 辛 進 針 震 人 仁 刃 (塵)
9070 [3F51] (壬) 尋 甚 尽 (腎) (訊) 迅 陣 靭 (笥) (諏) 須 酢 図 (厨)
9080 [3F60] (逗) 吹 垂 帥 推 水 炊 睡 粋 (翠) 衰 遂 酔 錐 錘 随
9090 [3F70] (瑞) 髄 崇 (嵩) 数 枢 (趨) (雛) 据 杉 (椙) 菅 (頗) (雀) 裾 澄
90A0 [4022] (摺) 寸 世 瀬 畝 是 (凄) 制 勢 姓 征 性 成 政 整 星
90B0 [4032] 晴 (棲) (栖) 正 清 牲 生 盛 精 聖 声 製 西 誠 誓 請
90C0 [4042] 逝 (醒) 青 静 斉 税 脆 隻 席 惜 (戚) 斥 昔 析 石 積
90D0 [4052] 籍 績 (脊) 責 赤 跡 (蹟) (碩) 切 拙 接 摂 折 設 窃 節
90E0 [4062] 説 雪 絶 舌 (蝉) 仙 先 千 占 宣 専 尖 川 戦 扇 (撰)
90F0 [4072] 栓 (栴) 泉 浅 洗 染 潜 (煎) (煽) 旋 (穿) (箭) 線
9140 [4121] 繊 (羨) (腺) (舛) 船 薦 (詮) (賎) 践 選 遷 銭 銑 (閃) 鮮 前
9150 [4131] 善 漸 然 全 禅 繕 (膳) (糎) (噌) 塑 (岨) 措 (曾) (曽) (楚) (狙)
9160 [4141] (疏) 疎 礎 祖 租 粗 素 組 (蘇) 訴 阻 (遡) (鼠) 僧 創 双
9170 [4151] (叢) 倉 喪 壮 奏 (爽) (宋) 層 (匝) (惣) 想 捜 掃 挿 (掻)
9180 [4160] 操 早 曹 巣 (槍) 槽 (漕) 燥 争 (痩) 相 窓 (糟) 総 (綜) (聡)
9190 [4170] 草 荘 葬 (蒼) 藻 装 走 送 遭 (鎗) 霜 騒 像 増 憎 臓
91A0 [4222] 蔵 贈 造 促 側 則 即 息 (捉) 束 測 足 速 俗 属 賊
91B0 [4232] 族 続 卒 (袖) 其 揃 存 孫 尊 損 村 (遜) 他 多 太 (汰)
91C0 [4242] 詑 (唾) 堕 妥 惰 打 (柁) 舵 (楕) (陀) 駄 (騨) 体 (堆) 対 耐
91D0 [4252] (岱) 帯 待 怠 態 戴 替 泰 滞 胎 (腿) (苔) 袋 貸 退 逮
91E0 [4262] 隊 (黛) (鯛) 代 台 大 第 (醍) 題 (鷹) 滝 瀧 卓 (啄) 宅 (托)
91F0 [4272] 択 拓 沢 濯 (琢) 託 (鐸) 濁 諾 (茸) (凧) (蛸) (只)
9240 [4321] 叩 但 達 (辰) 奪 脱 (巽) (竪) (辿) 棚 谷 (狸) (鱈) (樽) 誰 丹
9250 [4331] 単 嘆 (坦) 担 探 旦 (歎) 淡 (湛) 炭 短 端 (箪) (綻) (耽) 胆
9260 [4341] (蛋) 誕 鍛 団 壇 弾 断 暖 (檀) 段 男 談 値 知 地 (弛)
9270 [4351] 恥 (智) 池 痴 稚 置 致 (蜘) 遅 馳 築 畜 竹 筑 蓄
9280 [4360] 逐 秩 窒 茶 嫡 着 中 仲 宙 忠 抽 昼 柱 注 虫 衷
9290 [4370] (註) (酎) 鋳 駐 (樗) (瀦) (猪) (苧) 著 貯 丁 兆 (凋) (喋) (寵) (帖)
92A0 [4422] 帳 庁 弔 張 彫 徴 懲 挑 (暢) 朝 潮 (牒) 町 眺 聴 脹
- 1097 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
SJIS [ JIS ] +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
92B0 [4432] 腸 (蝶) 調 (諜) 超 跳 (銚) 長 頂 鳥 勅 (捗) 直 朕 沈 珍
92C0 [4442] 賃 鎮 陳 津 墜 (椎) (槌) 追 (鎚) 痛 通 塚 (栂) (掴) 槻 (佃)
92D0 [4452] 漬 (柘) (辻) (蔦) (綴) (鍔) (椿) (潰) 坪 (壷) (嬬) (紬) 爪 吊 釣 (鶴)
92E0 [4462] 亭 低 停 偵 (剃) 貞 呈 堤 定 帝 底 庭 廷 弟 (悌) 抵
92F0 [4472] (挺) 提 (梯) (汀) (碇) (禎) 程 締 艇 訂 (諦) (蹄) 逓
9340 [4521] 邸 (鄭) 釘 (鼎) 泥 摘 (擢) 敵 滴 的 笛 適 (鏑) (溺) 哲 徹
9350 [4531] 撤 (轍) 迭 鉄 典 (填) 天 展 店 添 (纏) (甜) 貼 転 (顛) 点
9360 [4541] 伝 殿 澱 田 電 (兎) 吐 (堵) 塗 (妬) (屠) 徒 斗 (杜) 渡 登
9370 [4551] (菟) (賭) 途 都 (鍍) 砥 (砺) 努 度 土 奴 怒 倒 党 冬
9380 [4560] 凍 刀 唐 塔 (塘) (套) (宕) 島 (嶋) 悼 投 搭 東 桃 (梼) 棟
9390 [4570] 盗 (淘) 湯 (涛) 灯 (燈) 当 痘 (祷) 等 答 筒 糖 統 到 (董)
93A0 [4622] (蕩) 藤 討 謄 豆 踏 逃 透 (鐙) 陶 頭 騰 闘 働 動 同
93B0 [4632] 堂 導 (憧) (撞) 洞 (瞳) 童 胴 (萄) 道 銅 峠 (鴇) 匿 得 徳
93C0 [4642] (涜) 特 督 (禿) 篤 毒 独 読 (栃) (橡) 凸 突 (椴) 届 (鳶) (苫)
93D0 [4652] (寅) (酉) (瀞) (噸) 屯 (惇) (敦) (沌) 豚 (遁) (頓) (呑) 曇 鈍 (奈) (那)
93E0 [4662] 内 (乍) (凪) (薙) 謎 (灘) (捺) 鍋 (楢) 馴 縄 (畷) 南 (楠) 軟 難
93F0 [4672] (汝) 二 尼 弐 (迩) 匂 (賑) 肉 (虹) (廿) 日 乳 入
9440 [4721] 如 尿 (韮) 任 妊 忍 認 (濡) (禰) (祢) 寧 (葱) 猫 熱 年 念
9450 [4731] (捻) (撚) 燃 粘 (乃) (廼) (之) (埜) (嚢) 悩 濃 納 能 脳 (膿) 農
9460 [4741] (覗) (蚤) (巴) 把 (播) 覇 (杷) 波 派 (琶) 破 婆 (罵) (芭) 馬 俳
9470 [4751] 廃 拝 排 敗 杯 (盃) (牌) 背 肺 輩 配 倍 培 媒 梅
9480 [4760] (楳) (煤) (狽) 買 売 賠 陪 (這) (蝿) (秤) (矧) (萩) 伯 (剥) 博 拍
9490 [4770] (柏) 泊 白 (箔) (粕) 舶 薄 迫 (曝) 漠 爆 縛 (莫) (駁) 麦 (函)
94A0 [4822] 箱 (硲) (箸) (肇) (筈) (櫨) (幡) 肌 畑 (畠) 八 鉢 (溌) 発 (醗) 髪
94B0 [4832] 伐 罰 抜 (筏) 閥 (鳩) (噺) (塙) (蛤) (隼) 伴 判 半 反 (叛) 帆
94C0 [4842] 搬 (斑) 板 (氾) 汎 版 犯 班 畔 繁 般 藩 販 範 (釆) 煩
94D0 [4852] 頒 飯 (挽) 晩 番 盤 (磐) (蕃) 蛮 (匪) 卑 否 妃 (庇) 彼 悲
94E0 [4862] 扉 批 披 (斐) 比 泌 疲 皮 碑 秘 (緋) 罷 肥 被 (誹) 費
94F0 [4872] 避 非 飛 (樋) (簸) 備 尾 微 (枇) (毘) (琵) (眉) 美
9540 [4921] 鼻 (柊) (稗) 匹 (疋) (髭) 彦 (膝) 菱 (肘) (弼) 必 (畢) 筆 (逼) (桧)
9550 [4931] 姫 (媛) (紐) 百 (謬) 俵 (彪) 標 氷 漂 (瓢) 票 表 評 (豹) (廟)
9560 [4941] 描 病 秒 苗 (錨) (鋲) (蒜) (蛭) (鰭) 品 (彬) (斌) 浜 (瀕) 貧 賓
9570 [4951] 頻 敏 瓶 不 付 (埠) 夫 婦 富 (冨) 布 府 怖 扶 敷
9580 [4960] (斧) 普 浮 父 符 腐 膚 (芙) 譜 負 賦 赴 (阜) 附 侮 (撫)
9590 [4970] 武 舞 (葡) (蕪) 部 封 (楓) 風 (葺) (蕗) 伏 副 復 幅 服 福
95A0 [4A22] 腹 複 覆 (淵) (弗) 払 沸 仏 物 (鮒) 分 (吻) 噴 墳 憤 (扮)
95B0 [4A32] (焚) 奮 粉 (糞) 紛 雰 文 聞 丙 併 兵 塀 幣 平 弊 柄
95C0 [4A42] 並 (蔽) 閉 陛 米 頁 (僻) 壁 癖 (碧) 別 (瞥) (蔑) (箆) 偏 変
95D0 [4A52] 片 (篇) 編 辺 返 遍 便 勉 (娩) 弁 (鞭) 保 舗 (鋪) (圃) 捕
95E0 [4A62] 歩 (甫) 補 (輔) 穂 募 墓 慕 (戊) 暮 母 簿 (菩) 倣 俸 包
95F0 [4A72] (呆) 報 奉 宝 峰 (峯) 崩 (庖) 抱 捧 放 方 (朋)
9640 [4B21] 法 泡 (烹) 砲 縫 胞 芳 (萌) (蓬) (蜂) 褒 訪 豊 邦 (鋒) 飽
9650 [4B31] (鳳) (鵬) 乏 亡 傍 剖 坊 妨 帽 忘 忙 房 暴 望 某 棒
9660 [4B41] 冒 紡 肪 膨 謀 (貌) 貿 (鉾) 防 (吠) (頬) 北 僕 (卜) 墨 撲
9670 [4B51] 朴 牧 (睦) (穆) 釦 (勃) 没 (殆) 堀 (幌) 奔 本 翻 凡 盆
9680 [4B60] 摩 磨 魔 麻 埋 妹 (昧) 枚 毎 (哩) (槙) 幕 膜 (枕) (鮪) (柾)
- 1098 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
SJIS [ JIS ] +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
9690 [4B70] (鱒) (桝) (亦) (俣) 又 抹 末 (沫) 迄 (侭) 繭 (麿) 万 慢 満 漫
96A0 [4C22] (蔓) 味 未 魅 (巳) (箕) 岬 密 (蜜) (湊) (蓑) (稔) 脈 妙 (粍) 民
96B0 [4C32] 眠 務 夢 無 (牟) 矛 霧 (鵡) (椋) 婿 娘 (冥) 名 命 明 盟
96C0 [4C42] 迷 銘 鳴 (姪) (牝) 滅 免 (棉) 綿 (緬) 面 (麺) (摸) 模 茂 妄
96D0 [4C52] (孟) 毛 猛 盲 網 耗 (蒙) (儲) 木 黙 目 (杢) (勿) (餅) (尤) 戻
96E0 [4C62] (籾) (貰) 問 (悶) 紋 門 匁 (也) 冶 夜 (爺) (耶) 野 (弥) 矢 厄
96F0 [4C72] 役 約 薬 訳 躍 靖 柳 (薮) (鑓) 愉 (愈) 油 癒
9740 [4D21] 諭 輸 唯 (佑) 優 勇 友 (宥) 幽 悠 憂 (揖) 有 (柚) (湧) (涌)
9750 [4D31] 猶 (猷) 由 (祐) 裕 誘 遊 (邑) 郵 雄 融 夕 予 余 与 誉
9760 [4D41] (輿) 預 (傭) 幼 (妖) 容 庸 揚 揺 擁 曜 (楊) 様 洋 溶 (熔)
9770 [4D51] 用 窯 羊 (耀) 葉 (蓉) 要 謡 踊 (遥) 陽 養 (慾) 抑 (欲)
9780 [4D60] (沃) 浴 翌 翼 (淀) 羅 螺 裸 来 (莱) 頼 雷 (洛) 絡 落 酪
9790 [4D70] 乱 卵 (嵐) 欄 濫 (藍) (蘭) 覧 利 吏 履 (李) (梨) 理 (璃) 痢
97A0 [4E22] 裏 (裡) 里 離 陸 律 率 立 (葎) (掠) 略 (劉) 流 (溜) (琉) 留
97B0 [4E32] 硫 粒 隆 竜 (龍) (侶) 慮 旅 虜 了 (亮) 僚 両 (凌) 寮 料
97C0 [4E42] (梁) 涼 猟 療 (瞭) 稜 糧 良 (諒) (遼) 量 陵 領 力 緑 倫
97D0 [4E52] 厘 林 (淋) (燐) (琳) 臨 輪 隣 (鱗) (麟) (瑠) 塁 涙 累 類 令
97E0 [4E62] (伶) 例 冷 励 (嶺) (怜) (玲) 礼 (苓) 鈴 隷 零 霊 麗 齢 暦
97F0 [4E72] 歴 列 劣 烈 裂 廉 恋 (憐) (漣) (煉) (簾) 練 (聯)
9840 [4F21] (蓮) 連 錬 (呂) (魯) (櫓) 炉 (賂) 路 露 労 (婁) 廊 (弄) 朗 楼
9850 [4F31] (榔) 浪 漏 (牢) (狼) (篭) 老 (聾) (蝋) 郎 六 (麓) (禄) (肋) 録 論
9860 [4F41] (倭) 和 話 歪 賄 脇 惑 枠 (鷲) (亙) (亘) (鰐) 詫 (藁) (蕨) (椀)
9870 [4F51] 湾 (碗) 腕
Only following Kanji characters in JIS 2nd level character set are available for display. If
JIS 2nd level Kanji characters other than following are output, double width space is displayed
instead.
SJIS [ JIS ]
9AA0 [5422] 國
9D8A [596A] 搖
9E8A [5B6A] 條
9F4E [5D2F] 櫻
E056 [5F37] 澤
E068 [5F49] 濾
E1EF [6271] 碌
E36A [654B] 緞
E863 [6F44] 鐵
- 1099 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
The FANUC special marks which are assigned to JIS 1st level character set code are shown below.
- 1100 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
- 1101 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
The DIAB-SDS compiler does not support Japanese language. If a 2-byte character whose second
byte happens to be 5Ch is included directly in a source file, it is not recognized as correct
data.
Example) printf("表示") ; NG
printf("表\示") ; OK
The characters that need to be followed by '\' are shown in the figure on the left side.
* Note
The JIS 2nd level characters cannot be displayed even if followed by '\'.
JIS 1st level character set JIS 2nd level character set
SJIS [ JIS ] SJIS [ JIS ]
815C [213D] ― 995C [513D] (兔)
835C [253D] ソ 9A5C [533D] (喀)
845C [273D] (Ы) 9B5C [553D] (媾)
875C [2F3D] (Ⅸ) 9C5C [573D] (彌)
895C [313D] 噂 9D5C [593D] (拿)
8A5C [333D] (浬) 9E5C [5B3D] (杤)
8B5C [353D] 欺 9F5C [5D3D] (歃)
8C5C [373D] (圭) E05C [5F3D] (濬)
8D5C [393D] 構 E15C [613D] (畚)
8E5C [3B3D] 蚕 E25C [633D] (秉)
8F5C [3D3D] 十 E35C [653D] (綵)
905C [3F3D] 申 E45C [673D] (臀)
915C [413D] (曾) E55C [693D] (藹)
925C [433D] (箪) E65C [6B3D] (觸)
935C [453D] 貼 E75C [6D3C] (軆)
945C [473D] 能 E85C [6F3D] (鐔)
955C [493D] 表 E95C [713D] (饅)
965C [4B3D] 暴 EA5C [733D] (鷭)
975C [4D3D] 予 ED5C [793D] (偆)
985C [4F3D] (禄) EE5C [7B3D] (砡)
FA5C [933D] (纊)
FB5C [953D] (犾)
- 1102 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
In the following tables, the code of the FANUC characters in each character set selected by
the escape sequences, "ESC (x", are shown. . If , for example,0x20 (space) is output in the "ESC
(1" mode, FANUC character of the code 0x00E0 is displayed on the screen.
2x 3x 4x 5x 6x 7x Ax Bx Cx Dx
x0 00E0 00F8 0108 0118 0128 0138 0760 0770 01F0
x1 00E1 00F9 0109 0119 0129 0139 0761 0771 01F1
x2 00E2 00FA 010A 011A 012A 013A 0752 0762 0772 01F2
x3 00E3 00FB 010B 011B 012B 013B 0753 0763 0773 01F3
x4 00E4 00FC 010C 011C 012C 01D8 0754 0764 01E4 01F4
x5 00E5 00FD 010D 011D 012D 01D9 0755 0765 01E5 01F5
x6 00E6 00FE 010E 011E 012E 01DA 0756 0766 01E6 01F6
x7 00E7 00FF 010F 011F 012F 01DB 0757 0767 01E7 01F7
x8 00F0 0100 0110 0120 0130 01DC 0758 0768 01E8 01F8
x9 00F1 0101 0111 0121 0131 01DD 0759 0769 01E9 01F9
xA 00F2 0102 0112 0122 0132 01DE 075A 076A 01EA 01FA
xB 00F3 0103 0113 0123 0133 01DF 075B 076B 01EB 01FB
xC 00F4 0104 0114 0124 0134 01E0 075C 076C 01EC 01FC
xD 00F5 0105 0115 0125 0135 01E1 075D 076D 01ED 01FD
xE 00F6 0106 0116 0126 0136 01E2 075E 076E 01EE 01FE
xF 00F7 0107 0117 0127 0137 01E3 075F 076F 01EF 01FF
- 1103 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
2x 3x 4x 5x 6x 7x Ax Bx Cx Dx
x0 013C 014C 015C 016C 017C 018C 019C 01AC 01BC 01CC
x1 013D 014D 015D 016D 017D 018D 019D 01AD 01BD 01CD
x2 013E 014E 015E 016E 017E 018E 019E 01AE 01BE 01CE
x3 013F 014F 015F 016F 017F 018F 019F 01AF 01BF 01CF
x4 0140 0150 0160 0170 0180 0190 01A0 01B0 01C0 01D0
x5 0141 0151 0161 0171 0181 0191 01A1 01B1 01C1 01D1
x6 0142 0152 0162 0172 0182 0192 01A2 01B2 01C2 01D2
x7 0143 0153 0163 0173 0183 0193 01A3 01B3 01C3 01D3
x8 0144 0154 0164 0174 0184 0194 01A4 01B4 01C4 01D4
x9 0145 0155 0165 0175 0185 0195 01A5 01B5 01C5 01D5
xA 0146 0156 0166 0176 0186 0196 01A6 01B6 01C6 01D6
xB 0147 0157 0167 0177 0187 0197 01A7 01B7 01C7 01D7
xC 0148 0158 0168 0178 0188 0198 01A8 01B8 01C8
xD 0149 0159 0169 0179 0189 0199 01A9 01B9 01C9
xE 014A 015A 016A 017A 018A 019A 01AA 01BA 01CA
xF 014B 015B 016B 017B 018B 019B 01AB 01BB 01CB
- 1104 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
2x 3x 4x 5x 6x 7x Ax Bx Cx Dx
x0 1D50 1D60 1D70 1D80 1D90 1DA0 1DB0 1DC0 1DD0 1DE0
x1 1D51 1D61 1D71 1D81 1D91 1DA1 1DB1 1DC1 1DD1 1DE1
x2 1D52 1D62 1D72 1D82 1D92 1DA2 1DB2 1DC2 1DD2 1DE2
x3 1D53 1D63 1D73 1D83 1D93 1DA3 1DB3 1DC3 1DD3 1DE3
x4 1D54 1D64 1D74 1D84 1D94 1DA4 1DB4 1DC4 1DD4 1DE4
x5 1D55 1D65 1D75 1D85 1D95 1DA5 1DB5 1DC5 1DD5 1DE5
x6 1D56 1D66 1D76 1D86 1D96 1DA6 1DB6 1DC6 1DD6 1DE6
x7 1D57 1D67 1D77 1D87 1D97 1DA7 1DB7 1DC7 1DD7 1DE7
x8 1D58 1D68 1D78 1D88 1D98 1DA8 1DB8 1DC8 1DD8 1DE8
x9 1D59 1D69 1D79 1D89 1D99 1DA9 1DB9 1DC9 1DD9 1DE9
xA 1D5A 1D6A 1D7A 1D8A 1D9A 1DAA 1DBA 1DCA 1DDA 1DEA
xB 1D5B 1D6B 1D7B 1D8B 1D9B 1DAB 1DBB 1DCB 1DDB 1DEB
xC 1D5C 1D6C 1D7C 1D8C 1D9C 1DAC 1DBC 1DCC 1DDC 1DEC
xD 1D5D 1D6D 1D7D 1D8D 1D9D 1DAD 1DBD 1DCD 1DDD 1DED
xE 1D5E 1D6E 1D7E 1D8E 1D9E 1DAE 1DBE 1DCE 1DDE 1DEE
xF 1D5F 1D6F 1D7F 1D8F 1D9F 1DAF 1DBF 1DCF 1DDF 1DEF
2x 3x 4x 5x 6x 7x Ax Bx Cx Dx
x0 0020 0030 0040 0050 0F80 0F90 00A0 00B0 00C0 00D0
x1 0021 0031 0041 0051 0F81 0F91 00A1 00B1 00C1 00D1
x2 0022 0032 0042 0052 0F82 0F92 00A2 00B2 00C2 00D2
x3 0023 0033 0043 0053 0F83 0F93 00A3 00B3 00C3 00D3
x4 0024 0034 0044 0054 0F84 0F94 00A4 00B4 00C4 00D4
x5 0025 0035 0045 0055 0F85 0F95 00A5 00B5 00C5 00D5
x6 0026 0036 0046 0056 0F86 0F96 00A6 00B6 00C6 00D6
x7 0027 0037 0047 0057 0F87 0F97 00A7 00B7 00C7 00D7
x8 0028 0038 0048 0058 0F88 0F98 00A8 00B8 00C8 00D8
x9 0029 0039 0049 0059 0F89 0F99 00A9 00B9 00C9 00D9
xA 002A 003A 004A 005A 0F8A 0F9A 00AA 00BA 00CA 00DA
xB 002B 003B 004B 005B 0F8B 0F9B 00AB 00BB 00CB 00DB
xC 002C 003C 004C 005C 0F8C 0F9C 00AC 00BC 00CC 00DC
xD 002D 003D 004D 005D 0F8D 0F9D 00AD 00BD 00CD 00DD
xE 002E 003E 004E 005E 0F8E 0F9E 00AE 00BE 00CE 00DE
xF 002F 003F 004F 005F 0F8F 0F9F 00AF 00BF 00CF 00DF
- 1105 -
4. Keycode, screen control code
and Displayable characters PROGRAMMING B-64303EN-3/01
2x 3x 4x 5x 6x 7x Ax Bx Cx Dx
x0 0100 0196
x1 0106 013C 019C
x2 010C 0142 01A2 1CE0
x3 0112 0148 01A8 1CE6
x4 0118 014E 01AE 1CEC
x5 011E 0154 01B4
x6 0124 015A 01BA
x7 012A 0160 01C0
x8 0130 0166 01C6
x9 0136 016C 01CC
xA 0172 01D2
xB 0178
xC 017E
xD 01D8 0184
xE 01DE 018A
xF 0190
2x 3x 4x 5x 6x 7x Ax Bx Cx Dx
x0 0020 0030 0040 0050 0F80 0F90 0FC0 0FD0 0FE0 0FF0
x1 0021 0031 0041 0051 0F81 0F91 0FC1 0FD1 0FE1 0FF1
x2 0022 0032 0042 0052 0F82 0F92 0FC2 0FD2 0FE2 0FF2
x3 0023 0033 0043 0053 0F83 0F93 0FC3 0FD3 0FE3 0FF3
x4 0024 0034 0044 0054 0F84 0F94 0FC4 0FD4 0FE4 0FF4
x5 0025 0035 0045 0055 0F85 0F95 0FC5 0FD5 0FE5 0FF5
x6 0026 0036 0046 0056 0F86 0F96 0FC6 0FD6 0FE6 0FF6
x7 0027 0037 0047 0057 0F87 0F97 0FC7 0FD7 0FE7 0FF7
x8 0028 0038 0048 0058 0F88 0F98 0FC8 0FD8 0FE8 0FF8
x9 0029 0039 0049 0059 0F89 0F99 0FC9 0FD9 0FE9 0FF9
xA 002A 003A 004A 005A 0F8A 0F9A 0FCA 0FDA 0FEA 0FFA
xB 002B 003B 004B 005B 0F8B 0F9B 0FCB 0FDB 0FEB 0FFB
xC 002C 003C 004C 005C 0F8C 0F9C 0FCC 0FDC 0FEC 0FFC
xD 002D 003D 004D 005D 0F8D 0F9D 0FCD 0FDD 0FED 0FFD
xE 002E 003E 004E 005E 0F8E 0F9E 0FCE 0FDE 0FEE 0FFE
xF 002F 003F 004F 005F 0F8F 0F9F 0FCF 0FDF 0FEF 0FFF
- 1106 -
4.Keycode, screen control code and
B-64303EN-3/01 PROGRAMMING Displayable characters
In the "ESC (B" mode, application programs can specify Shift-JIS code Kanji characters in
character strings, similar to the MS-DOS applications.
Shift-JIS code is converted to the FANUC code internally by the library.
In the "ESC (C" mode, specified Kanji character code is converted to the FANUC code according
to the following rule. Hangul characters or graphic characters can be displayed in this mode.
code_high -= 0x6B ;
if ( code_low >= 0x80 )
code_low -= 0x60 ;
else
code_low -= 0x40 ;
code_low <<= 1 ;
For example, by specifying the code 0x8140, the Hangul character of the FANUC code 0x1600 is
displayed on the screen.
- 1107 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
- 1108 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.1 Multitasking
High
Low
- 1109 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
Both the alarm task and the communication task are referred to as auxiliary task.
Because these two tasks are executed in the background of the main task, they are also referred
to as background task.
For the window task, see Section 5.6, "Window task" in Part II, "PROGRAMMING".
For the high-level task, see Section 5.8, "High-Level task" in Part II, "PROGRAMMING".
The main task is executed only while user screens are displayed. The alarm task and the
communication task is executed background without any relation to the screen display.
When user application program is composed of only one task, this task should be the main
task.
(supplement) Each task class corresponds to the macro-program of the Macro Executor as follows.
- 1110 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The auxiliary task is limited in available functions compared to the main task.
Communication
Main task Alarm task
task
Standard functions ○ ○ ○
Key input ○ × ×
Character display ○ × ×
Graphic display ○ × ×
File I/O ○ ○(*1) ○(*1)
CNC/PMC window
○ ○(*2) ×
function
Reader/Punch
○ ○(*3) ○(*3)
Interface
- 1111 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
Task switching between the main task and the auxiliary task is executed by calling task
management library functions in the application program. To run the auxiliary task periodically,
the period is also specified by the application program.
Event Function
Time os_sync_tim(), os_wait_tim()
Event flag os_wait_flg()
Semaphore os_wait_sem()
Status of serial port rs_wait()
- 1112 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
When defining the common variables in the files, dramver.c or sramver.c,specify the attribute
"volatile" for the variables in the definition statement.
Data cannot be accessed between memory address spaces which are not connected by arrows in
above figure.
- 1113 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
Kind of tasks
* Main task
Almost all processing of the user application, such as displaying of the user screen,
are executed in this task. The TASK1 is the main task.
* Background tasks
These tasks are usually waked by various events and they are executed independently
of the main task. The TASK2 (the communication task) and the TASK3 (the alarm task)
are background tasks. These tasks execute the processing about the related events,
then suspend execution to wait for the next event again, and give the CPU to the main
task.
TASK2 (the communication task) and TASK3 (the alarm task) are temporarily interrupted
processing when the processing time exceeds 1 msec, and change to the task (for instance,
main task) at the level of the subordinate position.
Next, when TASK2 (the communication task) and TASK3 (the alarm task) are started,
execution is restarted from the interrupted processing.
It changes to the task at the level of the subordinate position without waiting for
1 msec when the function of the event waiting (for instance, os_wait_tim function etc.)
is executed.
It starts after the end of a high-ranking task is waited when a more high-ranking task
executes it even if TASK2 (the communication task) and TASK3 (the alarm task) are
released from the event waiting state.
Therefore, the start by the event of TASK2 (the communication task) and TASK3 (the
alarm task) might be delayed, and there are no guarantee at the start cycle.
Both the main task and the background tasks are executed in the idle CPU time which
is not used by the CNC interruption tasks.
- 1114 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The File system compatible with MS-DOS is included in C Language Executor library.
This is a English character (one character) indicating the drive in which files are stored.
The available drive in C Language Executor library is as follows.
The File name is changed to one with capital characters and is discerned.
The following characters can be used for a File name. (The 2 bytes characters can not be
used.)
Alphabetic characters A .. Z
Numeric characters 0 .. 9
Special characters $ & # % ' ( ) - @ ^ { } ~ ` ! _
- 1115 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
CON console device This is used for the input from key
board or the output to display unit.
NUL null device When this is specified, the objective
file is not created.
The following Wild card characters can be used for the File name and extension.
(example 1) "TEST?.C"
"TEST1.C" , "TEST2.C" , "TESTA.C" , "TESTB.C" etc. are applied.
(example 2) "TEST*.C"
"TEST1.C" , "TEST12.C" , "TESTA.C" , "TESTAB.C" etc. are applied.
(example 3) "TEST*A.C"
The character 'A' is neglected and so this example is the same as example 2).
(6) Directory
For the file information, names, sizes and update times are registered in the directory.
The directory itself is a kind of files and can be layered.
The basic directory of layered directories is called "Root directory".
The Root directory is automatically created at initializing the device.
The directory created below the root one is called "Sub directory".
Within the range of the path name length(lower than 64 bytes), the Sub directories are created
in so many layers.
- 1116 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The separator among directories is normally specified with '\' and '/' may be used for the
separator. So the latter is supported too.
The number of files which the application can open simultaneously is fixed 60 as a whole.
I/O Control buffers which are used by High level input/output Functions
(fopen, fclose, fprintf,...) are prepared respectively 15 for each task.
At launching of each task, following three standard input/output functions are opened.
It is available for the application program to access a S-RAM card or ATA flash card which
is inserted in the card slot beside LCD display device of Series 0i-D.
For the method of using the cards, see Section 3.7, "File operation library" in Part II,
"PROGRAMMING".
- 1117 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
On Series 0i-D with C Language Executor, the special procedure is executed when the power is
turned on with pushing the definite MDI keys.
(note)
* [M]+[0] means that [M] key and [0] key are pushed at one time.
* Please continue to push these keys till the normal NC screen or the user screen of C Language
Executor is displayed after power on.
- 1118 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
#7 #6 #5 #4 #3 #2 #1 #0
8650 CNA RSK
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
#0 RSK After the reset key is pressed, the key code is:
0: Not passed to the application program.
1: Passed to the application program.
#1 CNA When a CNC alarm is issued while the user screen of C Language
Executor is being displayed, automatic switching to the alarm screen is:
0: Determined by the setting of bit 7 (NPA) of parameter No. 3111.
1: Not performed, regardless of the setting of bit 7 (NPA) of parameter
No. 3111.
#7 #6 #5 #4 #3 #2 #1 #0
8654 CGC
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
#2 CGC When the crt_setmode function is called, the graphic plane is:
0: Cleared.
1: Not cleared.
- 1119 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
#7 #6 #5 #4 #3 #2 #1 #0
8655 RCC
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
- 1120 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
- 1121 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
NOTE
The actually usable size is limited by the RAM capacity and selected
option(s).
- 1122 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
-------------------------------------------------------------------------------------------
Data file to Memory_Card file conversion utility
-------------------------------------------------------------------------------------------
The "dat2mem.com" is a utility program which converts arbitrary MS-DOS data file to Memory_Card
file that is used for CNC. It reads multiple data files to make a Memory_Card file which can
be directly loaded into CNC. It can also combine data files with existing Memory_Card file of
a C Language Executor program to make up new Memory_Card file.
C Language Executor Library supports functions which make application programs capable of
reading data files stored in the F-ROM of CNC controls. The data file of the format which can
be read by C Language Executor applications is referred to as C Language Executor data file.
Multiple MS-DOS data files can be combined and stored in a C Language Executor data file. C
Language Executor application program can read
individual MS-DOS files by specifying its file name.
Memory_Card file
header
Data file
directory entry
Data file 1
Data file 2
Data file n
Multiple MS-DOS data files are combined in this file. F-ROM file identification name
for this type of file is "CEXnxxxx" where 'n' is a number from 0 to 9 and "xxxx" is any
combination of max. 4 alpha-numeric characters. Ten C Language Executor data files
( "CEX0xxxx" --"CEX9xxxx") can be stored in the F-ROM at maximum. Files stored in the
F-ROM are identified by using leftmost 4 characters of the identification name. As a
result, the files with identification names "CEX1DATA" and "CEX1TEXT" are assumed as
the same file.
- 1123 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
That is, if a file "CEX1TEXT" is written to the F-ROM in which a file "CEX1DATA" is stored,
the file "CEX1DATA" is deleted and only the file "CEX1TEXT" remains.
and the F-ROM memory blocks of 128KB unit is allocated to the file.
In this type of file are general data or machine tool dependent data
(system parameters or offset data).
Memory_Card file
header
Data file
directory entry
Data file 1
Data file 2
Data file n
Multiple MS-DOS data files are combined with existing C Language Executor program file,
in this type of file. F-ROM file identification name for this type of file is "CEX xxxM"
where "xxx" stands for "1.0", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "5.0", "6.0",
etc. Only one file of this type can be stored in F-ROM. It is also not allowed to put
both this type of file and a C Language Executor program file without data file in the
F-ROM.
- 1124 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
and the F-ROM memory blocks of 128KB unit is allocated to the file.
This type of file is suited to store the data closely related to the C Language Executor
program, screen data for example.
For both types C Language Executor data file, C Language Executor application program opens
a C Language Executor data file by specifying file identification name, "CEXnxxxx" or "CEX
xxxM", then selects and reads one of the data files in it.
In the directory entry, the "8.3 format" file name, data size and origin address in F-ROM
file for each MS-DOS files are stored. C Language Executor application program can read the
contents of this directory entry.
There are no specific limitations for the size or type of the MS-DOS data file which is
converted by this utility. The contents of the MS-DOS data file is stored in the C Language
Executor data file as it is.
* Personal computer executable for Windows98, Windows 2000, Windows XP Home Edition, or Windows
XP Home Professional
* Free disk space larger than twice of the Memory_Card file size being created.
"xxx" stands for the name of the Command file mentioned later.
Command file is the file in which names of the related files are written.
The format of the Command file is as follows.
- 1125 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
- 1126 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Example 1]
Command file which combines all "*.dat" files in the directory "c:\data" and creates
"CEX1PARM.MEM".
;----------------------------------------------------------------
CEX1PARM.MEM
;----------------------------------------------------------------
c:\data\*.dat
;----------------------------------------------------------------
; end of spec file
--<< to the previous line >>--------------------------------------------------
[Example 2]
Command file which combines data files, "\work\scrn1.dat","\work\scrn2.dat" and
"\text\msg.txt", with existing file "cexec.mem" and creates new Memory_Card file
"cexec_d.mem".
;----------------------------------------------------------------
cexec_d.mem
;----------------------------------------------------------------
cexec.mem
;----------------------------------------------------------------
\work\scrn1.dat
\work\scrn2.dat
\text\msg.txt
;----------------------------------------------------------------
; end of spec file
--<< to the previous line >>--------------------------------------------------
- 1127 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
"insufficient memory"
Cannot allocate enough memory to execute the program.
- 1128 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.6.1 Overview
The window task is the task that operates after the CNC display task.
High
High-Level Task
Window Task
Alarm Task
Auxiliary Tasks
Communication task
Low
The window task runs with the tree tasks of C Language Executor and the CNC's display task
simultaneously.
This task is like the auxiliary tasks, but it can display to the screen unlike them.
About displaying screen, the window task is similar to the main task except that the target
screen to display is only the VGA windows. So, it is impossible to display without VGA display
device. (The execution itself is available even if any display device is equipped.) The
window task can't read MDI key unlike the main task. It can read the status of touch-panel.
On the CNC with VGA display device, it opens VGA windows on the screen and controls them,
and receives the commands of the operator via input signals of PMC or touch-panel.
Such as controlling "Software machine control panel" on the screen with touch-panel. It can
be applied to the general purposes, but it is most suitable task to the above purpose.
- 1129 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
The window task is loaded on the memory with the other tasks in the power-up sequence of
CNC. This task is not automatically started. To start the window task, call "os_strt_wtsk()"
function by the main task. When this function is executed successfully, the window task starts
running simultaneously with the other 3 tasks and the CNC's display task.
(1) Start
(2) Initialize
(1) Start
The window task starts from "main()" function by calling "os_strt_wtsk()" in the main
task.
(2) Initialize
General initialization such as variable setting, etc.
- 1130 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
It is possible to always open VGA windows on the screen rather than the application program
opens them on demands. Also it is possible to open the invisible VGA window.
- 1131 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
- 1132 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
(5) Load the created memory card file into the CNC and run it.
There is no special parameter setting about window task.
5.6.6 Notes
The task number of the window task is '4'. The window task is called "TASK4". All tasks
of whole application including window task are as below.
- 1133 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.7.1 Overview
It is possible to run C Language Executor on the following equipments on which "CNC screen
display" application (optional function).
It is possible to display on the virtual CNC screen displayed on PC's screen by "CNC screen
display" application as same as on the ordinary CNC screen. The virtual CNC screen is
equivalent to VGA display device. C Language Executor application program which runs on
the ordinary CNC equipment can also run on these equipments by re-compiling and linking
as it is. (Some source codes might be modified.) Some screen display functions are
restricted by "CNC screen display" application, and some function's behaviors are different
from ordinary specifications on the true CNC.
- 1134 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
In this section, how each task of the application program runs is described.
PC side display
[1] Auxiliary tasks start at CNC system start-up time. After started, they run as same as
on the ordinary Series 0i-D. It is not necessary for auxiliary tasks to take care of
whether CNC screen is displayed on PC or not. (Auxiliary tasks may not exist.)
[2] The main task starts after the auxiliary tasks started. It runs as same as on the ordinary
Series 0i-D until "CNCscrnFunc" is opened on PC.
For this duration, the main task operates while the C Language Executor application screen
is displayed and the main task stops while the CNC screen is displayed.
[3] The window task starts when "os_strt_wtsk()" function is called in the main task. Then,
the window task continues running regardless of whether the C Language Executor
application screen is displayed. (The window task may not exist.)
[4] When "CNCscrnFunc" starts on PC, the main task goes sleeping once. This is because the
CNC position screen is always selected when display is switched between the CNC and the
PC. When an attempt is made to switch to the C Language Executor application screen
after display on the PC side starts, the main task is executed again and the C Language
Executor application screen is displayed. If an application program of C Language
Executor prohibits screen switching, screen switching to the PC is not completed. The
application program should sometimes enable to change the screen.
- 1135 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
※NOTE
When using the CNC screen display function, do not allocate the C Language Executor
application screen to the NC position screen.
[5] The window task should close already opened VGA windows when "CNCscrnFunc" starts up.
VGA windows opened on CNC side screen are still displayed after starting "CNCscrnFunc"
on PC side. To display VGA windows on PC side screen, once close VGA windows after starting
"CNCscrnFunc", then open them again. It is possible to test on which of CNC side or PC
side the current screen is displayed by "crt_pcinfo()" function.
[6] When "CNCscrnFunc" is closed on PC and CNC side screen wakes up again, the main task
goes sleeping once. This is because the CNC position screen is always selected when
display is switched between the CNC and the PC. When an attempt is made to switch to
the C Language Executor application screen after display on the PC side restarts, the
main task is executed again and the C Language Executor application screen is displayed.
If an application program of C Language Executor prohibits screen switching, the CNC
screen display function cannot be terminated.
The application program should sometimes enable to change the screen.
※NOTE
When using the CNC screen display function, do not allocate the C Language Executor
application screen to the NC position screen.
[7] The window task must close already opened VGA windows when "CNCscrnFunc" is terminated.
"CNCscrnFunc" can't close itself while any VGA windows keep opening. It is possible to
test whether "CNCscrnFunc" is going closed or not by "crt_pcinfo()" function. After
changing to CNC side, the window task opens VGA windows again.
- 1136 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
In this section, differences from C Language Executor on the ordinary Series 0i-D are
described. You can regard the specifications which are not listed below as same as on
the ordinary Series 0i-D with VGA display device. The following descriptions are applied
to PC side screen if no special comment. They runs on 0i-D with Ethernet as same as the
ordinary Series 0i-D.
[*] mark which is added to "unavailable ..." etc. means that no error occurs and nothing
is done even if the function is used.
(2) The screen is initialized by changing screen between CNC side and PC side. At this
time, all contents already displayed are cleared. So the application program must
redraw the screen.
(3) Overlapping method about text and graphics in 16-color graphics (in which both
text and graphics are displayed overlapping each other) is different from the
ordinary Series 0i-D. "Composite" mode is not supported. [*] Only "Character over
graphics" or "Graphics over character" can be selected. The default mode if
"Character over graphics".
(4) 256-color graphics is unavailable. [*] The following graphic modes which select
256-color graphics can't be specified in "_setvideomode()" function.
(5) Automatic key repeating is always effective for key-input from both PC's keyboard
and MDI keyboard while PC side screen is alive. (It is independent of the
application program setting.) While CNC side screen is alive on Series 0i-D with
Ethernet, whether automatic key repeating is effective or not depends on the
application program setting.
(7) It is impossible to turn ON and OFF back-light of LCD screen by "ESC [>9l" and
"ESC [>9h" while PC side screen is alive. [*]
- 1137 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(9) It is impossible to start or terminate "CNCscrnFunc" while VGA windows are opened.
(11) When using the CNC screen display function, do not allocate the C Language Executor
application screen to the NC position screen.
- 1138 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
A) Alterations
It is required for the already existing application program to modify the source codes
as it avoids specification restrictions if you want to display the CNC’s screen by CNC screen
display function. You should take care of the following notices for making new application
program.
Index number of the following notices corresponds to the previous section's each item number.
(1) An application program which runs on CNC screen display function should not make screen
changing inhibited. For example, don't execute "crt_setswt(CRT_SWT_DIS )" (don't inhibit
screen changing actively), execute "crt_setswt( CRT_SWT_GREN )" while it draws graphics
(enable to change screen during drawing graphics), etc.
(2) Redraw all contents in the user screen if the screen is switched between CNC side and
PC side. For example, get the current output device, CNC or PC, using "crt_pcinfo()"
function, and if it switches, redraw whole screen.
(3) The application program which uses "Composite" graphic mode doesn't correctly draw
graphics on CNC screen display function. It is needed to redesign color specification
for application screen using "Character over graphics" mode.
(4) Don't use 256-color graphics mode. Modify the application program to use only 16 colors.
(5) If you want not to use automatic key repeating on PC side screen, set delay time and
interval time for key repeating both as max value (1024[msec]) using "aux_mdi_repeat()"
function.
(6) If you want to customize MDI key mapping for CNC's screen, alter key mapping on PC side
("CNCscrnFunc").
(7),(8) To control LCD display (turning ON/OFF the back-light, reversing the screen), use
the ordinary screen control feature of PC.
(9) While the application program is displaying VGA windows, call "crt_pcinfo()" function
periodically and close all VGA windows when PC side application is terminated.
(10) Basically, leave CNC screen switching control to CNC software. C Language Executor
application program should not touch screen switching process.
- 1139 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
The procedure for creating an application for the Series 0i-D connected via the Ethernet is
the same as in the normal Series 0i-D. An application is created according to the procedure
for creating a C Language Executor application program for the normal Series 0i-D.
Created memory card files are stored in F-ROM of the CNC unit. In the Series 0i-D connected
via the Ethernet, the boot menu is called and writing to F-ROM is performed according to the
same procedure as in the normal Series 0i-D.
C) Other notices
Screen refresh speed may slow down while PC side screen is alive according to its PC's
processor performance. But CNC internal process executions which is independent of screen
displaying (such as auxiliary tasks execution) run as same speed as the ordinary Series 0i-D.
- 1140 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
-------------------------------------------------------------------------------------------
1. Get status of CNC screen display function <Main>
-------------------------------------------------------------------------------------------
[Name]
crt_pcinfo
[Syntax]
#include <crt.h>
unsigned short crt_pcinfo( void ) ;
[Arguments]
------
[Return]
Returns status of CNC screen display function.
[Description]
Gets status of "CNC screen display" function (optional function) program which runs on
PC of Series 0i-D.
To display CNC screens (including the C Language Executor application screen) on the
PC of the Series 0i-D, use the CNC screen display function. Only when this application
program is being executed, a CNC screen can be displayed on the PC. This function is
used to test if CNC screen is available or not when C Language Executor application program
runs on Series 0i-D.
- 1141 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
This is a pack of bit-flags which indicates the status of "CNC screen display"
function on PC.
"1" means "effective" for each bit.
You can get the current output device using CRT_PC_SIDE and
CRT_ETH_SIDE.
This function is used to test if screen function is available or not. For example, "if
CNC screen goes closed, the window task closes VGA windows", for this case, this function
is used.
Screen switching must be enabled when "CNCscrnFunc" starts up and ends. (If screen
switching is disabled, "CNCscrnFunc" can't start/end.) Call this function periodically,
and enable screen switching when CRT_PC_PWON or CRT_PC_END flag rises up.
- 1142 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Example]
The following program closes VGA windows when "CNCscrnFunc" goes closed on PC. (This
is executed in the window task.)
#include <crt.h>
By using the procedure below, access a file on the personal computer where the CNC screen
display function operates.
(3) Choose [File] then [Data I/O] from the menu of the CNC screen display function then
set a desired memory card drive name in the displayed dialog box.
(4) With a C Language Executor application program, perform a file input/output operation
by specifying drive C:. Drive C: used with C Language Executor is installed on the
personal computer. By executing input/output processing with drive C:, a file in
the memory card on the personal computer can be read from and written to.
[Supplement] In (3) above, an arbitrary folder on the hard disk may be set instead of a memory
card drive. In such a case, a file in the folder set for input/output processing
with drive C: is read from and written to.
For example, when the "C:\DATA.TXT" file is opened from a C Language Executor
application program in the state where the "D:\USER" folder on the hard disk is set
as a data input/output folder, the "D:\USER\DATA.TXT" file on the personal computer
is opened.
- 1143 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(1) When a drive on the personal computer is accessed, the following functions cannot
be used:
Name Function
chdir Change the current directory
getcwd Acquire the current directory
mkdir Create a new directory(*1)
rmdir Delete a directory(*1)
rename Rename a file(*2)
fgetpos Acquire a stream file position indicator
fseek Move the file pointer
fsetpos Set a stream position indicator
ftell Acquire the current file pointer position
rewind Return the file pointer to the start of a file
eof Check whether the position is the end of a file
lseek Move the file pointer to a specified position
tell Acquire the current file pointer position
_chdrive Change the current drive
_getdrive Acquire the current drive
_dos_getdiskfree Acquire disk information
aux_file_format Format a specified drive(*3)
aux_file_memcinfo Acquire memory card status
(2) To access a drive on the personal computer, execute an ordinary file input/output
function (such as fopen, fcreate, fgets, fprintf, and fclose) by specifying drive
C:.
(3) To access a file on the drive (drive C:) on the personal computer, be sure to include
the drive name ("C:") in the file name. (Example: "C:\DATA.DAT")
(5) Only one file on the drive (drive C:) on the personal computer can be opened at a
time.
- 1144 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
(6) As the access mode for opening a file, only the read mode or creation mode may be
specified. Specifically, only "r" or "w" can be specified as the access mode of the
fopen function. "a", "r+", "w+", and "a+" cannot be specified.
5.7.6.3 Others
(1) When a file is accessed during execution of the CNC screen display function by
specifying drive B:, a file on the memory card inserted into the memory card slot
of the CNC is read from and written to.
- 1145 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
High-Level Task is the independent task of C Language Executor ordinary tasks (Main Task,
Auxiliary Tasks and Window Task) and is called at fixed intervals.
High
High-Level Task
Window Task
Alarm Task
Auxiliary Tasks
Communication task
Low
- 1146 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.8.2 Specification
Execution 8 msec(*1)
interval
(Interval time is not always fixed. Refer following "Task execution
rule".)
Type char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned
long, array of these types and pointers to these type variables.
Kind auto variable, static variable, global variable, D-RAM/S-RAM shared variable.
Name Function
rettask() Stop execution of a high-level task
Start and stop acquiring high-level task execution
cnc_hldata()
management data
cnc_rdprgnum() Read the program number of a program being executed
Read the sequence number of a sequence being
cnc_rdseqnum()
executed
cnc_actf() Read the actual feed rate (F) of a controlled axis
cnc_acts() Read the actual rotation speed of the spindle
cnc_absolute() Read the absolute position of a controlled axis
cnc_machine() Read the machine position of a controlled axis
cnc_relative() Read the relative position of a controlled axis
cnc_distance() Read the distance-yet-to-go of a controlled axis
- 1147 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
Name Function
cnc_skip() Read the skip position of a controlled axis
cnc_srvdelay() Read the servo delay amount for a controlled axis
Read the acceleration/deceleration delay amount for a
cnc_accdecdly()
controlled axis
cnc_alarm() Read alarm status
cnc_rdspload() Read information about the load on the serial spindle
cnc_adcnv() Read A/D conversion data
pmc_rdpmcrng() Read arbitrary PMC data (input range specified)
pmc_wrpmcrng() Output arbitrary PMC data (output range specified)
pmc_getpmcptr() Acquire "address information" of PMC memory
Check the validity of "address information" of PMC
pmc_isvalidpmcptr
memory
pmc_rdpmcchar Read signed 1-byte data of PMC memory
pmc_rdpmcshort Read signed 2-byte data of PMC memory
pmc_rdpmclong Read signed 4-byte data of PMC memory
pmc_wrpmcchar Write signed 1-byte data of PMC memory
pmc_wrpmcshort Write signed 2-byte data of PMC memory
pmc_wrpmclong Write signed 4-byte data of PMC memory
pmc_get_current_pmc_unit() Acquire the unit type of the current operation target PMC
pmc_get_number_of_pmc() Acquire the number of PMC paths
pmc_get_pmc_unit_types() Acquire PMC unit type
pmc_select_pmc_unit() Select an operation target PMC unit
acos() Calculate arccosine
asin() Calculate arcsine
atan() Calculate arctangent
atan2() Calculate arctangent
ceil() Round upward to an integer
cos() Calculate cosine
cosh() Calculate hyperbolic cosine
exp() Calculate an exponential function
fabs() Calculate the absolute value of a floating-point number
floor() Discard decimal places
fmod() Calculate the remainder of a floating-point number
frexp() Divide a number to a mantissa part and exponent part
ldexp() Calculate a product of 2 raised to a power
log() Calculate natural logarithm
log10() Calculate common logarithm
modf() Divide a number to an integer part and fraction part
pow() Make a power calculation
sin() Calculate sine
sinh() Calculate hyperbolic sine
sqrt() Calculate square root
- 1148 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
Name Function
tan() Calculate tangent
tanh() Calculate hyperbolic tangent
Library functions other than those listed above are unusable. For example, ANSI
standard functions (such as printf, malloc, and strcpy) other than the above and FANUC
proprietary CNC/PMC window library functions other than the above are unusable.
For explanation of the functions other than rettask() and cnc_hldata(), see Section
3.4, "CNC/PMC window library" in Part II, "PROGRAMMING".
Using pmc_rdpmcrng() and pmc_wrpmcrng() can, respectively, read and write PMC data (internal
relays (R) and keep relays (K)).
Refer to 34window.man for descriptions about pmc_rdpmcrng() or pmc_wrpmcrng().
High-Level Task can share data with the other tasks via D-RAM common variables (dramver.c)
or S-RAM common variables (sramver.c).
- 1149 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
High-Level Task is called after CNC task in the periodical interrupt procedure at 8msec
intervals.
(A) (B)
High-Level Task (B) is surely called once at each 8 msec. But execution intervals are not
always exact 8 msec.
The timing of calling High-Level Task changes according to execution time of CNC task (A) as
mentioned above. Generally, each tasks on CNC system, such as CNC, PMC, Servo, etc., run
synchronously by hand-shaking each other. Therefore, nothing must be considered about
relationship to the other tasks even if the execution intervals change.
Total processing time of above-mentioned (B) is limited up to 0.8 msec for each interruption.
When the task attempts to run over 0.8 msec, the execution is forcedly interrupted by timer
interruption. The interrupted task will restart its execution from the interrupted instruction
in the next timer interruption procedure.
(B) (B’)
INTERRUPTED RESTART
- 1150 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
In this case, a series of process is divided into multiple parts that are executed on separate
interruptions. Therefore, it makes actual interval of the task longer than 8 msec. To avoid
this, it is recommended to keep reserve of execution time for High-Level Task, not to reach
the upper limit 0.8 msec. For example, keep actual max. execution time of High-Level task up
to approximately 0.8 msec. C Language Executor management procedure takes approx. 0.02 msec
for calling High-Level task.
This time is included in the execution time of High-Level task.
High-Level Task has priority over the other CNC tasks such as preparing task. If High-Level
task runs long time, CPU time for CNC preparing task,etc. may be reduced. (In this case, any
harmful effect, such as machining time by CNC's automatic operation increases, etc., may occur.)
To avoid influence to the other tasks, it is better to keep execution time of High-
Level task as short as possible
The following variables (management data) are defined for looking over the execution time of
High-Level Task.
- 1151 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
Each task of C Language Executor application that includes High-Level task starts as following
order.
High-Level task starts on the 1st 8 msec interrupt procedure just after completion of
preparation for all tasks. This execution doesn't link to any other tasks' start-up. Therefore,
start-up order of High-Level task and the other tasks if not fixed.
- 1152 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The following sections mention development process of application including High-Level Task.
The structure of High-Level Task's source modules is same as the other tasks. That is, it has
one or more source modules ( "*.c" file ) and one "main()" function is included in them. The
structure of "main()" function is as follows.
for(;;) {
[Process for each 8 msec]
rettask() ; <-- This function interrupts the
} execution of High-Level Task.
}
A series of process that is executed at each 8 msec makes a loop program flow. "rettask()"
function must be called in the loop.
List the module names of High-Level Task on "TASK5=" line in module definition section on
the top of "makefile". List depending relationship of each modules in module dependency block
on the bottom of "makefile".
These describing format is same as the other tasks.
No special settings (such as CNC parameter, etc.) are required for application program including
High-Level Task. It is loaded into CNC and run as same as the ordinary application program.
- 1153 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
-------------------------------------------------------------------------------------------
1. Interrupt execution of High-Level Task <HILEV>
-------------------------------------------------------------------------------------------
[Name]
rettask
[Syntax]
#include <hilev.h>
void rettask( void ) ;
[Arguments]
------
[Return]
------
[Description]
Interrupts High-Level Task's process.
This function is called at the end of a series of process (for each 8 msec) in High-Level
Task. The execution will restart just after this function in the next High-Level Task
(after 8 msec).
for(;;) {
[Process for each 8 msec]
rettask() ;
}
}
- 1154 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
-------------------------------------------------------------------------------------------
2. Start and End of getting the High-Level task execution management data <HILEV>
-------------------------------------------------------------------------------------------
[Name]
cnc_hldata
[Syntax]
#include <hilev.h>
int cnc_hldata( int mode ) ;
[Arguments]
mode execution mode (DATA_START/DATA_END)
[Return]
Always 0 returns.
[Description]
The start and end of execution management data getting.
for(;;) {
cnc_hldata( DATA_START );
[Process for each 8 msec]]
cnc_hldata( DATA_END );
rettask() ;
}
}
Make sure that the desired processing is executed between cnc_hldata calls, as shown
above.
[Attention]
Please do not call this function in the case that don't get execution management data,
to economize on processing time.
- 1155 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
"High-Level task execution management data" are variables in where how High-Level task runs
is stored. The following structure is defined.
struct HL_MNGDATA {
unsigned long HL_COUNT ;
unsigned int HL_STIME ;
unsigned int HL_ETIME ;
unsigned int HL_MAXETIME ;
unsigned int HL_MAXPROCTIME ;
unsigned int HL_TIMEOVER ;
unsigned int HL_RETFLAG ;
unsigned int HL_BUFCTRL ;
unsigned int HL_BUFSIZE ;
unsigned int HL_BUFIDX ;
unsigned long HL_PTRBUF ;
} ;
All tasks can access this "HL_MNGDATA". All members are readable and writable.
When High-Level task starts and ends in each 4/8 msec interruption
process are recorded in these members.
This value is elapsed time ([micro-sec]) from the top of each 4/8 msec
interruption process.
HL_ETIME - HL_STIME
- 1156 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
HL_TIMEOVER Total counts that execution time exceeds the limit(0.8 msec).
This is total count that High-Level task attempts to exceeds 0.8 msec
execution time and is forcibly terminated.
- 1157 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
- 1158 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.9.1 Overview
A C Language Executor application program created by the user can be used together with
MANUAL GUIDE i. However, some restrictions are imposed on use with MANUAL GUIDE i (for
example, a source code modification may need to be made). This section describes those
restrictions. For the MANUAL GUIDE i specification and use method, refer to "FANUC MANUAL
GUIDE i Operator's Manual" (B-63874EN).
After power-on, the screen for a C Language Executor application created by the user
is usually displayed. However, when MANUAL GUIDE i is used together, the MANUAL GUIDE
i screen can be displayed after power-on.
In this case, make a source code modification as described below. Moreover, set bit 0
(PWD) of parameter No. 14700 for MANUAL GUIDE i to 1.
For details of the parameter for MANUAL GUIDE i, refer to Appendix, "PARAMETERS", in
"FANUC MANUAL GUIDE i Operator's Manual" (B-63874EN).
- 1159 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
C language executor
MANUAL GUIDE i
application program
(Halt) Power-on
No Yes
No
- 1160 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
Set and use the functions below so that no conflict with MANUAL GUIDE i occurs.
For the functions above, MANUAL GUIDE i has key customization performed as indicated
below. When the user customizes MDI keys with a C Language Executor application
program created by the user, ensure that a setting that duplicates the settings
below is not made.
If a duplicate setting is made, MDI key input on the MANUAL GUIDE i side is disabled.
Use sufficient care.
- 1161 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
+0 +2 +4 +6 +8 +A +C +E
- 1162 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
+0 +2 +4 +6 +8 +A +C +E
- 1163 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.10.1 Overview
A C Language Executor application program created by the user can be used together with
TURN MATE i. However, some restrictions are imposed on use with TURN MATE i (for example,
a source code modification may need to be made). This section describes those restrictions.
For the TURN MATE i specification and use method, refer to "FANUC TURN MATE i Operator's
Manual" (B-64254EN).
After power-on, the screen for a C Language Executor application created by the user
is usually displayed. However, when TURN MATE i is used together, the TURN MATE i screen
can be displayed after power-on.
In this case, make a source code modification as described below. Moreover, set bit 0
(PWD) of parameter No. 9101 for TURN MATE i to 1.
For details of the parameter for TURN MATE i, refer to Appendix, "PARAMETERS", in "FANUC
TURN MATE i Operator's Manual" (B-64254EN).
- 1164 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
C Language Executor
TURN MATE i
application program
(Halt) Power-on
No Yes
No
- 1165 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
Set and use the functions below so that no conflict with TURN MATE i occurs.
- 1166 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.11.1 Overview
The display language of the CNC screen can be switched by a C Language Executor
application program without turning off then on the power.
5.11.2 Explanation
The cnc_chglang function can be used when bit 0 (NLC) of parameter No.
3280 is set to 0. For details of bit 0 (NLC) of parameter No. 3280, see
Subsection 5.11.3, "Parameters".
With the cnc_chglang function, the display language can be switched to any of the
following:
English
Japanese
German
French
Chinese (traditional)
Italian
Korean
Spanish
Dutch
Danish
Portuguese
Polish
Hungarian
Swedish
Czech
Chinese (simplified)
Russian
Turkish
- 1167 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Name]
cnc_chglang
[Syntax]
#include < fwindow.h>
short cnc_chglang(char lang_no);
[Arguments]
lang_no
Language number. A number is assigned to each language.
0 : English
1 : Japanese
2 : German
3 : French
4 : Chinese (traditional)
5 : Italian
6 : Korean
7 : Spanish
8 : Dutch
9 : Danish
10 : Portuguese
11 : Polish
12 : Hungarian
13 : Swedish
14 : Czech
15 : Chinese (simplified)
16 : Russian
17 : Turkish
[Return]
One of the following values is returned:
EW_OK(0) Normal termination
EW_FUNC(1) The function is unusable. Bit 0 (NLC) of parameter No. 3280
for dynamic language switching is set to 1. Alternatively, the
cnc_chglang function is used by other than the main task.
EW_NUMBER(3) The data number is incorrect. A nonexistent language
number is specified.
- 1168 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Description]
The display language of the CNC screen is switched by specifying a desired language
number.
If a value other than EW_OK(0) is returned, the display language of the CNC screen
remains unchanged from the one used before the execution of the function.
The cnc_chglang function can be used only with the main task.
For details of tasks, see Subsection 5.1.1, "Task classes" in Section 5.1,
"Multitasking" of Part II, "PROGRAMMING".
NOTE
1 To enable dynamic display language switching with the cnc_chglang function, set
bit 0 (NLC) of parameter No. 3280 to 0.
2 The cnc_chglang function does not write a language number to parameter No.
3281. For details of parameter No. 3281, see Subsection 5.11.3, "Parameters".
3 To check the current display language of the CNC screen, read diagnosis data No.
43 with the cnc_diagnoss function. For details of the cnc_diagnoss function, see
Section 3.4, "CNC/PMC window library" in Chapter 3, "Function References" of
Part II, "PROGRAMMING". For details of diagnosis data No. 43, see Subsection
5.11.4, "Diagnosis data".
4 When executing the cnc_chglang function, disable screen switching with the
crt_setswt function. For the crt_setswt function, see Section 3.6, "CRT operation
library" in Chapter 3, "Function References" of Part II, "PROGRAMMING".
- 1169 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Example]
The following program switches the display language to English:
#include <data.h>
#include <fwindow.h>
#include <crt.h>
/* Switch to English */
short example()
{
struct iodbpsd buf, diag;
short ret ;
unsigned int save_mode ;
char lang_no ;
lang_no = 0 ; /* Switch to English (0) */
if(lang_no != diag.u.cdata){
/* Disable screen switching */
save_mode = crt_setswt(CRT_SWT_DIS) ;
ret = cnc_chglang(lang_no) ;
if(ret) {
crt_setswt(save_mode) ;
return ret ;
}
crt_setswt(save_mode) ;
//* Hold switched language after power-off */
buf.datano = 3281 ;
buf.type = 0 ;
buf.u.cdata = lang_no ;
ret = cnc_wrparam(4+1, &buf) ;
return ret ;
}
}
- 1170 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.11.3 Parameters
#7 #6 #5 #4 #3 #2 #1 #0
03280 NLC
#0 NLC
Dynamic display language switching is:
0 : Enabled.
1 : Disabled.
NOTE
If the value of parameter No. 3281 is changed, the new setting is not reflected
until the power is turned off then back on.
- 1171 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
- 1172 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.12.1 Overview
For details on the functions, see Section 3.3, "Graphic library", Section 3.4,
"CNC/PMC window library", and Section 3.6, "CRT operation library".
5.12.2 Explanation
- When the Simplified Chinese mode is set by using the crt_setmode function
When the Simplified Chinese mode is set, full-size characters (such as kanji of
Japanese) other than the Simplified Chinese characters cannot be displayed. To
display full-size characters other than the Simplified Chinese characters, cancel the
Simplified Chinese mode by using the crt_setmode function.
For details of the crt_setmode function, see Subsection 5.12.2.2, "Simplified Chinese
mode setting function (crt_setmode function)".
The Simplified Chinese character codes supported by C Language Executor are
GB2312 codes. For the Simplified Chinese character codes, see Appendix D,
"Simplified Chinese Character Code List".
- 1173 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
When the Simplified Chinese mode is set by using crt_setmode function, Simplified
Chinese messages can be displayed on the screen for a C Language Executor
application program. For the supported functions, see Subsection 5.12.2.3,
"Simplified Chinese display function".
[Syntax]
#include<crt.h>
int crt_setmode( unsigned int mode ) ;
[Arguments]
mode CRT display mode
To set the Simplified Chinese mode, specify:
CRT_MODE_CFLAG + CFLAG_GBCODE
CRT_MODE_CFLAG Display operation flag setting
flag
CFLAG_GBCODE Simplified Chinese mode setting
flag
To cancel the Simplified Chinese mode, specify CRT_MODE_CFLAG.
[Return]
When crt_setmode(CRT_MODE_CFLAG + CFLAG_GBCODE) or
crt_setmode(CRT_MODE_CFLAG) is executed, one of the following values is
returned:
0 : Normal termination (The Simplified Chinese mode is set/canceled.)
[Description]
The crt_setmode function is originally used to set the number of display characters
and set the color/monochrome mode. However, even when
crt_setmode(CRT_MODE_CFLAG + CFLAG_GBCODE) or
crt_setmode(CRT_MODE_CFLAG) is executed, the setting of the number of display
characters and the setting of the color/monochrome mode remain unchanged.
For the setting of the number of display characters and the setting of the
color/monochrome mode, see "1.5 crt_setmode" in Section 3.6, "CRT operation
library".
- 1174 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The table below indicates the names and descriptions of the functions that support
Simplified Chinese message display.
For details of each function, see Section 3.1, "ANSI C standard library", Section 3.3,
"Graphic library", and Section 3.6, "CRT operation library".
- 1175 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Example]
printf
if (!ret){
printf("%s¥n", msg); /* Display in Simplified Chinese */
}
crt_setmode(CRT_MODE_CFLAG); /* Cancel Simplified Chinese mode */
}
- 1176 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Example]
gr_displaychar(), gr_dispstr(), gr_disp9ifchar(), gr_disp9ifstr()
char msg[]={ 0xCA, 0xB5, 0xBC, 0xCA, 0xCE, 0xBB, 0xD6, 0xC3, 0x00 };
/* 实(0xCAB5) 际(0xBCCA) 位(0xCEBB) 置(0xD6C3) */
crt_opengr() ;
crt_closegr();
}
- 1177 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Example]
crt_setuserskey()
definition function)
- 1178 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
NOTE
For Simplified Chinese display, a character string to be displayed on a soft key can be
defined by directly specifying Simplified Chinese character codes (GB2312 codes)
instead of FANUC codes as a display character string after setting the Simplified
Chinese mode with the crt_setmode function.
For display of a full-size character such as a kanji character of Japanese, two 2-byte
codes are specified using FANUC codes. For display of a Simplified Chinese
character (full-size character), however, one 2-byte code listed in Appendix E,
"Simplified Chinese Character Code List" is specified. Codes that extend beyond the
display area are ignored.
中 国 語
簡 体 字
中 国 语
简 体 字
The codes for the first six words ( portions) only are displayed. The codes for
the remaining six words are ignored.
- 1179 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
* 中 国 *
语 简 体
The codes for the first seven words ( portions) only are displayed. The codes
for the remaining five words including the code 0xD7D6 for "字" are ignored.
- 1180 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.13.1 Overview
A Russian alarm message displayed on the alarm screen of the CNC can be acquired
with the following function:
- Alarm message acquisition function cnc_rdalminfo()
Russian alarm history data displayed on the alarm history screen of the CNC can be
acquired with the following functions:
- Alarm history data acquisition function cnc_rdalmhistry5(),
A Russian operator message displayed on the external operator message screen of the
CNC can be acquired with the following functions:
- Operator message acquisition function cnc_rdopmsg(), cnc_rdopmsg2(),
cnc_rdopmsg3()
Russian PMC message data set at message display PMC address A can be acquired
with the following function:
- PMC message acquisition function pmc_rdpcmsg()
For details of the each function, see Section 3.3, "Graphic library", Section 3.4,
"CNC/PMC window library", and Section 3.6, "CRT operation library".
- 1181 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.13.2 Explanation
For details of the crt_setmode function, see Subsection 5.13.2.2, "Russian mode
setting function (crt_setmode function)".
The Russian character codes supported by C Language Executor are Cyrillic
character codes. For the Cyrillic character codes, see Appendix E, "Russian (Cyrillic)
Character Code List".
- 1182 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
When the Russian mode is set by using the crt_setmode function, Russian messages
can be displayed/acquired on the screen for a C Language Executor application
program. For the supported functions, see Subsection 5.13.2.3, "Russian display
function".
[Syntax]
#include<crt.h>
int crt_setmode( unsigned int mode ) ;
[Arguments]
mode CRT display mode
To set the Russian mode, specify:
CRT_MODE_CFLAG + CFLAG_CYRILLIC
CRT_MODE_CFLAG Display operation flag setting flag
CFLAG_CYRILLIC Russian mode setting flag
To cancel the Russian mode, specify CRT_MODE_CFLAG.
[Return]
When crt_setmode(CRT_MODE_CFLAG + CFLAG_CYRILLIC) or
crt_setmode(CRT_MODE_CFLAG) is executed, one of the following values is returned:
0 : Normal termination (The Russian mode is set/canceled.)
Other values: Error
[Description]
The crt_setmode function is originally used to set the number of display characters and set the
color/monochrome mode. However, even when crt_setmode(CRT_MODE_CFLAG +
CFLAG_CYRILLIC) or crt_setmode(CRT_MODE_CFLAG) is executed, the setting of the
number of display characters and the setting of the color/monochrome mode remain unchanged.
For the setting of the number of display characters and the setting of the color/monochrome mode,
see "1.5 crt_setmode" in Section 3.6, "CRT operation library".
- 1183 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
The table below indicates the names and descriptions of the functions that support
Russian message display/acquisition.
For details of each function, see Section 3.1, "ANSI C standard library", Section 3.3,
"Graphic library", and Section 3.6, "CRT operation library".
For details of each function, see Section 3.4, "CNC/PMC window library".
- 1184 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Example]
printf()
if (!ret){
printf("%s¥n", msg); /* Display in Russian */
}
crt_setmode(CRT_MODE_CFLAG); /* Cancel Russian */
}
- 1185 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Example]
gr_displaychar(), gr_dispstr(), gr_disp9ifchar(), gr_disp9ifstr()
crt_opengr() ;
- 1186 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Example]
crt_setuserskey()
- 1187 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Example]
cnc_rdalminfo()
- 1188 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Example]
cnc_rdalmhistry5()
- 1189 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Example]
cnc_rdopmsg()
- 1190 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Example]
pmc_rdpcmsg()
- 1191 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.14.1 Overview
A Turkish alarm message displayed on the alarm screen of the CNC can be acquired
with the following function:
- Alarm message acquisition function cnc_rdalminfo()
Turkish alarm history data displayed on the alarm history screen of the CNC can be
acquired with the following functions:
- Alarm history data acquisition function cnc_rdalmhistry5(),
A Turkish operator message displayed on the external operator message screen of the
CNC can be acquired with the following functions:
- Operator message acquisition function cnc_rdopmsg(), cnc_rdopmsg2(),
cnc_rdopmsg3()
Turkish PMC message data set at message display PMC address A can be acquired
with the following function:
- PMC message acquisition function pmc_rdpcmsg()
- 1192 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.14.2 Explanation
For details of the crt_setmode function, see Subsection 5.14.2.2, "Turkish mode
setting function (crt_setmode function)".
For the Turkish character codes supported by C Language Executor, see Appendix F,
"Turkish Character Code List".
- 1193 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Syntax]
#include<crt.h>
int crt_setmode( unsigned int mode ) ;
[Arguments]
mode CRT display mode
To set the Turkish mode, specify:
CRT_MODE_CFLAG + CFLAG_TURKISH
CRT_MODE_CFLAG Display operation flag setting flag
CFLAG_TURKISH Turkish mode setting flag
To cancel the Turkish mode, specify CRT_MODE_CFLAG.
[Return]
When crt_setmode(CRT_MODE_CFLAG + CFLAG_TURKISH) or
crt_setmode(CRT_MODE_CFLAG) is executed, one of the following values is returned:
0 : Normal termination (The Turkish mode is set/canceled.)
[Description]
The crt_setmode function is originally used to set the number of display characters and set the
color/monochrome mode. However, even when crt_setmode(CRT_MODE_CFLAG +
CFLAG_TURKISH) or crt_setmode(CRT_MODE_CFLAG) is executed, the setting of the
number of display characters and the setting of the color/monochrome mode remain unchanged.
For the setting of the number of display characters and the setting of the color/monochrome mode,
see "1.5 crt_setmode" in Section 3.6, "CRT operation library".
- 1194 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The table below indicates the names and descriptions of the functions that support
Turkish message display/acquisition.
For details of each function, see Section 3.1, "ANSI C standard library", Section 3.3,
"Graphic library", and Section 3.6, "CRT operation library".
- 1195 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
For details of each function, see Section 3.4, "CNC/PMC window library".
- 1196 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.15.1 Overview
When a halted or stopped automatic operation is restarted after editing the program in
the haled or stopped state, the program may not be executed as displayed on the
screen. If bit 7 (RSC) of parameter No. 10330 is set to 1, the CNC screen displays a
confirmation message to attract the operator's attention so that operation after editing
can be restarted only when the operator gives permission.
When this function is enabled, a similar confirmation message needs to be displayed
on all CNC screens including C Language Executor application screen. This section
describes the procedure for incorporating this function in C Language Executor
application screen.
5.15.2 Explanation
<4> When "YES" is pressed, the application program sets 1 in the argument "restart"
and calls the cnc_confirm_restart function.
When the program start button is pressed again, operation is restarted.
<5> When "NO" is pressed, the application program sets 0 in the argument "restart"
and calls the cnc_confirm_restart function.
When the program start button is pressed again, the cnc_statinfo2 function reads
1 from "restart", so that the confirmation message is displayed.
- 1197 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
This function is called at all times to check whether the confirmation message needs to be displayed.
[Name]
cnc_statinfo2
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_statinfo2( struct odbst2 *statinfo ) ;
[Arguments]
statinfo
Pointer to the odbst2 structure where CNC status information is returned
struct odbst2 {
short hdck ; /* Manual handle retrace status */
short tmmode ; /* Not used */
short aut ; /* Automatic/manual operation mode selection */
short run ; /* Automatic operation status */
short motion ; /* Axis movement/dwell status */
short mstb ; /* M, S, T, and B function status */
short emergency ; /* Emergency stop status */
short alarm ; /* Alarm status */
short edit ; /* Program editing status */
short warning; /* Warning message status */
short o3dchk; /* Not used */
short ext_opt; /* Option status */
short restart; /* Status of restart check after program editing */
};
* For a 2-path system, all statuses are available for each path.
hdck Manual handle retrace status
0 : Manual handle retrace is disabled.
1 : M.H.RTR. (Manual handle retrace)
2 : NO RVRS. (Reverse movement is disabled.)
3 : NO CHAG. (Direction switching is disabled.)
- 1198 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
- Lathe system
0 : ****(No editing)
1 : EDIT (Editing being performed)
2 : SeaRCH (Search being performed)
3 : OUTPUT (Data output being performed)
4 : INPUT (Data input being performed)
5 : COMPARE (Comparison being performed)
- 1199 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Description]
CNC status information is read. Information items are stored in the members within
odbst2.
- 1200 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
When "YES" or "NO" is pressed in response to the confirmation message, this function is called to
post whether "YES" or "NO" is pressed to the CNC.
[Name]
cnc_confirm_restart
[Syntax]
#include <data.h>
#include <fwindow.h>
short cnc_confirm_restart( unsigned short restart ) ;
[Arguments]
restart
Specify whether to restart automatic to after program editing.
[Return]
When the function has been executed normally, EW_OK is returned. If an error
occurs, a value other than EW_OK is returned.
Major errors are listed below.
EW_NUMBER(3) The specification of "restart" is incorrect.
A value other than 0 and 1 is specified in "restart".
EW_PARAM(9) Parameter error
Set the parameter as follows:
Bit 7 (RSC) of parameter No. 10330 = 1
EW_REJECT(9) The program is not edited.
- 1201 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.16.1 Overview
By using eight functions of the 8-level data protection function, operations such as
operation level acquisition and operation level password input/change can be
performed with a C Language Executor application program.
The table below lists the functions of the 8-level data protection function.
NOTE
1 For details of the 8-level data protection function, refer to
Subsection, "Eight-Level Data Protection Function" in "Connection
Manual: Function" (B-64303EN-1) , "Eight-Level Data Protection
Function" in “User’s Manual (Common to T/M)” (B-64304EN/01)
and "Eight-Level Data Protection Function" in "PMC Programming
Manual" (B-64393EN).
2 The 8-level data protection function is an optional function.
- 1202 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.16.2 Explanation
With a C Language Executor application program, operations (1) through (8) below
can be performed using the functions of the 8-level data protection function.
For the references of the functions that perform operations (1) to (8), see Subsection
5.16.2.1, "Function references".
- 1203 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Name]
cnc_rdope_lvl
[Syntax]
#include <fwindow.h>
short cnc_rdope_lvl( short *ope_level ) ;
[Arguments]
ope_level Pointer for indicating a variable where the current operation
level is returned
A value from 0 to 7 is set.
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_NOOPT(6) The necessary function is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
[Description]
This function acquires the current operation level ([1] in the figure below).
[1]
- 1204 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Name]
cnc_prot_pswinp
[Syntax]
#include <fwindow.h>
short cnc_prot_pswinp( char *pswd ) ;
[Arguments]
pswd Pointer to a password character string
Specify a password character string consisting of 3 to 8
characters. Only uppercase letters and numeric characters can
be used.
Add a NULL character (as the fourth to ninth character) to the
end of the character string.
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_DATA(5) The data is incorrect.
Check the password character string.
Add a NULL character (as the fourth to ninth character) to the
end of the character string.
EW_NOOPT(6) The necessary option is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
[Description]
This function inputs a password for the operation level to be set/changed.
The operation level can be changed when the validity of the password is confirmed.
- 1205 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Name]
cnc_prot_pswcan
[Syntax]
#include <fwindow.h>
short cnc_prot_pswcan( void ) ;
[Arguments]
------
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_NOOPT(6) The necessary option is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
EW_MODE(12) The mode of the CNC is incorrect.
Place the CNC in the MDI mode.
[Description]
This function changes the operation level to a level from 0 to 3 when the current
operation level is a level from 4 to 7.
If the current operation level is a level from 0 to 3, this function returns EW_OK
without performing any operation.
This function can be used only when the CNC is placed in the MDI mode.
- 1206 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Name]
cnc_prot_pswchg
[Syntax]
#include <fwindow.h>
short cnc_prot_pswchg( short ope_level, char *pswd_old,
char *pswd_new, char *pswd_cnf ) ;
[Arguments]
ope_level Specify an operation level whose password is to be changed. (4
to 7)
Only the current operation level can be set.
pswd_old Pointer to the previous password character string
Specify a password character string consisting of 3 to 8
characters.
Only uppercase letters and numeric characters can be used.
Add a NULL character (as the fourth to ninth character) to the
end of the character string.
pswd_new Pointer to a new password character string
Specify a password character string consisting of 3 to 8
characters.
Only uppercase letters and numeric characters can be used.
Add a NULL character (as the fourth to ninth character) to the
end of the character string.
pswd_cnf Pointer to a new password confirmation character string
Specify a password character string consisting of 3 to 8
characters.
Only uppercase letters and numeric characters can be used.
Add a NULL character (as the fourth to ninth character) to the
end of the character string.
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_DATA(5) The data is incorrect.
Check the password character string.
Add a NULL character (as the fourth to ninth character) to the
end of the character string.
Check the current operation level.
EW_NOOPT(6) The necessary option is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
- 1207 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
[Description]
This function changes the password for the operation level.
The password can be changed when the validity of the previous password is
confirmed, the new password and new password for confirmation are found to be
identical, and the format is correct.
Only the password for the current operation level can be changed.
This function can be used only when the CNC is placed in the MDI mode.
- 1208 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Name]
cnc_prot_pswinit
[Syntax]
#include <fwindow.h>
short cnc_prot_pswinit( short ope_level ) ;
[Arguments]
ope_level Set an operation level whose password is to be initialized. (4 to
7)
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_DATA(5) The data is incorrect.
Check the current operation level and the operation level whose
password is to be initialized.
EW_NOOPT(6) The necessary option is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
EW_MODE(12) The mode of the CNC is incorrect.
Place the CNC in the MDI mode.
[Description]
This function initializes the password of a specified operation level.
This function can initialize the password of only an operation level that is lower
than the current operation level.
This function can be used only when the CNC is placed in the MDI mode.
- 1209 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(6) Acquisition of the change protection level/output protection level of each data
item
[Name]
cnc_rdprt_lvl
[Syntax]
#include <fwindow.h>
short cnc_rdprt_lvl( short item_id, short *chg_level, short *out_level ) ;
[Arguments]
item_id Set a data ID.
For information about a data ID, see Subsection 5.16.2.2, "Data
ID list".
chg_level Pointer to a variable where a change protection level value is
returned
A change protection level is set. (0 to 7)
out_level Pointer to a variable where an output protection level value is
returned
An output protection level is set. (0 to 7)
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_DATA(5) The data is incorrect.
Check the data ID.
EW_NOOPT(6) The necessary option is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
- 1210 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Description]
For the data of a specified data ID ([1] in the figure below), the change protection
level ([2] in the figure below) and the output protection level ([3] in the figure below)
are acquired.
As the output protection level for data with no output function applied, the value 0
is set.
- 1211 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(7) Changing of the change protection level/output protection level of each data item
[Name]
cnc_wrprt_lvl
[Syntax]
#include <fwindow.h>
short cnc_wrprt_lvl( short item_id, short chg_level, short out_level ) ;
[Arguments]
item_id Set a data ID.
For information about a data ID, see Subsection 5.16.2.2, "Data
ID list".
chg_level Set a change protection level. (0 to 7)
Set -1 when making no protection level change.
out_level Set an output protection level. (0 to 7)
Set -1 when making no protection level change.
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_DATA(5) The data is incorrect.
Check the data ID.
Check the current operation level and the operation level to be
changed.
EW_NOOPT(6) The necessary option is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
EW_MODE(12) The mode of the CNC is incorrect.
Place the CNC in the MDI mode.
[Description]
This function changes the change protection level and output protection level for the
data of a specified data ID.
This function can change the protection level for only data whose protection level is
the same as or lower than the current operation level.
The protection level cannot be changed to a level higher than the current operation
level.
The change protection level and output protection level cannot be changed
simultaneously.
Be sure to set -1 in one of the two arguments.
If the output protection level of data with no output function applied is changed, this
function returns EW_OK without performing any operation.
This function can be used only when the CNC is placed in the MDI mode.
- 1212 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
[Name]
cnc_rdprt_data
[Syntax]
#include <fwindow.h>
short cnc_rdprt_data( short item_id, short *item_res ) ;
[Arguments]
item_id Set a data ID.
For information about a data ID, see Subsection 5.16.2.2, "Data
ID list".
item_res Pointer to a variable where whether the data may be used is
returned
When the data may be used, 0 is set. When the data may not be
used, 1 is set.
[Return]
One of the following values is returned:
EW_OK (0) Normal termination
EW_DATA(5) The data is incorrect.
Check the data ID.
EW_NOOPT(6) The necessary option is not specified.
Enable the 8-level data protection function (bit 4 (NLV) of
parameter No. 8131 = 1).
[Description]
This function acquires information about whether the data of a specified data ID
may be used in connection with the system configuration and so forth.
- 1213 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
The tables below provide a CNC data ID list and a PMC data ID list.
- 1214 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
- 1215 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.17.1 Overview
In C Language Executor application, FTP Transfer function between CNC and host
computers (hereinafter referred to as "host") is available. By using this function, it is
possible to put the data to the host and get the data from the host in C Language
Executor application.
CNC Host
File
C Language Executor
Data
Embedded
Ethernet
or
PCMCIA
LAN
Ethernet
The following 6 functions for putting / getting data are added in C Language Executor
Library.
- 1216 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.17.2 Explanation
In C Language Executor application, the following operation (1) – (6) can be executed.
For details of the functions for performing operations (1) through (6), see Subsection
5.17.2.1, "Function references".
NOTE
1 It is necessary to set the following parameters that relate to connect
host to CNC.
- Host name
- Port number
- User name
- Password
- Login folder
For details of the method of setting the items above, refer to
Subsection, "Setting of the FTP File Transfer Function” in
"MAINTENANCE MANUAL (B-64305EN)".
2 This function performs communication with the FTP server of the
host. So, an FTP server must be set beforehand on the host.
For details of the method of setting up an FTP server, refer to
Appendix B, "EXAMPLE OF FTP SERVER SETUP", in "FANUC
FAST Ethernet, FANUC FAST DataServer OPERATOR’S MANUAL
(B-64414EN)".
- 1217 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(1) Open the communication interface in putting mode < Main, Comm, Alarm, Win >
[Name]
eth_putopen
[Syntax]
#include <ethernet.h>
short eth_putopen( short type, char *file_name ) ;
[Arguments]
type
Specify the kind of the communication function used for FTP transfer.
0 : Embedded Ethernet port or PCMCIA Ethernet card.
file_name
Specify the pointer to the file name of the host file in which the putting data is
written.
Strings of the file name are 256 characters or less including NULL in the terminal.
Please set NULL in the terminal.
[Return]
The return values are as follows.
EW_OK(0) Successful.
EW_BUSY(-1) The communication interface has already been opened.
EW_FUNC(1) It was executed by the task that can't be used other
than thefollowing tasks.
- Main task (TASK1)
- Communication task (TASK2)
- Alarm task (TASK3)
- Window task (TASK4)
EW_ATTRIB(4) The specification of "type" is wrong.
EW_REJECT(13) The communication interface has already been used by
other functions.
[Description]
The communication interface specified with "type" is opened in putting mode.
It is necessary to execute this function before putting data to the host.
When this function is executed specifying only the file name with "file_name", the
file of the specified name is made for host's current directory.
When this function is executed specifying the file name in which "file_name"
contains passing for the host that can specify the file name that contains passing, the
file is made for the specified directory.
- 1218 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
By executing the function eth_put(), it is possible to put the data to the file made for
the host by this function.
The current directory of the connected host can be checked and changed on the host
file list screen. For details of the host file list screen, refer to Section, "EMBEDDED
ETHERNET OPERATIONS", in "Common to Lathe System/Machining Center
System USER’S MANUAL (B-64304EN)".
= EW_OK
= EW_DTSRVR
Putting data
eth_put() = EW_BUFFER
= EW_OK
Data exists?
YES
NO
NOTE
1. The file might be overwrited and "EW_OK(0)" might be returned
according to the host's setting when the function eth_putopen() is
executed specifying the file name of file that the host has already.
2. When the function eth_putopen() is executed specifying the file
name that contains passing for the host that can't specify the file
name that contains passing, "EW_OK(0)" is returned.
Afterwards, when the function eth_put function() is executed,
"EW_DTSRVR(14)" is returned. At this time, when the function
cnc_getdtailerr() is executed, it gets error No.502 "It failed in the
putting of data" as detailed status.
- 1219 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(2) Put the data to the host < Main, Comm, Alarm, Win >
[Name]
eth_put
[Syntax]
#include <ethernet.h>
short eth_put( long *length, char *data ) ;
[Arguments]
length
Specify the pointer to the variable of the long type in which the number of
characters of data put to the transmit buffer is set.
When this function is executed with no error, the number of characters actually put
to the transmit buffer is set.
data
Specify the first address in the area where the data put to the transmit buffer is set.
[Return]
The return values are as follows.
EW_OK(0) Successful.
EW_FUNC(1) The function eth_putopen() is not executed.
Or, it was executed by the task that can't be used other
than the following tasks.
- Main task (TASK1)
- Communication task (TASK2)
- Alarm task (TASK3)
- Window task (TASK4)
EW_LENGTH(2) "0" or less is specified for "length".
EW_BUFFER(10) Transmit buffer full. Retry the putting of data.
EW_DTSRVR(14) Communication error occurs.
Close the communication interface.
[Description]
The data for the specified size is put to the transmit buffer.
When the empty size in the transmit buffer is less than the specified size with
"length", the data of the empty size is put and the number of characters is set in
"length".
When there is no empty size in the transmit buffer and the character cannot be put,
"EW_BUFFER(10)" is returned. Please retry the putting of data in this case.
When the communication error occurs while putting data to the host,
"EW_DTSRVR(14)" is returned. Please execute the function eht_putclose() and
close the communication interface in this case.
- 1220 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
- 1221 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(3) Close the communication interface in putting mode < Main, Comm, Alarm, Win >
[Name]
eth_putclose
[Syntax]
#include <ethernet.h>
short eth_putclose( char cancel ) ;
[Arguments]
cancel
Specify the type of the close of the communication interface when the data exists
in the transmit buffer.
0 : When the data exist in the transmit buffer, it keeps putting without closing the
communication interface.
1 : When the data exists in the transmit buffer, the putting is canceled and the
communication interface is closed.
[Return]
The return values are as follows.
EW_OK(0) Successful.
EW_BUSY(-1) Data in the transmit buffer is putting to the host.
Retry the close of the communication interface until
the putting ends.
EW_FUNC(1) The function eth_putopen() is not executed.
Or, it was executed by the task that can't be used other
than the following tasks.
- Main task (TASK1)
- Communication task (TASK2)
- Alarm task (TASK3)
- Window task (TASK4)
EW_DTSRVR(14) Communication error occurs.
Retry the close of communication interface.
[Description]
The communication interface that opened in putting mode is closed.
If "0" is specified for "cancel", this function is executed when the data exists in the
transmit buffer, "EW_BUSY(-1)" is returned without closing the communication
interface. Please wait until the putting ends or retry the close of communication
interface.
If "1" is specified for "cancel", the putting is canceled even if the data exists in the
transmit buffer, and the communication interface is closed. In this case, the data
exists in the transmit buffer is discarded, and "EW_OK(0)" is returned.
- 1222 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
When the communication error occurs while putting the data to the host or closing
the communication interface, "EW_DTSRVR(14)" is returned. Please retry the close
of communication interface until "EW_OK(0)" is returned.
For detailed information about a return value, execute the cnc_getdtailerr function.
For details of the cnc_getdtailerr function, see Subsection 3.4.1, "CNC/PMC window
library".
A detail status is set in the ODBERR structure member err_no. For details of statuses,
see Subsection 5.17.3, "Communication error detail status".
- 1223 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(4) Open the communication interface in getting mode < Main, Comm, Alarm, Win >
[Name]
eth_getopen
[Syntax]
#include <ethernet.h>
short eth_getopen( short type, char *file_name ) ;
[Arguments]
type
Specify the kind of the communication function used for FTP transfer.
0 : Embedded Ethernet port or PCMCIA Ethernet card.
file_name
Specify the pointer to the file name of the host file that is get.
Strings of the file name are 256 characters or less including NULL in the terminal.
Please set NULL in the terminal.
[Return]
The return values are as follows.
EW_OK(0) Successful.
EW_BUSY(-1) The communication interface has already been opened.
EW_FUNC(1) It was executed by the task that can't be used other than
the following tasks.
- Main task (TASK1)
- Communication task (TASK2)
- Alarm task (TASK3)
- Window task (TASK4)
EW_ATTRIB(4) The specification of "type" is wrong.
EW_REJECT(13) The communication interface has already been used by
other functions.
[Description]
The communication interface specified with "type" is opened in getting mode.
It is necessary to execute this function before getting data from the host.
When this function is executed specifying only the file name with "file_name", the
file of the specified name stored in host's current directory is opened.
When this function is executed specifying the file name in which "file_name"
contains passing for the host that can specify the file name that contains passing, the
file stored in the specified directory is opened.
By executing the function eth_get(), it is possible to get the data to the file made for
the host by this function.
- 1224 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The current directory of the connected host can be checked and changed on the host
file list screen. For details of the host file list screen, refer to Section, "EMBEDDED
ETHERNET OPERATIONS", in "Common to Lathe System/Machining Center
System USER’S MANUAL (B-64304EN)".
= EW_OK
= EW_DTSRVR
Getting data
eth_get() = EW_BUFFER
= EW_OK or EW_RESET
Getting completion?
EW_RESET NO
YES
NOTE
1. When the function eth_getopen() is executed specifying the file
name of file that host doesn't have, "EW_OK(0)" is returned.
Afterwards, when the function eth_get function() is executed,
"EW_DTSRVR(14)" is returned. At this time, when the function
cnc_getdtailerr() is executed, it gets error No.503 "It failed in the
getting of data" as detailed status.
2. When the function eth_getopen() is executed specifying the file
name that contains passing for the host that can't specify the file
name that contains passing, "EW_OK(0)" is returned.
Afterwards, when the function eth_get function() is executed,
"EW_DTSRVR(14)" is returned. At this time, when the function
cnc_getdtailerr() is executed, it gets error No.503 "It failed in the
getting of data" as detailed status.
- 1225 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(5) Get the data from the host < Main, Comm, Alarm, Win >
[Name]
eth_get
[Syntax]
#include <ethernet.h>
short eth_get( long *length, char *data ) ;
[Arguments]
length
Specify the pointer to the variable of the long type where the number of characters
of data get from the receive buffer is set.
When this function is executed with no error, the number of characters actually get
from the receive buffer is set.
data
Specify the first address in the area where the data get from the receive buffer is set.
[Return]
The return values are as follows.
EW_OK(0) Successful.
EW_RESET(-2) No getting data.
Close the communication interface.
EW_FUNC(1) The function eth_getopen() is not executed.
Or, it was executed by the task that can't be used other
than the following tasks.
- Main task (TASK1)
- Communication task (TASK2)
- Alarm task (TASK3)
- Window task (TASK4)
EW_LENGTH(2) "0" or less is specified for "length".
EW_BUFFER(10) Receive buffer empty. Retry the getting of data.
EW_DTSRVR(14) Communication error occurs.
Close the communication interface.
[Description]
The data for the specified size is get from the receive buffer.
When the data size in the receive buffer is less than the specified size with "length",
all data in the receive size is get and the number of characters is set in "length".
When there is no data in the receive buffer and the character cannot be get,
"EW_BUFFER(10)" is returned. Please retry the getting of data in this case.
- 1226 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
When this function is executed after all host's data is get, "EW_RESET" is returned.
Please execute the function eth_getclose(), and close the communication interface in
this case.
When the communication error occurs while getting data from the host,
"EW_DTSRVR(14)" is returned. Please execute the function eht_getclose() and
close the communication interface in this case.
To collect more detailed information about a return value, execute the cnc_getdtailerr
function. For details of the cnc_getdtailerr function, see Subsection 3.4.1,
"CNC/PMC window library".
A detail status is set in the ODBERR structure member err_no. For details of statuses,
see Subsection 5.17.3, "Communication error detail status".
- 1227 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
(6) Close the communication interface in getting mode < Main, Comm, Alarm, Win >
[Name]
eth_getclose
[Syntax]
#include <ethernet.h>
short eth_getclose( void ) ;
[Arguments]
------
[Return]
The return values are as follows.
EW_OK(0) Successful.
EW_RESET(-2) Getting data was canceled, and the communication was
closed.
EW_BUSY(-1) The communication interface is closed.
Retry the close of the communication interface.
EW_FUNC(1) The function eth_getopen() is not executed.
Or, it was executed by the task that can't be used other
than the following tasks.
- Main task (TASK1)
- Alarm task (TASK3)
- Communication task (TASK2)
- Window task (TASK4)
EW_DTSRVR(14) Communication error occurs.
Retry the close of the communication interface.
[Description]
The communication interface that opened in getting mode is closed.
When this function is executed while getting the data from the host, the getting is
canceled and the communication interface is closed. In this case, "EW_RESET(-2)"
is returned.
For this reason, please execute the function eth_get() until it returns
"EW_RESET(-2)" , and execute this function afterwards for getting of the all data.
When the communication error occurs while getting the data from the host or closing
the communication interface, "EW_DTSRVR(14)" is returned. Please retry the close
of communication interface until "EW_OK(0)" or "EW_RESET(-2)" is returned.
To collect more detailed information about a return value, execute the cnc_getdtailerr
function. For details of the cnc_getdtailerr function, see Subsection 3.4.1,
"CNC/PMC window library".
A detail status is set in the ODBERR structure member err_no. For details of statuses,
see Subsection 5.17.3, "Communication error detail status".
- 1228 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
The function cnc_getdtailerr() can get detailed status of the communication error, when
the communication error occurs, and "EW_DTSRVR(14)" is returned.
Error No. of detailed status and the description are as follows.
NOTE
The function cnc_getdtailerr() gets detailed status of the error that occurs
when the CNC/PMC window library function of C Language Executor and
the FOCAS2 function are executed.
Therefore, detailed status of the error that occurred when the function for
the FTP Transfer function is executed might be changed in executing the
CNC/PMC window library function of C Language Executor and the
FOCAS2 function before the function cnc_getdtailerr() is executed.
- 1229 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
- 1230 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.18.1 Overview
This function displays, on the system configuration screen, the series and edition of a
C language data file used with a C Language Executor application program or a
customization data file used for customization of the MANUAL GUIDE i screen.
In this section, a C language data file used with a C Language Executor application
program and a customization data file used for customization of the MANUAL
GUIDE i screen are collectively referred to as a user data file.
- 1231 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.18.2 Explanation
5.18.2.1 Conditions for displaying the series and editions of user data files on
the system configuration screen
To display the series and editions of user data files on the system configuration screen,
a series and edition information file and data files need to be converted and linked to
create a user data file as shown below.
By describing, in a command file for DAT2MEM.COM, the names of all data files
and a series and edition information file to be converted and linked and by using the
user data file conversion utility "DAT2MEM.COM", a user data file incorporating
series and edition information to be displayed on the system configuration screen can
be created.
For details of the formats of a command file and series and edition information file,
see Subsection 5.18.2.3, "Method of specifying a series and edition information file".
Data file
DAT2MEM.COM
Series and
Series and edition
edition
information
file
To display the series and edition information of a user data file on the system
configuration screen, all of the following conditions need to be satisfied in addition to
the condition above:
- 1232 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
To display the series and edition information of a user data file on the system
configuration screen, a user data file needs to be created by converting and linking
data files and a series and edition information file describing series and edition
information.
For details of the method of creating a user data file by converting and linking data
files and a series and edition information file, see Subsection 5.18.2.3, "Method of
specifying a series and edition information file".
Create a series and edition information file as a text file under the following name and
format:
[File name]
The name of a series and edition information file varies, depending on whether the
software name displayed on the system configuration screen is "CEXEDATAn" for C
language data files or "MGIDATAn" for customization data files. In each case,
specify the name of a series and edition information as described below.
− When the software name "CEXEDATAn" for C language data files is
displayed on the system configuration screen
CEXDATn.VER
n : One-digit number (0 to 9)
− When the software name "MGIDATAn" for customization data files is
displayed on the system configuration screen
MGIDATn.VER
n : One-digit number (0 to 9)
[Format]
Describe series and editions to be displayed on the system configuration screen,
starting at the beginning of the first line on a series and edition information file, in the
format below.
SSSSEEEE
SSSS : Series
EEEE : Edition
- 1233 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
When creating a series and edition information file, note the following:
− The file name, "CEXDATn.VER" or "MGIDATn.VER", of a series and edition
information file is fixed. If a user data file is created by specifying another file
name, series and edition information is not displayed on the system
configuration screen.
− In the file name of a series and edition information file, "n" must be the same
number as "n" in the file name, CEXnxxxx.MEM, of a user data file to be
created.
− Ensure that series and editions to be displayed on the system configuration
screen are described starting at the beginning of the first line of the file. If series
and editions are described starting on a second or subsequent line, series and
edition information is not displayed on the system configuration screen.
− If a series longer than four characters and an edition longer than four characters
are described, the first four characters from the beginning of the file are
displayed as a series and the subsequent four characters are displayed as an
edition on the system configuration screen.
− When describing series SSSS and edition EEEE, use the character codes 0x20
to 0x5F (see the table below).
0 1 2 3 4 5 6 7 8 9 A B C D E F
20 ! “ # $ % & ‘ ( ) * + , - . /
30 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
40 @ A B C D E F G H I J K L M N O
50 P Q R S T U V W X Y Z [ ¥ ] ^ _
- 1234 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
Example 1) When a series and edition information file for displaying the series
ABCD and the edition 01.0 of the C language data file
CEX0DATA.MEM on the system configuration screen is created
Example 2) When a series and edition information file for displaying the series EFG
and edition 0001 of the customization data file CEX2DATU.MEM on
the system configuration screen is created
NOTE
If the number n used in the file name, CEXDATn.VER or
MGIDATn.VER, of a series and edition information file differs from the
number n used in the file name, CEXnxxxx.MEM, of a user data file to
be created, the series and edition information of the user data file is
not displayed on the system configuration screen.
When the C language data file CEX0DATA.MEM is created, for
example, the series and edition information of the C language data file
is not displayed on the system configuration screen if the file name of
a series and edition information file is CEXDAT1.VER.
To display the series and edition information, the file name of the
series and edition information file must be CEXDAT0.VER.
- 1235 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
By creating a user data file incorporating series and edition information by converting
and linking data files and a series and edition information file describing series and
edition information through the user data file conversion utility DAT2MEM.COM,
the series and edition information of the user data file is displayed on the system
configuration screen.
To incorporate the series and edition information of a series and edition information
file in a user data file, the series and edition information file must be specified at the
start of a command file specified by DAT2MEM.COM.
For the method of using DAT2MEM.COM and details of a command file for
DAT2MEM.COM, see Section 5.5, "dat2mem utility manual" in Part II,
"PROGRAMMING".
Example) When series and edition information is incorporated into the C language
data file CEX0DATA.MEM
;================================
; DAT2MEM Specification file
;================================
;-------------------------------------------------------
CEX0DATA.MEM Be sure to specify
;------------------------------------------------------- a series and
CEXDAT0.VER edition
STRING.TXT information file at
OFSDATA.TXT the start of the
PRMDATA.TXT command file.
:
;-------------------------------------------------------
; end of spec file
NOTE
If a series and edition information file is specified not at the start of a
command file, the series and edition information file and data files are
converted and linked to create a user data file. However, the series
and edition information is not incorporated correctly and is not
displayed on the system configuration screen.
- 1236 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
5.18.2.4 User data file that enables series and edition information to be
displayed
Only when a user data file indicated below has series and edition information
incorporated, the series and edition information is displayed on the system
configuration screen.
When a user data file has no series and edition information incorporated, the system
configuration screen displays no software name, series, and edition.
CEXnxxxx.MEM
n : One-digit number (0 to 9)
x : One alphabetic character
NOTE
1 An extension other than ”*.MEM” may be used with a user data file.
2 If a C language data file created by converting and linking a series
and edition information file and data files through DAT2MEM.COM is
linked with a C Language Executor application program, the system
configuration screen displays the series and edition of the C
Language Executor application program but does not display the
series and edition information of the C language data file.
- 1237 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
Among all user data files loaded to the FROM, the series and edition information of
those user data files incorporating series and edition information is displayed on the
system configuration screen.
In the SYSTEM column (<1> in the figure below) on the system configuration screen,
a software names indicated below is displayed according to the user data file and
series and edition information file name, and the series and edition incorporated in the
user data file are displayed using four characters respectively.
- 1238 -
B-64303EN-3/01 PROGRAMMING 5.C Language Executor Function
Example) When series and edition information is incorporated into user data files as
indicated below
<1>
- 1239 -
5.C Language Executor Function PROGRAMMING B-64303EN-3/01
5.18.2.6 Restrictions
− Even if series and edition information is incorporated into a C language data file
by specifying "CEXDATn.VER" as the file name of the series and edition
information file, the series and edition information is not displayed on the
system configuration screen when C Language Executor (including FANUC
PICTURE where a C Language Executor application program created by the
machine tool builder is incorporated) is not started.
- 1240 -
B-64303EN-3/01 PROGRAMMING 6.Programming Technique
6 Programming Technique
- 1241 -
6.Programming Technique PROGRAMMING B-64303EN-3/01
Much overhead is imposed on calling of C Language Executor Library functions (when compared with
application programs running on the personal computer) for two major reasons:
So, the processing speed of an application program can be lowered if functions are called frequently. The
processing speed of an application program can be improved if the frequency of library function calls by the
application program is decreased, for example, by performing as many operations as possible in a batch.
When characters are displayed on an LCD display unit, characters are displayed at lower speed if the
ESC[>5l mode is specified to set the cursor display state. To avoid this slow display, specify usually the
ESC[>5h mode to set the cursor non-display state.
- 1242 -
B-64303EN-3/01 PROGRAMMING 6.Programming Technique
A C Language Executor application program can access two types of variables (memories).
Local memory Memory accessible by only the task that owns the memory
Memory sharable among tasks Memory accessible by all tasks
In the local memory for each task, the program code, global variables, static variables, and stack area
(including local variables) of each task are located.
Program code
Global variables
Static variables
To share information with other tasks when a multitasking application program is used, variables sharable
among tasks placed in a memory area sharable among tasks are used. C Language Executor has two memory
areas sharable among tasks, one on the S-RAM and the other on the D-RAM. Variables defined by
SRAMVER.C and DRAMVER.C of an application are placed in the memory areas sharable among tasks on
S-RAM and D-RAM, respectively.
- 1243 -
6.Programming Technique PROGRAMMING B-64303EN-3/01
These sharable memory objects in this area can be accessed by all tasks. Ensure that data to be exchanged
among tasks is placed in the memory area sharable among tasks (variables defined by SRAMVER.C or
DRAMVER.C).
Use care when exchanging a pointer among tasks. A pointer value stored in a sharable variable can be
exchanged among tasks. In this case, however, the real object pointed to by such a pointer must not be
placed in the local memory area of a particular task. If a task that has received such a pointer accesses the
local memory of another task, the access is regarded as an illegal memory access. A pointer pointing to an
object in a sharable memory may be exchanged among tasks.
- 1244 -
B-64303EN-3/01 PROGRAMMING 6.Programming Technique
With C Language Executor, man-machine interfaces such as FANUC CNC screen display and operation can
be customized to meet the particular needs of the machine tool builder. In many cases, this customization is
desirable for the machine tool builder and end users. However, note the following:
Maintenance of FANUC CNCs used in the field for machine tools is performed by FANUC service staff.
FANUC service staff is thoroughly familiar with the standard operations of FANUC CNCs but is not
familiar with the particular operation system of the machine tool builder. In some cases, FANUC service
staff may not be able to carry out maintenance smoothly if FANUC service staff cannot perform the
particular operations of the machine tool builder properly. The machine tool builder is requested to pay
attention to the following to avoid trouble in maintenance:
- Ensure that a document describing the method of application program operation is attached.
- Ensure that the NC screens (mainly screens related to the "system") needed for CNC maintenance can
be displayed.
- Ensure that basic machine operations can be performed by not operating a C Language Executor
application program (for example, ensure that basic machine operations can be performed by turning on
the power to the CNC while holding down the keys [M]+[0]).
The response of an auxiliary task to an event is not so good because of the task management specification.
With an application program that starts an auxiliary task periodically, for example, the execution interval of
the auxiliary task may vary from about 10 to 20 msec. The reason is that an auxiliary task coexists with a
task of the CNC system software and the execution priority of the auxiliary task is lower than that of the NC
task. Sufficient response is provided for general man-machine interface processing. For processing that
needs to be executed at regular intervals without fail, however, use a PMC ladder. Specifically, the PMC is
more suitable than C Language Executor for applications used, for example, to sample machine signals and
motor loads at certain intervals and to communicate with other devices periodically.
- 1245 -
APPENDIX
A. Troubleshooting If a System Alarm
Occurs in the C Language Executor
B-64303EN-3/01 APPENDIX Application Program
Either of these system alarms occurs if the program tries to reference a nonexistent address or an
address to which the program does not have access. A possible cause is that the application program
uses a pointer improperly or an argument is set incorrectly for a function call.
- 1249 -
A. Troubleshooting If a System Alarm
Occurs in the C Language Executor
Application Program APPENDIX B-64303EN-3/01
The SOFTWARE INFORMATION 1 screen shows the information that is set in the registers in CONTROL
REGISTERS, GENERAL PURPOSE REGISTERS, and FLOATING POINT REGISTERS at the occurrence of a system alarm.
If SYS_ALM001 or SYS_ALM411 occurs, the address that has actually been referenced is shown in the
lower right portion (<1> in the figure below) of the CONTROL REGISTERS area. If the system alarm occurs
because the address 00000000H has been referenced, 00000000 is displayed in the lower light portion
of the CONTROL REGISTERS area as shown below.
D4F1-01.0
SYS_ALM001 DATA ACCESS EXCEPTION
CPU CARD
2008/04/01 12:34:56
SOFTWARE INFORMATION 1
CONTROL REGISTERS <1>
8090C024 00003030 50000388 0000F930 40000000 00000000 50000388 1023E514
70000203 30000000 0A000000 000000D0 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
GENERAL PURPOSE REGISTERS
50000388 500C8364 103DA530 00000000 00000000 00000001 0000000A 00000000
01000000 500C7DD0 01000027 00000000 500C83E8 108A8EC8 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000001 108A0090 30000000 00000028
FLOATING POINT REGISTERS
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
If a system alarm occurs in the code of the C Language Executor application program, the values of
the registers used by the application program at that time are shown in GENERAL PURPOSE RESISTERS.
The values of the registers in GENERAL PURPOSE RESISTERS are related to the registers specified in
a list file automatically generated during creation of the application program, as shown below.
- 1250 -
A. Troubleshooting If a System Alarm
Occurs in the C Language Executor
B-64303EN-3/01 APPENDIX Application Program
199 # while( 1 ) {
200 # *error = disp_pos() ;
201 #$$tl 0x0 0x0 0x0
202 #$$rs 2
00000164 00 4800 0001 203 bl disp_pos
00000168 00 b07e 0000 204 sth r3,0(r30)
0000016c 00 4bff fff8 205 b .L11
206 # }
207 # }
If a system alarm occurs in the C Language Executor application program, use the following steps for
troubleshooting.
STEP 1: Check the address in PROGRAM COUNTER on the system alarm screen
On the system alarm screen, PROGRAM COUNTER shows the address used at the occurrence of the system
alarm. The C Language Executor application program is mapped onto DRAM memory from 50000000H by the
application program size.
If the address shown in PROGRAM COUNTER is not the address of the C Language Executor application
program, move through the pages of the system alarm screen. Check whether the address of the C Language
Executor application program is shown in CONTROL REGISTERS on the SOFTWARE INFORMATION 1 screen or
STACK DATA on the SOFTWARE INFORMATION 2 screen.
If none of these screen pages shows the address of the C Language Executor application program, the
system alarm may have occurred in the CNC system software.
In this case, contact FANUC and provide the following information.
- 1251 -
A. Troubleshooting If a System Alarm
Occurs in the C Language Executor
Application Program APPENDIX B-64303EN-3/01
STEP 2: Check the start address of each task in the C Language Executor application program
The start address of each task is shown in the line next to _cex_romhead_f in each of the map files
taskn.map (n: 1 to 5) automatically generated during creation of the application program.
Check the address you checked in STEP 1 against the start addresses of the tasks you checked in STEP
2 to determine the module in which the system alarm has occurred.
Then, open the map file of the task in which the system alarm has occurred. Check the lines below
_cex_romhead_f to determine in which object file the address you checked in STEP 1 is included.
Write down the start address of the appropriate object.
After determining the object file, open the list file corresponding to the source file from which
the object file has been generated.
The system alarm has occurred in the code at the address obtained by subtracting, from the address
you checked in STEP 1, the start address of the object file you wrote down.
Example of troubleshooting
The following describes troubleshooting steps to use if a system alarm shown below occurs.
D4F1-01.0
SYS_ALM001 DATA ACCESS EXCEPTION
CPU CARD
2008/04/01 12:34:56
+----------------------------------------------------------+
+ THE SYSTEM ALARM HAS OCCURRED, THE SYSTEM HAS STOPPED. +
+----------------------------------------------------------+
- 1252 -
A. Troubleshooting If a System Alarm
Occurs in the C Language Executor
B-64303EN-3/01 APPENDIX Application Program
STEP 1: Check the address in PROGRAM COUNTER on the system alarm screen
D4F1-01.0
SYS_ALM001 DATA ACCESS EXCEPTION
CPU CARD
2008/04/01 12:34:56 <1>
PROGRAM COUNTER : 50000388H
ACT TASK : 01000027H
ACCESS ADDRESS : -
ACCESS DATA : -
ACCESS OPERATION : -
+----------------------------------------------------------+
+ THE SYSTEM ALARM HAS OCCURRED, THE SYSTEM HAS STOPPED. +
+----------------------------------------------------------+
The end address of the C Language Executor application program is specified in the .romfoot
line in the map file task1.map automatically generated during creation of the application
program.
STEP 2: Check the start address of each task in the C Language Executor application
program
- 1253 -
A. Troubleshooting If a System Alarm
Occurs in the C Language Executor
Application Program APPENDIX B-64303EN-3/01
If Task3 to Task5 have been provided, you should also check the start addresses of these tasks.
The address 50000388H you checked in STEP 1 falls within the range between the start address
50000220H of Task1 you checked in STEP 2 and the start address 50000a64H of Task2, so the
system alarm has occurred in the Task1 code.
As can be seen in task1.map, the address 50000388H you checked in STEP 1 falls within the
range between the start address 50000220H of tsk1main.o and the start address 500003bcH of
tsk1sub.o.
The system alarm has therefore occurred in the code within tsk1main.c.
- 1254 -
A. Troubleshooting If a System Alarm
Occurs in the C Language Executor
B-64303EN-3/01 APPENDIX Application Program
Obtain an offset address by subtracting the start address 50000220 of tsk1main.o from the
address 50000388H you checked in STEP 1.
Open tsk1main.l and check the code at the offset address 168H obtained as described above.
199 # while( 1 ) {
200 # *error = disp_pos() ;
201 #$$tl 0x0 0x0 0x0
202 #$$rs 2
The system alarm 00000164 00 4800 0001 203 bl disp_pos
has occurred on 00000168 00 b07e 0000 204 sth r3,0(r30)
this line. 0000016c 00 4bff fff8 205 b .L11
206 # }
207 # }
- 1255 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
- 1256 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
This section describes the procedure for installing Wind River Compiler C/C++, using version 4.4b
as an example. For details of items, refer to the manual for the compiler.
Insert the Wind River Compiler C/C++ CD into your computer's CD-ROM drive. The installer starts
automatically. If the installer does not start automatically, double-click SETUP.EXE on the CD
to start the installer.
2) Installation Options
Check all items shown below.
- 1257 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
3) Tools Selection
Specify the compiler types.
Check Diab C Compiler and Diab C++ Compiler.
You will not use RTA Tools, Diab FastJ Compiler, and Library Source.
4) Target Architectures
Select the target system shown below.
Target : PowerPC
Components: PowerPC ELF Target (EABI)
- 1258 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
(Note: The entry option may vary depending on the license type. For details, contact the supplier
of your compiler.)
- 1259 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
8) File Selection
Specify the file for saving the license key.
9) Enter Information
Set the specified environment variable.
Check the path.
- 1260 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
10) PowerPC
Select PPC603.
11) PPC603
Select Hardware Floating Point.
- 1261 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
Note) You may have to set the license manager (FLEXlm License Manager) depending on the license type. For
details, contact the supplier of your compiler.
- 1262 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
Use the procedure below to install the FANUC-provided C Language Library on the hard disk.
The description is given below assuming that the following are set:
E: drive CD-ROM
C: drive Hard disk
During installation, copy the directory configuration from the CD-ROM to c:\cexe without
modification as shown below.
E:\ C:\
├Inc └cexe
├Lib ├Inc
├Tool =====> ├Lib
└User ├Tool
└User
- 1263 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
Use the procedure below to obtain and install the tools needed for creating a C Language Executor
application program.
- 1264 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
Copy the makefile and Copy the two files (templates) from the ¥User folder to the
version.c. working directory.
Set NC parameters.
- 1265 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
During installation of the Diab compiler, the installer automatically set the path. You do not
need to take any special action.
Execute path from the DOS prompt, and ensure that the path is set to include the folders shown
below.
Create the working directory in the directory where the C Language Library has been installed.
- 1266 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
Copy the minimum required files shown below from their directory to the working directory.
Create the source files (*.C and *.h) for an application program in the working directory. Edit
the files by using a text editor.
Any file name can be used.
- 1267 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
Specify the size of the F-ROM or SRAM for storing object programs.
#------------------------------------------------------------------------------
# Task definition block. Modify here for your application.
#------------------------------------------------------------------------------
TASK1 = <- List the names of object files making up the main task.
TASK2 = <- List the names of object files making up the communication task.
TASK3 = <- List the names of object files making up the alarm task.
TASK4 = <- List the names of object files making up the window task.
TASK5 = <- List the names of object files making up the High-Level task.
#------------------------------------------------------------------------------
# .O and .C dependency block.
#------------------------------------------------------------------------------
<- Specify the file dependency.
#------------------------------------------------------------------------------
# End of .O and .C dependency block.
#------------------------------------------------------------------------------
- 1268 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
#------------------------------------------------------------------------------
TASK1 = main.o sub1.o sub2.o
TASK2 = comm.o
TASK3 = alarm.o alm_sub.o
TASK4 =
TASK5 =
#------------------------------------------------------------------------------
# .O and .C dependency block.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# End of .O and .C dependency block.
#------------------------------------------------------------------------------
For a multi-task program, set the macros for the required number of tasks.
TASK1 = s1.o s2.o
TASK2 = x.o
TASK3 = y1.o y2.o y3.o
TASK4 =
- 1269 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
TASK5 =
Dependency block
#------------------------------------------------------------------------------
# .O and .C dependency block.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# End of .O and .C dependency block.
#------------------------------------------------------------------------------
Specify the relationships among object files, source files, and include files.
When S1.C includes ABC.H and S2.C includes DEF.H, write the following:
#------------------------------------------------------------------------------
# .O and .C dependency block.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# End of .O and .C dependency block.
#------------------------------------------------------------------------------
- 1270 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
For example, set the series and edition of the application program as PROG-A001.
7) Execute NMAKE.
Change the working directory to the current directory and execute the nmake command.
- 1271 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
(Example) C:\C\CEXE\WORK>nmake
(The following shows the result of execution of nmake with the source files and makefile
on the library disk.)
If a compile error or link error has occurred, modify the source files and execute
nmake again.
- 1272 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
(Note 1: If an error as shown below has occurred during compilation, increase the size of the
F-ROM for storing object programs, which is specified at the beginning of the makefile,
or decrease the size of the source code.)
(Note 2: If a warning as shown below has occurred during compilation, check whether an array
declared as an automatic variable has been initialized upon declaration.)
When nmake has been completed successfully, a file called cexec.mem is created.
This file is a memory card file to be stored in the CNC.
Copy the file to the memory card.
- 1273 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
- 1274 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
NOTE
When this parameter has been set, the power must be turned off
before operation is continued.
NOTE
The actually usable size is limited by the RAM capacity and selected
option(s).
- 1275 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
9) Store the created application program on the F-ROM in the CNC and check the operation.
Use the procedure for operating the boot software for the CNC so that the cexec.mem file copied
to the memory card is stored on the F-ROM in the CNC as the application program.
Then, check the operation.
When the cexec.mem file is created from the sample program (tsk1main.c) stored in C:\cexe\user
and executed in the CNC unit, if the power is turned on or soft key [CEXE] under function key
<POSITION> is pressed, the following screen appears.
- 1276 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
#include "escape.h"
int task1_var1;
int task1_var2 = 0;
//const task1_var3 = 0;
- 1277 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
cls();
crt_opengr() ;
crt_graphic(CRT_ON_BEAM);
_clearscreen( _GCLEARSCREEN );
/* graphics sample */
_setlinestyle(0xFFEA);
for (i = 0 ; i < 40 ; i++) {
_setcolor((short)(i % 7 + 1)) ;
_moveto((short)(8 * i), (short)(6 * i)) ;
_lineto((short)(639 - 8 * i), (short)(6 * i)) ;
_lineto((short)(639 - 8 * i), (short)(479 - 6 * i)) ;
_lineto((short)(8 * i), (short)(479 - 6 * i)) ;
_lineto((short)(8 * i), (short)(6 * i)) ;
}
printf("\n") ;
printf("PRESS INPUT KEY\n") ;
for (;;) {
/* key read */
key_code = _kbhit() ;
if (key_code) break;
}
cls();
_clearscreen( _GCLEARSCREEN );
crt_closegr();
/* position sample */
cursor_off();
while( 1 ) {
cnc_rddynamic( -1, sizeof(all_data), &all_data );
line = 2;
- 1278 -
B. Additional Information on C
B-64303EN-3/01 APPENDIX
Compiler Installation
col = 20;
locate( line++, col );
printf( "ABSOLUTE" ) ;
locate( line++, col );
printf( "1:%8ld", all_data.pos.faxis.absolute[0] );
locate( line++, col );
printf( "2:%8ld", all_data.pos.faxis.absolute[1] );
locate( line++, col );
printf( "3:%8ld", all_data.pos.faxis.absolute[2] );
locate( line++, col );
printf( "4:%8ld", all_data.pos.faxis.absolute[3] );
line++;
locate( line++, col );
printf( "MACHINE" );
locate( line++, col );
printf( "1:%8ld", all_data.pos.faxis.machine[0] );
locate( line++, col );
printf( "2:%8ld", all_data.pos.faxis.machine[1] );
locate( line++, col );
printf( "3:%8ld", all_data.pos.faxis.machine[2] );
locate( line++, col );
printf( "4:%8ld", all_data.pos.faxis.machine[3] );
line++;
locate( line++, col );
printf( "RELATIVE" ) ;
locate( line++, col );
printf( "1:%8ld", all_data.pos.faxis.relative[0] );
locate( line++, col );
printf( "2:%8ld", all_data.pos.faxis.relative[1] );
locate( line++, col );
printf( "3:%8ld", all_data.pos.faxis.relative[2] );
locate( line++, col );
printf( "4:%8ld", all_data.pos.faxis.relative[3] );
line++;
locate( line++, col );
printf( "DIST" );
locate( line++, col );
printf( "1:%8ld", all_data.pos.faxis.distance[0] );
locate( line++, col );
printf( "2:%8ld", all_data.pos.faxis.distance[1] );
locate( line++, col );
printf( "3:%8ld", all_data.pos.faxis.distance[2] );
locate( line++, col );
printf( "4:%8ld", all_data.pos.faxis.distance[3] );
- 1279 -
B. Additional Information on C
Compiler Installation APPENDIX B-64303EN-3/01
}
}
- 1280 -
B-64303EN-3/01 APPENDIX C.Character Code List
D.1 Half-size character code list (for 8.4-inch color LCD) .................................. 1282
D.2 Half-size character code list (for 10.4-inch color LCD) ................................ 1283
D.3 FANUC character code list (for 8.4-inch color LCD) ................................... 1289
D.4 FANUC character code list (for 10.4-inch color LCD) ................................. 1294
Width x length
Half-size characters for 8.4-inch color LCD 16 x 25
Full-size characters for 8.4-inch color LCD 32 x 25
Half-size characters for 10.4-inch color LCD 8 x 16
Full-size characters for 10.4-inch color LCD 16 x 16
Different scales are used in the printed characters for the 8.4-inch color LCD and
those for the 10.4-inch color LCD.
- 1281 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1282 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1283 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1284 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1285 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1286 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1287 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1288 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1289 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1290 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1291 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1292 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1293 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1294 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1295 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1296 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1297 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1298 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1299 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1300 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1301 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1302 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1303 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1304 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1305 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1306 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1307 -
C.Character Code List APPENDIX B-64303EN-3/01
- 1308 -
B-64303EN-3/01 APPENDIX C.Character Code List
- 1309 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
- 1310 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a1a0 、 。 · ˉ ˇ ¨ 〃 々 — ~ ‖ … ‘ ’
a1b0 “ ” 〔 〕 〈 〉 《 》 「 」 『 』 〖 〗 【 】
a1c0 ± × ÷ ∶ ∧ ∨ Σ Π ∪ ∩ ∈ ∷ √ ⊥ ∥ ∠
a1d0 ⌒ ⊙ ∫ ∮ ≡ ≌ ≈ ∽ ∝ ≠ ≮ ≯ ≤ ≥ ∞ ∵
a1e0 ∴ ♂ ♀ ° ′ ″ ℃ $ ¤ ¢ £ ‰ § № ☆ ★
a1f0 ○ ● ◎ ◇ ◆ □ ■ △ ▲ ※ → ← ↑ ↓ 〓
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a2a0
a2b0 ⒈ ⒉ ⒊ ⒋ ⒌ ⒍ ⒎ ⒏ ⒐ ⒑ ⒒ ⒓ ⒔ ⒕ ⒖
a2c0 ⒗ ⒘ ⒙ ⒚ ⒛ ⑴ ⑵ ⑶ ⑷ ⑸ ⑹ ⑺ ⑻ ⑼ ⑽ ⑾
a2d0 ⑿ ⒀ ⒁ ⒂ ⒃ ⒄ ⒅ ⒆ ⒇ ① ② ③ ④ ⑤ ⑥ ⑦
a2e0 ⑧ ⑨ ⑩ ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
a2f0 Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ Ⅺ Ⅻ
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a3a0 ! " # ¥ % & ' ( ) * + , - . /
a3b0 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
a3c0 @ A B C D E F G H I J K L M N O
a3d0 P Q R S T U V W X Y Z [ \ ] ^ _
a3e0 ` a b c d e f g h i j k l m n o
a3f0 p q r s t u v w x y z { | }  ̄
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a4a0 ぁ あ ぃ い ぅ う ぇ え ぉ お か が き ぎ く
a4b0 ぐ け げ こ ご さ ざ し じ す ず せ ぜ そ ぞ た
a4c0 だ ち ぢ っ つ づ て で と ど な に ぬ ね の は
a4d0 ば ぱ ひ び ぴ ふ ぶ ぷ へ べ ぺ ほ ぼ ぽ ま み
a4e0 む め も ゃ や ゅ ゆ ょ よ ら り る れ ろ ゎ わ
a4f0 ゐ ゑ を ん
- 1311 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a5a0 ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク
a5b0 グ ケ ゲ コ ゴ サ ザ シ ジ ス ズ セ ゼ ソ ゾ タ
a5c0 ダ チ ヂ ッ ツ ヅ テ デ ト ド ナ ニ ヌ ネ ノ ハ
a5d0 バ パ ヒ ビ ピ フ ブ プ ヘ ベ ペ ホ ボ ポ マ ミ
a5e0 ム メ モ ャ ヤ ュ ユ ョ ヨ ラ リ ル レ ロ ヮ ワ
a5f0 ヰ ヱ ヲ ン ヴ ヵ ヶ
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a6a0 Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο
a6b0 Π Ρ Σ Τ Υ Φ Χ Ψ Ω
a6c0 α β γ δ ε ζ η θ ι κ λ μ ν ξ ο
a6d0 π ρ σ τ υ φ χ ψ ω
a6e0
a6f0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a7a0 А Б В Г Д Е Ё Ж З И Й К Л М Н
a7b0 О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э
a7c0 Ю Я
a7d0 а б в г д е ё ж з и й к л м н
a7e0 о п р с т у ф х ц ч ш щ ъ ы ь э
a7f0 ю я
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a8a0 ā á ǎ à ē é ě è ī í ǐ ì ō ó ǒ
a8b0 ò ū ú ǔ ù ǖ ǘ ǚ ǜ ü ê ɑ ń ň
a8c0 ɡ ㄅ ㄆ ㄇ ㄈ ㄉ ㄊ ㄋ ㄌ ㄍ ㄎ ㄏ
a8d0 ㄐ ㄑ ㄒ ㄓ ㄔ ㄕ ㄖ ㄗ ㄘ ㄙ ㄚ ㄛ ㄜ ㄝ ㄞ ㄟ
a8e0 ㄠ ㄡ ㄢ ㄣ ㄤ ㄥ ㄦ ㄧ ㄨ ㄩ
a8f0
- 1312 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
a9a0 ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋
a9b0 ┌ ┍ ┎ ┏ ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛
a9c0 ├ ┝ ┞ ┟ ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫
a9d0 ┬ ┭ ┮ ┯ ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻
a9e0 ┼ ┽ ┾ ┿ ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋
a9f0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
aaa0
aab0
aac0
aad0
aae0
aaf0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
aba0
abb0
abc0
abd0
abe0
abf0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
aca0
acb0
acc0
acd0
ace0
acf0
- 1313 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
ada0
adb0
adc0
add0
ade0
adf0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
aea0
aeb0
aec0
aed0
aee0
aef0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
afa0
afb0
afc0
afd0
afe0
aff0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b0a0 啊 阿 埃 挨 哎 唉 哀 皑 癌 蔼 矮 艾 碍 爱 隘
b0b0 鞍 氨 安 俺 按 暗 岸 胺 案 肮 昂 盎 凹 敖 熬 翱
b0c0 袄 傲 奥 懊 澳 芭 捌 扒 叭 吧 笆 八 疤 巴 拔 跋
b0d0 靶 把 耙 坝 霸 罢 爸 白 柏 百 摆 佰 败 拜 稗 斑
b0e0 班 搬 扳 般 颁 板 版 扮 拌 伴 瓣 半 办 绊 邦 帮
b0f0 梆 榜 膀 绑 棒 磅 蚌 镑 傍 谤 苞 胞 包 褒 剥
- 1314 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b1a0 薄 雹 保 堡 饱 宝 抱 报 暴 豹 鲍 爆 杯 碑 悲
b1b0 卑 北 辈 背 贝 钡 倍 狈 备 惫 焙 被 奔 苯 本 笨
b1c0 崩 绷 甭 泵 蹦 迸 逼 鼻 比 鄙 笔 彼 碧 蓖 蔽 毕
b1d0 毙 毖 币 庇 痹 闭 敝 弊 必 辟 壁 臂 避 陛 鞭 边
b1e0 编 贬 扁 便 变 卞 辨 辩 辫 遍 标 彪 膘 表 鳖 憋
b1f0 别 瘪 彬 斌 濒 滨 宾 摈 兵 冰 柄 丙 秉 饼 炳
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b2a0 病 并 玻 菠 播 拨 钵 波 博 勃 搏 铂 箔 伯 帛
b2b0 舶 脖 膊 渤 泊 驳 捕 卜 哺 补 埠 不 布 步 簿 部
b2c0 怖 擦 猜 裁 材 才 财 睬 踩 采 彩 菜 蔡 餐 参 蚕
b2d0 残 惭 惨 灿 苍 舱 仓 沧 藏 操 糙 槽 曹 草 厕 策
b2e0 侧 册 测 层 蹭 插 叉 茬 茶 查 碴 搽 察 岔 差 诧
b2f0 拆 柴 豺 搀 掺 蝉 馋 谗 缠 铲 产 阐 颤 昌 猖
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b3a0 场 尝 常 长 偿 肠 厂 敞 畅 唱 倡 超 抄 钞 朝
b3b0 嘲 潮 巢 吵 炒 车 扯 撤 掣 彻 澈 郴 臣 辰 尘 晨
b3c0 忱 沉 陈 趁 衬 撑 称 城 橙 成 呈 乘 程 惩 澄 诚
b3d0 承 逞 骋 秤 吃 痴 持 匙 池 迟 弛 驰 耻 齿 侈 尺
b3e0 赤 翅 斥 炽 充 冲 虫 崇 宠 抽 酬 畴 踌 稠 愁 筹
b3f0 仇 绸 瞅 丑 臭 初 出 橱 厨 躇 锄 雏 滁 除 楚
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b4a0 础 储 矗 搐 触 处 揣 川 穿 椽 传 船 喘 串 疮
b4b0 窗 幢 床 闯 创 吹 炊 捶 锤 垂 春 椿 醇 唇 淳 纯
b4c0 蠢 戳 绰 疵 茨 磁 雌 辞 慈 瓷 词 此 刺 赐 次 聪
b4d0 葱 囱 匆 从 丛 凑 粗 醋 簇 促 蹿 篡 窜 摧 崔 催
b4e0 脆 瘁 粹 淬 翠 村 存 寸 磋 撮 搓 措 挫 错 搭 达
b4f0 答 瘩 打 大 呆 歹 傣 戴 带 殆 代 贷 袋 待 逮
- 1315 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b5a0 怠 耽 担 丹 单 郸 掸 胆 旦 氮 但 惮 淡 诞 弹
b5b0 蛋 当 挡 党 荡 档 刀 捣 蹈 倒 岛 祷 导 到 稻 悼
b5c0 道 盗 德 得 的 蹬 灯 登 等 瞪 凳 邓 堤 低 滴 迪
b5d0 敌 笛 狄 涤 翟 嫡 抵 底 地 蒂 第 帝 弟 递 缔 颠
b5e0 掂 滇 碘 点 典 靛 垫 电 佃 甸 店 惦 奠 淀 殿 碉
b5f0 叼 雕 凋 刁 掉 吊 钓 调 跌 爹 碟 蝶 迭 谍 叠
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b6a0 丁 盯 叮 钉 顶 鼎 锭 定 订 丢 东 冬 董 懂 动
b6b0 栋 侗 恫 冻 洞 兜 抖 斗 陡 豆 逗 痘 都 督 毒 犊
b6c0 独 读 堵 睹 赌 杜 镀 肚 度 渡 妒 端 短 锻 段 断
b6d0 缎 堆 兑 队 对 墩 吨 蹲 敦 顿 囤 钝 盾 遁 掇 哆
b6e0 多 夺 垛 躲 朵 跺 舵 剁 惰 堕 蛾 峨 鹅 俄 额 讹
b6f0 娥 恶 厄 扼 遏 鄂 饿 恩 而 儿 耳 尔 饵 洱 二
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b7a0 贰 发 罚 筏 伐 乏 阀 法 珐 藩 帆 番 翻 樊 矾
b7b0 钒 繁 凡 烦 反 返 范 贩 犯 饭 泛 坊 芳 方 肪 房
b7c0 防 妨 仿 访 纺 放 菲 非 啡 飞 肥 匪 诽 吠 肺 废
b7d0 沸 费 芬 酚 吩 氛 分 纷 坟 焚 汾 粉 奋 份 忿 愤
b7e0 粪 丰 封 枫 蜂 峰 锋 风 疯 烽 逢 冯 缝 讽 奉 凤
b7f0 佛 否 夫 敷 肤 孵 扶 拂 辐 幅 氟 符 伏 俘 服
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b8a0 浮 涪 福 袱 弗 甫 抚 辅 俯 釜 斧 脯 腑 府 腐
b8b0 赴 副 覆 赋 复 傅 付 阜 父 腹 负 富 讣 附 妇 缚
b8c0 咐 噶 嘎 该 改 概 钙 盖 溉 干 甘 杆 柑 竿 肝 赶
b8d0 感 秆 敢 赣 冈 刚 钢 缸 肛 纲 岗 港 杠 篙 皋 高
b8e0 膏 羔 糕 搞 镐 稿 告 哥 歌 搁 戈 鸽 胳 疙 割 革
b8f0 葛 格 蛤 阁 隔 铬 个 各 给 根 跟 耕 更 庚 羹
- 1316 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
b9a0 埂 耿 梗 工 攻 功 恭 龚 供 躬 公 宫 弓 巩 汞
b9b0 拱 贡 共 钩 勾 沟 苟 狗 垢 构 购 够 辜 菇 咕 箍
b9c0 估 沽 孤 姑 鼓 古 蛊 骨 谷 股 故 顾 固 雇 刮 瓜
b9d0 剐 寡 挂 褂 乖 拐 怪 棺 关 官 冠 观 管 馆 罐 惯
b9e0 灌 贯 光 广 逛 瑰 规 圭 硅 归 龟 闺 轨 鬼 诡 癸
b9f0 桂 柜 跪 贵 刽 辊 滚 棍 锅 郭 国 果 裹 过 哈
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
baa0 骸 孩 海 氦 亥 害 骇 酣 憨 邯 韩 含 涵 寒 函
bab0 喊 罕 翰 撼 捍 旱 憾 悍 焊 汗 汉 夯 杭 航 壕 嚎
bac0 豪 毫 郝 好 耗 号 浩 呵 喝 荷 菏 核 禾 和 何 合
bad0 盒 貉 阂 河 涸 赫 褐 鹤 贺 嘿 黑 痕 很 狠 恨 哼
bae0 亨 横 衡 恒 轰 哄 烘 虹 鸿 洪 宏 弘 红 喉 侯 猴
baf0 吼 厚 候 后 呼 乎 忽 瑚 壶 葫 胡 蝴 狐 糊 湖
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
bba0 弧 虎 唬 护 互 沪 户 花 哗 华 猾 滑 画 划 化
bbb0 话 槐 徊 怀 淮 坏 欢 环 桓 还 缓 换 患 唤 痪 豢
bbc0 焕 涣 宦 幻 荒 慌 黄 磺 蝗 簧 皇 凰 惶 煌 晃 幌
bbd0 恍 谎 灰 挥 辉 徽 恢 蛔 回 毁 悔 慧 卉 惠 晦 贿
bbe0 秽 会 烩 汇 讳 诲 绘 荤 昏 婚 魂 浑 混 豁 活 伙
bbf0 火 获 或 惑 霍 货 祸 击 圾 基 机 畸 稽 积 箕
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
bca0 肌 饥 迹 激 讥 鸡 姬 绩 缉 吉 极 棘 辑 籍 集
bcb0 及 急 疾 汲 即 嫉 级 挤 几 脊 己 蓟 技 冀 季 伎
bcc0 祭 剂 悸 济 寄 寂 计 记 既 忌 际 妓 继 纪 嘉 枷
bcd0 夹 佳 家 加 荚 颊 贾 甲 钾 假 稼 价 架 驾 嫁 歼
bce0 监 坚 尖 笺 间 煎 兼 肩 艰 奸 缄 茧 检 柬 碱 硷
bcf0 拣 捡 简 俭 剪 减 荐 槛 鉴 践 贱 见 键 箭 件
- 1317 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
bda0 健 舰 剑 饯 渐 溅 涧 建 僵 姜 将 浆 江 疆 蒋
bdb0 桨 奖 讲 匠 酱 降 蕉 椒 礁 焦 胶 交 郊 浇 骄 娇
bdc0 嚼 搅 铰 矫 侥 脚 狡 角 饺 缴 绞 剿 教 酵 轿 较
bdd0 叫 窖 揭 接 皆 秸 街 阶 截 劫 节 桔 杰 捷 睫 竭
bde0 洁 结 解 姐 戒 藉 芥 界 借 介 疥 诫 届 巾 筋 斤
bdf0 金 今 津 襟 紧 锦 仅 谨 进 靳 晋 禁 近 烬 浸
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
bea0 尽 劲 荆 兢 茎 睛 晶 鲸 京 惊 精 粳 经 井 警
beb0 景 颈 静 境 敬 镜 径 痉 靖 竟 竞 净 炯 窘 揪 究
bec0 纠 玖 韭 久 灸 九 酒 厩 救 旧 臼 舅 咎 就 疚 鞠
bed0 拘 狙 疽 居 驹 菊 局 咀 矩 举 沮 聚 拒 据 巨 具
bee0 距 踞 锯 俱 句 惧 炬 剧 捐 鹃 娟 倦 眷 卷 绢 撅
bef0 攫 抉 掘 倔 爵 觉 决 诀 绝 均 菌 钧 军 君 峻
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
bfa0 俊 竣 浚 郡 骏 喀 咖 卡 咯 开 揩 楷 凯 慨 刊
bfb0 堪 勘 坎 砍 看 康 慷 糠 扛 抗 亢 炕 考 拷 烤 靠
bfc0 坷 苛 柯 棵 磕 颗 科 壳 咳 可 渴 克 刻 客 课 肯
bfd0 啃 垦 恳 坑 吭 空 恐 孔 控 抠 口 扣 寇 枯 哭 窟
bfe0 苦 酷 库 裤 夸 垮 挎 跨 胯 块 筷 侩 快 宽 款 匡
bff0 筐 狂 框 矿 眶 旷 况 亏 盔 岿 窥 葵 奎 魁 傀
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c0a0 馈 愧 溃 坤 昆 捆 困 括 扩 廓 阔 垃 拉 喇 蜡
c0b0 腊 辣 啦 莱 来 赖 蓝 婪 栏 拦 篮 阑 兰 澜 谰 揽
c0c0 览 懒 缆 烂 滥 琅 榔 狼 廊 郎 朗 浪 捞 劳 牢 老
c0d0 佬 姥 酪 烙 涝 勒 乐 雷 镭 蕾 磊 累 儡 垒 擂 肋
c0e0 类 泪 棱 楞 冷 厘 梨 犁 黎 篱 狸 离 漓 理 李 里
c0f0 鲤 礼 莉 荔 吏 栗 丽 厉 励 砾 历 利 傈 例 俐
- 1318 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c1a0 痢 立 粒 沥 隶 力 璃 哩 俩 联 莲 连 镰 廉 怜
c1b0 涟 帘 敛 脸 链 恋 炼 练 粮 凉 梁 粱 良 两 辆 量
c1c0 晾 亮 谅 撩 聊 僚 疗 燎 寥 辽 潦 了 撂 镣 廖 料
c1d0 列 裂 烈 劣 猎 琳 林 磷 霖 临 邻 鳞 淋 凛 赁 吝
c1e0 拎 玲 菱 零 龄 铃 伶 羚 凌 灵 陵 岭 领 另 令 溜
c1f0 琉 榴 硫 馏 留 刘 瘤 流 柳 六 龙 聋 咙 笼 窿
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c2a0 隆 垄 拢 陇 楼 娄 搂 篓 漏 陋 芦 卢 颅 庐 炉
c2b0 掳 卤 虏 鲁 麓 碌 露 路 赂 鹿 潞 禄 录 陆 戮 驴
c2c0 吕 铝 侣 旅 履 屡 缕 虑 氯 律 率 滤 绿 峦 挛 孪
c2d0 滦 卵 乱 掠 略 抡 轮 伦 仑 沦 纶 论 萝 螺 罗 逻
c2e0 锣 箩 骡 裸 落 洛 骆 络 妈 麻 玛 码 蚂 马 骂 嘛
c2f0 吗 埋 买 麦 卖 迈 脉 瞒 馒 蛮 满 蔓 曼 慢 漫
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c3a0 谩 芒 茫 盲 氓 忙 莽 猫 茅 锚 毛 矛 铆 卯 茂
c3b0 冒 帽 貌 贸 么 玫 枚 梅 酶 霉 煤 没 眉 媒 镁 每
c3c0 美 昧 寐 妹 媚 门 闷 们 萌 蒙 檬 盟 锰 猛 梦 孟
c3d0 眯 醚 靡 糜 迷 谜 弥 米 秘 觅 泌 蜜 密 幂 棉 眠
c3e0 绵 冕 免 勉 娩 缅 面 苗 描 瞄 藐 秒 渺 庙 妙 蔑
c3f0 灭 民 抿 皿 敏 悯 闽 明 螟 鸣 铭 名 命 谬 摸
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c4a0 摹 蘑 模 膜 磨 摩 魔 抹 末 莫 墨 默 沫 漠 寞
c4b0 陌 谋 牟 某 拇 牡 亩 姆 母 墓 暮 幕 募 慕 木 目
c4c0 睦 牧 穆 拿 哪 呐 钠 那 娜 纳 氖 乃 奶 耐 奈 南
c4d0 男 难 囊 挠 脑 恼 闹 淖 呢 馁 内 嫩 能 妮 霓 倪
c4e0 泥 尼 拟 你 匿 腻 逆 溺 蔫 拈 年 碾 撵 捻 念 娘
c4f0 酿 鸟 尿 捏 聂 孽 啮 镊 镍 涅 您 柠 狞 凝 宁
- 1319 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c5a0 拧 泞 牛 扭 钮 纽 脓 浓 农 弄 奴 努 怒 女 暖
c5b0 虐 疟 挪 懦 糯 诺 哦 欧 鸥 殴 藕 呕 偶 沤 啪 趴
c5c0 爬 帕 怕 琶 拍 排 牌 徘 湃 派 攀 潘 盘 磐 盼 畔
c5d0 判 叛 乓 庞 旁 耪 胖 抛 咆 刨 炮 袍 跑 泡 呸 胚
c5e0 培 裴 赔 陪 配 佩 沛 喷 盆 砰 抨 烹 澎 彭 蓬 棚
c5f0 硼 篷 膨 朋 鹏 捧 碰 坯 砒 霹 批 披 劈 琵 毗
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c6a0 啤 脾 疲 皮 匹 痞 僻 屁 譬 篇 偏 片 骗 飘 漂
c6b0 瓢 票 撇 瞥 拼 频 贫 品 聘 乒 坪 苹 萍 平 凭 瓶
c6c0 评 屏 坡 泼 颇 婆 破 魄 迫 粕 剖 扑 铺 仆 莆 葡
c6d0 菩 蒲 埔 朴 圃 普 浦 谱 曝 瀑 期 欺 栖 戚 妻 七
c6e0 凄 漆 柒 沏 其 棋 奇 歧 畦 崎 脐 齐 旗 祈 祁 骑
c6f0 起 岂 乞 企 启 契 砌 器 气 迄 弃 汽 泣 讫 掐
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c7a0 恰 洽 牵 扦 钎 铅 千 迁 签 仟 谦 乾 黔 钱 钳
c7b0 前 潜 遣 浅 谴 堑 嵌 欠 歉 枪 呛 腔 羌 墙 蔷 强
c7c0 抢 橇 锹 敲 悄 桥 瞧 乔 侨 巧 鞘 撬 翘 峭 俏 窍
c7d0 切 茄 且 怯 窃 钦 侵 亲 秦 琴 勤 芹 擒 禽 寝 沁
c7e0 青 轻 氢 倾 卿 清 擎 晴 氰 情 顷 请 庆 琼 穷 秋
c7f0 丘 邱 球 求 囚 酋 泅 趋 区 蛆 曲 躯 屈 驱 渠
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c8a0 取 娶 龋 趣 去 圈 颧 权 醛 泉 全 痊 拳 犬 券
c8b0 劝 缺 炔 瘸 却 鹊 榷 确 雀 裙 群 然 燃 冉 染 瓤
c8c0 壤 攘 嚷 让 饶 扰 绕 惹 热 壬 仁 人 忍 韧 任 认
c8d0 刃 妊 纫 扔 仍 日 戎 茸 蓉 荣 融 熔 溶 容 绒 冗
c8e0 揉 柔 肉 茹 蠕 儒 孺 如 辱 乳 汝 入 褥 软 阮 蕊
c8f0 瑞 锐 闰 润 若 弱 撒 洒 萨 腮 鳃 塞 赛 三 叁
- 1320 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
c9a0 伞 散 桑 嗓 丧 搔 骚 扫 嫂 瑟 色 涩 森 僧 莎
c9b0 砂 杀 刹 沙 纱 傻 啥 煞 筛 晒 珊 苫 杉 山 删 煽
c9c0 衫 闪 陕 擅 赡 膳 善 汕 扇 缮 墒 伤 商 赏 晌 上
c9d0 尚 裳 梢 捎 稍 烧 芍 勺 韶 少 哨 邵 绍 奢 赊 蛇
c9e0 舌 舍 赦 摄 射 慑 涉 社 设 砷 申 呻 伸 身 深 娠
c9f0 绅 神 沈 审 婶 甚 肾 慎 渗 声 生 甥 牲 升 绳
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
caa0 省 盛 剩 胜 圣 师 失 狮 施 湿 诗 尸 虱 十 石
cab0 拾 时 什 食 蚀 实 识 史 矢 使 屎 驶 始 式 示 士
cac0 世 柿 事 拭 誓 逝 势 是 嗜 噬 适 仕 侍 释 饰 氏
cad0 市 恃 室 视 试 收 手 首 守 寿 授 售 受 瘦 兽 蔬
cae0 枢 梳 殊 抒 输 叔 舒 淑 疏 书 赎 孰 熟 薯 暑 曙
caf0 署 蜀 黍 鼠 属 术 述 树 束 戍 竖 墅 庶 数 漱
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
cba0 恕 刷 耍 摔 衰 甩 帅 栓 拴 霜 双 爽 谁 水 睡
cbb0 税 吮 瞬 顺 舜 说 硕 朔 烁 斯 撕 嘶 思 私 司 丝
cbc0 死 肆 寺 嗣 四 伺 似 饲 巳 松 耸 怂 颂 送 宋 讼
cbd0 诵 搜 艘 擞 嗽 苏 酥 俗 素 速 粟 僳 塑 溯 宿 诉
cbe0 肃 酸 蒜 算 虽 隋 随 绥 髓 碎 岁 穗 遂 隧 祟 孙
cbf0 损 笋 蓑 梭 唆 缩 琐 索 锁 所 塌 他 它 她 塔
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
cca0 獭 挞 蹋 踏 胎 苔 抬 台 泰 酞 太 态 汰 坍 摊
ccb0 贪 瘫 滩 坛 檀 痰 潭 谭 谈 坦 毯 袒 碳 探 叹 炭
ccc0 汤 塘 搪 堂 棠 膛 唐 糖 倘 躺 淌 趟 烫 掏 涛 滔
ccd0 绦 萄 桃 逃 淘 陶 讨 套 特 藤 腾 疼 誊 梯 剔 踢
cce0 锑 提 题 蹄 啼 体 替 嚏 惕 涕 剃 屉 天 添 填 田
ccf0 甜 恬 舔 腆 挑 条 迢 眺 跳 贴 铁 帖 厅 听 烃
- 1321 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
cda0 汀 廷 停 亭 庭 挺 艇 通 桐 酮 瞳 同 铜 彤 童
cdb0 桶 捅 筒 统 痛 偷 投 头 透 凸 秃 突 图 徒 途 涂
cdc0 屠 土 吐 兔 湍 团 推 颓 腿 蜕 褪 退 吞 屯 臀 拖
cdd0 托 脱 鸵 陀 驮 驼 椭 妥 拓 唾 挖 哇 蛙 洼 娃 瓦
cde0 袜 歪 外 豌 弯 湾 玩 顽 丸 烷 完 碗 挽 晚 皖 惋
cdf0 宛 婉 万 腕 汪 王 亡 枉 网 往 旺 望 忘 妄 威
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
cea0 巍 微 危 韦 违 桅 围 唯 惟 为 潍 维 苇 萎 委
ceb0 伟 伪 尾 纬 未 蔚 味 畏 胃 喂 魏 位 渭 谓 尉 慰
cec0 卫 瘟 温 蚊 文 闻 纹 吻 稳 紊 问 嗡 翁 瓮 挝 蜗
ced0 涡 窝 我 斡 卧 握 沃 巫 呜 钨 乌 污 诬 屋 无 芜
cee0 梧 吾 吴 毋 武 五 捂 午 舞 伍 侮 坞 戊 雾 晤 物
cef0 勿 务 悟 误 昔 熙 析 西 硒 矽 晰 嘻 吸 锡 牺
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
cfa0 稀 息 希 悉 膝 夕 惜 熄 烯 溪 汐 犀 檄 袭 席
cfb0 习 媳 喜 铣 洗 系 隙 戏 细 瞎 虾 匣 霞 辖 暇 峡
cfc0 侠 狭 下 厦 夏 吓 掀 锨 先 仙 鲜 纤 咸 贤 衔 舷
cfd0 闲 涎 弦 嫌 显 险 现 献 县 腺 馅 羡 宪 陷 限 线
cfe0 相 厢 镶 香 箱 襄 湘 乡 翔 祥 详 想 响 享 项 巷
cff0 橡 像 向 象 萧 硝 霄 削 哮 嚣 销 消 宵 淆 晓
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d0a0 小 孝 校 肖 啸 笑 效 楔 些 歇 蝎 鞋 协 挟 携
d0b0 邪 斜 胁 谐 写 械 卸 蟹 懈 泄 泻 谢 屑 薪 芯 锌
d0c0 欣 辛 新 忻 心 信 衅 星 腥 猩 惺 兴 刑 型 形 邢
d0d0 行 醒 幸 杏 性 姓 兄 凶 胸 匈 汹 雄 熊 休 修 羞
d0e0 朽 嗅 锈 秀 袖 绣 墟 戌 需 虚 嘘 须 徐 许 蓄 酗
d0f0 叙 旭 序 畜 恤 絮 婿 绪 续 轩 喧 宣 悬 旋 玄
- 1322 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d1a0 选 癣 眩 绚 靴 薛 学 穴 雪 血 勋 熏 循 旬 询
d1b0 寻 驯 巡 殉 汛 训 讯 逊 迅 压 押 鸦 鸭 呀 丫 芽
d1c0 牙 蚜 崖 衙 涯 雅 哑 亚 讶 焉 咽 阉 烟 淹 盐 严
d1d0 研 蜒 岩 延 言 颜 阎 炎 沿 奄 掩 眼 衍 演 艳 堰
d1e0 燕 厌 砚 雁 唁 彦 焰 宴 谚 验 殃 央 鸯 秧 杨 扬
d1f0 佯 疡 羊 洋 阳 氧 仰 痒 养 样 漾 邀 腰 妖 瑶
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d2a0 摇 尧 遥 窑 谣 姚 咬 舀 药 要 耀 椰 噎 耶 爷
d2b0 野 冶 也 页 掖 业 叶 曳 腋 夜 液 一 壹 医 揖 铱
d2c0 依 伊 衣 颐 夷 遗 移 仪 胰 疑 沂 宜 姨 彝 椅 蚁
d2d0 倚 已 乙 矣 以 艺 抑 易 邑 屹 亿 役 臆 逸 肄 疫
d2e0 亦 裔 意 毅 忆 义 益 溢 诣 议 谊 译 异 翼 翌 绎
d2f0 茵 荫 因 殷 音 阴 姻 吟 银 淫 寅 饮 尹 引 隐
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d3a0 印 英 樱 婴 鹰 应 缨 莹 萤 营 荧 蝇 迎 赢 盈
d3b0 影 颖 硬 映 哟 拥 佣 臃 痈 庸 雍 踊 蛹 咏 泳 涌
d3c0 永 恿 勇 用 幽 优 悠 忧 尤 由 邮 铀 犹 油 游 酉
d3d0 有 友 右 佑 釉 诱 又 幼 迂 淤 于 盂 榆 虞 愚 舆
d3e0 余 俞 逾 鱼 愉 渝 渔 隅 予 娱 雨 与 屿 禹 宇 语
d3f0 羽 玉 域 芋 郁 吁 遇 喻 峪 御 愈 欲 狱 育 誉
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d4a0 浴 寓 裕 预 豫 驭 鸳 渊 冤 元 垣 袁 原 援 辕
d4b0 园 员 圆 猿 源 缘 远 苑 愿 怨 院 曰 约 越 跃 钥
d4c0 岳 粤 月 悦 阅 耘 云 郧 匀 陨 允 运 蕴 酝 晕 韵
d4d0 孕 匝 砸 杂 栽 哉 灾 宰 载 再 在 咱 攒 暂 赞 赃
d4e0 脏 葬 遭 糟 凿 藻 枣 早 澡 蚤 躁 噪 造 皂 灶 燥
d4f0 责 择 则 泽 贼 怎 增 憎 曾 赠 扎 喳 渣 札 轧
- 1323 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d5a0 铡 闸 眨 栅 榨 咋 乍 炸 诈 摘 斋 宅 窄 债 寨
d5b0 瞻 毡 詹 粘 沾 盏 斩 辗 崭 展 蘸 栈 占 战 站 湛
d5c0 绽 樟 章 彰 漳 张 掌 涨 杖 丈 帐 账 仗 胀 瘴 障
d5d0 招 昭 找 沼 赵 照 罩 兆 肇 召 遮 折 哲 蛰 辙 者
d5e0 锗 蔗 这 浙 珍 斟 真 甄 砧 臻 贞 针 侦 枕 疹 诊
d5f0 震 振 镇 阵 蒸 挣 睁 征 狰 争 怔 整 拯 正 政
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d6a0 帧 症 郑 证 芝 枝 支 吱 蜘 知 肢 脂 汁 之 织
d6b0 职 直 植 殖 执 值 侄 址 指 止 趾 只 旨 纸 志 挚
d6c0 掷 至 致 置 帜 峙 制 智 秩 稚 质 炙 痔 滞 治 窒
d6d0 中 盅 忠 钟 衷 终 种 肿 重 仲 众 舟 周 州 洲 诌
d6e0 粥 轴 肘 帚 咒 皱 宙 昼 骤 珠 株 蛛 朱 猪 诸 诛
d6f0 逐 竹 烛 煮 拄 瞩 嘱 主 著 柱 助 蛀 贮 铸 筑
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d7a0 住 注 祝 驻 抓 爪 拽 专 砖 转 撰 赚 篆 桩 庄
d7b0 装 妆 撞 壮 状 椎 锥 追 赘 坠 缀 谆 准 捉 拙 卓
d7c0 桌 琢 茁 酌 啄 着 灼 浊 兹 咨 资 姿 滋 淄 孜 紫
d7d0 仔 籽 滓 子 自 渍 字 鬃 棕 踪 宗 综 总 纵 邹 走
d7e0 奏 揍 租 足 卒 族 祖 诅 阻 组 钻 纂 嘴 醉 最 罪
d7f0 尊 遵 昨 左 佐 柞 做 作 坐 座
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d8a0 亍 丌 兀 丐 廿 卅 丕 亘 丞 鬲 孬 噩 丨 禺 丿
d8b0 匕 乇 夭 爻 卮 氐 囟 胤 馗 毓 睾 鼗 丶 亟 鼐 乜
d8c0 乩 亓 芈 孛 啬 嘏 仄 厍 厝 厣 厥 厮 靥 赝 匚 叵
d8d0 匦 匮 匾 赜 卦 卣 刂 刈 刎 刭 刳 刿 剀 剌 剞 剡
d8e0 剜 蒯 剽 劂 劁 劐 劓 冂 罔 亻 仃 仉 仂 仨 仡 仫
d8f0 仞 伛 仳 伢 佤 仵 伥 伧 伉 伫 佞 佧 攸 佚 佝
- 1324 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
d9a0 佟 佗 伲 伽 佶 佴 侑 侉 侃 侏 佾 佻 侪 佼 侬
d9b0 侔 俦 俨 俪 俅 俚 俣 俜 俑 俟 俸 倩 偌 俳 倬 倏
d9c0 倮 倭 俾 倜 倌 倥 倨 偾 偃 偕 偈 偎 偬 偻 傥 傧
d9d0 傩 傺 僖 儆 僭 僬 僦 僮 儇 儋 仝 氽 佘 佥 俎 龠
d9e0 汆 籴 兮 巽 黉 馘 冁 夔 勹 匍 訇 匐 凫 夙 兕 亠
d9f0 兖 亳 衮 袤 亵 脔 裒 禀 嬴 蠃 羸 冫 冱 冽 冼
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
daa0 凇 冖 冢 冥 讠 讦 讧 讪 讴 讵 讷 诂 诃 诋 诏
dab0 诎 诒 诓 诔 诖 诘 诙 诜 诟 诠 诤 诨 诩 诮 诰 诳
dac0 诶 诹 诼 诿 谀 谂 谄 谇 谌 谏 谑 谒 谔 谕 谖 谙
dad0 谛 谘 谝 谟 谠 谡 谥 谧 谪 谫 谮 谯 谲 谳 谵 谶
dae0 卩 卺 阝 阢 阡 阱 阪 阽 阼 陂 陉 陔 陟 陧 陬 陲
daf0 陴 隈 隍 隗 隰 邗 邛 邝 邙 邬 邡 邴 邳 邶 邺
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
dba0 邸 邰 郏 郅 邾 郐 郄 郇 郓 郦 郢 郜 郗 郛 郫
dbb0 郯 郾 鄄 鄢 鄞 鄣 鄱 鄯 鄹 酃 酆 刍 奂 劢 劬 劭
dbc0 劾 哿 勐 勖 勰 叟 燮 矍 廴 凵 凼 鬯 厶 弁 畚 巯
dbd0 坌 垩 垡 塾 墼 壅 壑 圩 圬 圪 圳 圹 圮 圯 坜 圻
dbe0 坂 坩 垅 坫 垆 坼 坻 坨 坭 坶 坳 垭 垤 垌 垲 埏
dbf0 垧 垴 垓 垠 埕 埘 埚 埙 埒 垸 埴 埯 埸 埤 埝
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
dca0 堋 堍 埽 埭 堀 堞 堙 塄 堠 塥 塬 墁 墉 墚 墀
dcb0 馨 鼙 懿 艹 艽 艿 芏 芊 芨 芄 芎 芑 芗 芙 芫 芸
dcc0 芾 芰 苈 苊 苣 芘 芷 芮 苋 苌 苁 芩 芴 芡 芪 芟
dcd0 苄 苎 芤 苡 茉 苷 苤 茏 茇 苜 苴 苒 苘 茌 苻 苓
dce0 茑 茚 茆 茔 茕 苠 苕 茜 荑 荛 荜 茈 莒 茼 茴 茱
dcf0 莛 荞 茯 荏 荇 荃 荟 荀 茗 荠 茭 茺 茳 荦 荥
- 1325 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
dda0 荨 茛 荩 荬 荪 荭 荮 莰 荸 莳 莴 莠 莪 莓 莜
ddb0 莅 荼 莶 莩 荽 莸 荻 莘 莞 莨 莺 莼 菁 萁 菥 菘
ddc0 堇 萘 萋 菝 菽 菖 萜 萸 萑 萆 菔 菟 萏 萃 菸 菹
ddd0 菪 菅 菀 萦 菰 菡 葜 葑 葚 葙 葳 蒇 蒈 葺 蒉 葸
dde0 萼 葆 葩 葶 蒌 蒎 萱 葭 蓁 蓍 蓐 蓦 蒽 蓓 蓊 蒿
ddf0 蒺 蓠 蒡 蒹 蒴 蒗 蓥 蓣 蔌 甍 蔸 蓰 蔹 蔟 蔺
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
dea0 蕖 蔻 蓿 蓼 蕙 蕈 蕨 蕤 蕞 蕺 瞢 蕃 蕲 蕻 薤
deb0 薨 薇 薏 蕹 薮 薜 薅 薹 薷 薰 藓 藁 藜 藿 蘧 蘅
dec0 蘩 蘖 蘼 廾 弈 夼 奁 耷 奕 奚 奘 匏 尢 尥 尬 尴
ded0 扌 扪 抟 抻 拊 拚 拗 拮 挢 拶 挹 捋 捃 掭 揶 捱
dee0 捺 掎 掴 捭 掬 掊 捩 掮 掼 揲 揸 揠 揿 揄 揞 揎
def0 摒 揆 掾 摅 摁 搋 搛 搠 搌 搦 搡 摞 撄 摭 撖
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
dfa0 摺 撷 撸 撙 撺 擀 擐 擗 擤 擢 攉 攥 攮 弋 忒
dfb0 甙 弑 卟 叱 叽 叩 叨 叻 吒 吖 吆 呋 呒 呓 呔 呖
dfc0 呃 吡 呗 呙 吣 吲 咂 咔 呷 呱 呤 咚 咛 咄 呶 呦
dfd0 咝 哐 咭 哂 咴 哒 咧 咦 哓 哔 呲 咣 哕 咻 咿 哌
dfe0 哙 哚 哜 咩 咪 咤 哝 哏 哞 唛 哧 唠 哽 唔 哳 唢
dff0 唣 唏 唑 唧 唪 啧 喏 喵 啉 啭 啁 啕 唿 啐 唼
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e0a0 唷 啖 啵 啶 啷 唳 唰 啜 喋 嗒 喃 喱 喹 喈 喁
e0b0 喟 啾 嗖 喑 啻 嗟 喽 喾 喔 喙 嗪 嗷 嗉 嘟 嗑 嗫
e0c0 嗬 嗔 嗦 嗝 嗄 嗯 嗥 嗲 嗳 嗌 嗍 嗨 嗵 嗤 辔 嘞
e0d0 嘈 嘌 嘁 嘤 嘣 嗾 嘀 嘧 嘭 噘 嘹 噗 嘬 噍 噢 噙
e0e0 噜 噌 噔 嚆 噤 噱 噫 噻 噼 嚅 嚓 嚯 囔 囗 囝 囡
e0f0 囵 囫 囹 囿 圄 圊 圉 圜 帏 帙 帔 帑 帱 帻 帼
- 1326 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e1a0 帷 幄 幔 幛 幞 幡 岌 屺 岍 岐 岖 岈 岘 岙 岑
e1b0 岚 岜 岵 岢 岽 岬 岫 岱 岣 峁 岷 峄 峒 峤 峋 峥
e1c0 崂 崃 崧 崦 崮 崤 崞 崆 崛 嵘 崾 崴 崽 嵬 嵛 嵯
e1d0 嵝 嵫 嵋 嵊 嵩 嵴 嶂 嶙 嶝 豳 嶷 巅 彳 彷 徂 徇
e1e0 徉 後 徕 徙 徜 徨 徭 徵 徼 衢 彡 犭 犰 犴 犷 犸
e1f0 狃 狁 狎 狍 狒 狨 狯 狩 狲 狴 狷 猁 狳 猃 狺
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e2a0 狻 猗 猓 猡 猊 猞 猝 猕 猢 猹 猥 猬 猸 猱 獐
e2b0 獍 獗 獠 獬 獯 獾 舛 夥 飧 夤 夂 饣 饧 饨 饩 饪
e2c0 饫 饬 饴 饷 饽 馀 馄 馇 馊 馍 馐 馑 馓 馔 馕 庀
e2d0 庑 庋 庖 庥 庠 庹 庵 庾 庳 赓 廒 廑 廛 廨 廪 膺
e2e0 忄 忉 忖 忏 怃 忮 怄 忡 忤 忾 怅 怆 忪 忭 忸 怙
e2f0 怵 怦 怛 怏 怍 怩 怫 怊 怿 怡 恸 恹 恻 恺 恂
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e3a0 恪 恽 悖 悚 悭 悝 悃 悒 悌 悛 惬 悻 悱 惝 惘
e3b0 惆 惚 悴 愠 愦 愕 愣 惴 愀 愎 愫 慊 慵 憬 憔 憧
e3c0 憷 懔 懵 忝 隳 闩 闫 闱 闳 闵 闶 闼 闾 阃 阄 阆
e3d0 阈 阊 阋 阌 阍 阏 阒 阕 阖 阗 阙 阚 丬 爿 戕 氵
e3e0 汔 汜 汊 沣 沅 沐 沔 沌 汨 汩 汴 汶 沆 沩 泐 泔
e3f0 沭 泷 泸 泱 泗 沲 泠 泖 泺 泫 泮 沱 泓 泯 泾
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e4a0 洹 洧 洌 浃 浈 洇 洄 洙 洎 洫 浍 洮 洵 洚 浏
e4b0 浒 浔 洳 涑 浯 涞 涠 浞 涓 涔 浜 浠 浼 浣 渚 淇
e4c0 淅 淞 渎 涿 淠 渑 淦 淝 淙 渖 涫 渌 涮 渫 湮 湎
e4d0 湫 溲 湟 溆 湓 湔 渲 渥 湄 滟 溱 溘 滠 漭 滢 溥
e4e0 溧 溽 溻 溷 滗 溴 滏 溏 滂 溟 潢 潆 潇 漤 漕 滹
e4f0 漯 漶 潋 潴 漪 漉 漩 澉 澍 澌 潸 潲 潼 潺 濑
- 1327 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e5a0 濉 澧 澹 澶 濂 濡 濮 濞 濠 濯 瀚 瀣 瀛 瀹 瀵
e5b0 灏 灞 宀 宄 宕 宓 宥 宸 甯 骞 搴 寤 寮 褰 寰 蹇
e5c0 謇 辶 迓 迕 迥 迮 迤 迩 迦 迳 迨 逅 逄 逋 逦 逑
e5d0 逍 逖 逡 逵 逶 逭 逯 遄 遑 遒 遐 遨 遘 遢 遛 暹
e5e0 遴 遽 邂 邈 邃 邋 彐 彗 彖 彘 尻 咫 屐 屙 孱 屣
e5f0 屦 羼 弪 弩 弭 艴 弼 鬻 屮 妁 妃 妍 妩 妪 妣
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e6a0 妗 姊 妫 妞 妤 姒 妲 妯 姗 妾 娅 娆 姝 娈 姣
e6b0 姘 姹 娌 娉 娲 娴 娑 娣 娓 婀 婧 婊 婕 娼 婢 婵
e6c0 胬 媪 媛 婷 婺 媾 嫫 媲 嫒 嫔 媸 嫠 嫣 嫱 嫖 嫦
e6d0 嫘 嫜 嬉 嬗 嬖 嬲 嬷 孀 尕 尜 孚 孥 孳 孑 孓 孢
e6e0 驵 驷 驸 驺 驿 驽 骀 骁 骅 骈 骊 骐 骒 骓 骖 骘
e6f0 骛 骜 骝 骟 骠 骢 骣 骥 骧 纟 纡 纣 纥 纨 纩
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e7a0 纭 纰 纾 绀 绁 绂 绉 绋 绌 绐 绔 绗 绛 绠 绡
e7b0 绨 绫 绮 绯 绱 绲 缍 绶 绺 绻 绾 缁 缂 缃 缇 缈
e7c0 缋 缌 缏 缑 缒 缗 缙 缜 缛 缟 缡 缢 缣 缤 缥 缦
e7d0 缧 缪 缫 缬 缭 缯 缰 缱 缲 缳 缵 幺 畿 巛 甾 邕
e7e0 玎 玑 玮 玢 玟 珏 珂 珑 玷 玳 珀 珉 珈 珥 珙 顼
e7f0 琊 珩 珧 珞 玺 珲 琏 琪 瑛 琦 琥 琨 琰 琮 琬
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e8a0 琛 琚 瑁 瑜 瑗 瑕 瑙 瑷 瑭 瑾 璜 璎 璀 璁 璇
e8b0 璋 璞 璨 璩 璐 璧 瓒 璺 韪 韫 韬 杌 杓 杞 杈 杩
e8c0 枥 枇 杪 杳 枘 枧 杵 枨 枞 枭 枋 杷 杼 柰 栉 柘
e8d0 栊 柩 枰 栌 柙 枵 柚 枳 柝 栀 柃 枸 柢 栎 柁 柽
e8e0 栲 栳 桠 桡 桎 桢 桄 桤 梃 栝 桕 桦 桁 桧 桀 栾
e8f0 桊 桉 栩 梵 梏 桴 桷 梓 桫 棂 楮 棼 椟 椠 棹
- 1328 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
e9a0 椤 棰 椋 椁 楗 棣 椐 楱 椹 楠 楂 楝 榄 楫 榀
e9b0 榘 楸 椴 槌 榇 榈 槎 榉 楦 楣 楹 榛 榧 榻 榫 榭
e9c0 槔 榱 槁 槊 槟 榕 槠 榍 槿 樯 槭 樗 樘 橥 槲 橄
e9d0 樾 檠 橐 橛 樵 檎 橹 樽 樨 橘 橼 檑 檐 檩 檗 檫
e9e0 猷 獒 殁 殂 殇 殄 殒 殓 殍 殚 殛 殡 殪 轫 轭 轱
e9f0 轲 轳 轵 轶 轸 轷 轹 轺 轼 轾 辁 辂 辄 辇 辋
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
eaa0 辍 辎 辏 辘 辚 軎 戋 戗 戛 戟 戢 戡 戥 戤 戬
eab0 臧 瓯 瓴 瓿 甏 甑 甓 攴 旮 旯 旰 昊 昙 杲 昃 昕
eac0 昀 炅 曷 昝 昴 昱 昶 昵 耆 晟 晔 晁 晏 晖 晡 晗
ead0 晷 暄 暌 暧 暝 暾 曛 曜 曦 曩 贲 贳 贶 贻 贽 赀
eae0 赅 赆 赈 赉 赇 赍 赕 赙 觇 觊 觋 觌 觎 觏 觐 觑
eaf0 牮 犟 牝 牦 牯 牾 牿 犄 犋 犍 犏 犒 挈 挲 掰
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
eba0 搿 擘 耄 毪 毳 毽 毵 毹 氅 氇 氆 氍 氕 氘 氙
ebb0 氚 氡 氩 氤 氪 氲 攵 敕 敫 牍 牒 牖 爰 虢 刖 肟
ebc0 肜 肓 肼 朊 肽 肱 肫 肭 肴 肷 胧 胨 胩 胪 胛 胂
ebd0 胄 胙 胍 胗 朐 胝 胫 胱 胴 胭 脍 脎 胲 胼 朕 脒
ebe0 豚 脶 脞 脬 脘 脲 腈 腌 腓 腴 腙 腚 腱 腠 腩 腼
ebf0 腽 腭 腧 塍 媵 膈 膂 膑 滕 膣 膪 臌 朦 臊 膻
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
eca0 臁 膦 欤 欷 欹 歃 歆 歙 飑 飒 飓 飕 飙 飚 殳
ecb0 彀 毂 觳 斐 齑 斓 於 旆 旄 旃 旌 旎 旒 旖 炀 炜
ecc0 炖 炝 炻 烀 炷 炫 炱 烨 烊 焐 焓 焖 焯 焱 煳 煜
ecd0 煨 煅 煲 煊 煸 煺 熘 熳 熵 熨 熠 燠 燔 燧 燹 爝
ece0 爨 灬 焘 煦 熹 戾 戽 扃 扈 扉 礻 祀 祆 祉 祛 祜
ecf0 祓 祚 祢 祗 祠 祯 祧 祺 禅 禊 禚 禧 禳 忑 忐
- 1329 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
eda0 怼 恝 恚 恧 恁 恙 恣 悫 愆 愍 慝 憩 憝 懋 懑
edb0 戆 肀 聿 沓 泶 淼 矶 矸 砀 砉 砗 砘 砑 斫 砭 砜
edc0 砝 砹 砺 砻 砟 砼 砥 砬 砣 砩 硎 硭 硖 硗 砦 硐
edd0 硇 硌 硪 碛 碓 碚 碇 碜 碡 碣 碲 碹 碥 磔 磙 磉
ede0 磬 磲 礅 磴 礓 礤 礞 礴 龛 黹 黻 黼 盱 眄 眍 盹
edf0 眇 眈 眚 眢 眙 眭 眦 眵 眸 睐 睑 睇 睃 睚 睨
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
eea0 睢 睥 睿 瞍 睽 瞀 瞌 瞑 瞟 瞠 瞰 瞵 瞽 町 畀
eeb0 畎 畋 畈 畛 畲 畹 疃 罘 罡 罟 詈 罨 罴 罱 罹 羁
eec0 罾 盍 盥 蠲 钅 钆 钇 钋 钊 钌 钍 钏 钐 钔 钗 钕
eed0 钚 钛 钜 钣 钤 钫 钪 钭 钬 钯 钰 钲 钴 钶 钷 钸
eee0 钹 钺 钼 钽 钿 铄 铈 铉 铊 铋 铌 铍 铎 铐 铑 铒
eef0 铕 铖 铗 铙 铘 铛 铞 铟 铠 铢 铤 铥 铧 铨 铪
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
efa0 铩 铫 铮 铯 铳 铴 铵 铷 铹 铼 铽 铿 锃 锂 锆
efb0 锇 锉 锊 锍 锎 锏 锒 锓 锔 锕 锖 锘 锛 锝 锞 锟
efc0 锢 锪 锫 锩 锬 锱 锲 锴 锶 锷 锸 锼 锾 锿 镂 锵
efd0 镄 镅 镆 镉 镌 镎 镏 镒 镓 镔 镖 镗 镘 镙 镛 镞
efe0 镟 镝 镡 镢 镤 镥 镦 镧 镨 镩 镪 镫 镬 镯 镱 镲
eff0 镳 锺 矧 矬 雉 秕 秭 秣 秫 稆 嵇 稃 稂 稞 稔
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f0a0 稹 稷 穑 黏 馥 穰 皈 皎 皓 皙 皤 瓞 瓠 甬 鸠
f0b0 鸢 鸨 鸩 鸪 鸫 鸬 鸲 鸱 鸶 鸸 鸷 鸹 鸺 鸾 鹁 鹂
f0c0 鹄 鹆 鹇 鹈 鹉 鹋 鹌 鹎 鹑 鹕 鹗 鹚 鹛 鹜 鹞 鹣
f0d0 鹦 鹧 鹨 鹩 鹪 鹫 鹬 鹱 鹭 鹳 疒 疔 疖 疠 疝 疬
f0e0 疣 疳 疴 疸 痄 疱 疰 痃 痂 痖 痍 痣 痨 痦 痤 痫
f0f0 痧 瘃 痱 痼 痿 瘐 瘀 瘅 瘌 瘗 瘊 瘥 瘘 瘕 瘙
- 1330 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f1a0 瘛 瘼 瘢 瘠 癀 瘭 瘰 瘿 瘵 癃 瘾 瘳 癍 癞 癔
f1b0 癜 癖 癫 癯 翊 竦 穸 穹 窀 窆 窈 窕 窦 窠 窬 窨
f1c0 窭 窳 衤 衩 衲 衽 衿 袂 袢 裆 袷 袼 裉 裢 裎 裣
f1d0 裥 裱 褚 裼 裨 裾 裰 褡 褙 褓 褛 褊 褴 褫 褶 襁
f1e0 襦 襻 疋 胥 皲 皴 矜 耒 耔 耖 耜 耠 耢 耥 耦 耧
f1f0 耩 耨 耱 耋 耵 聃 聆 聍 聒 聩 聱 覃 顸 颀 颃
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f2a0 颉 颌 颍 颏 颔 颚 颛 颞 颟 颡 颢 颥 颦 虍 虔
f2b0 虬 虮 虿 虺 虼 虻 蚨 蚍 蚋 蚬 蚝 蚧 蚣 蚪 蚓 蚩
f2c0 蚶 蛄 蚵 蛎 蚰 蚺 蚱 蚯 蛉 蛏 蚴 蛩 蛱 蛲 蛭 蛳
f2d0 蛐 蜓 蛞 蛴 蛟 蛘 蛑 蜃 蜇 蛸 蜈 蜊 蜍 蜉 蜣 蜻
f2e0 蜞 蜥 蜮 蜚 蜾 蝈 蜴 蜱 蜩 蜷 蜿 螂 蜢 蝽 蝾 蝻
f2f0 蝠 蝰 蝌 蝮 螋 蝓 蝣 蝼 蝤 蝙 蝥 螓 螯 螨 蟒
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f3a0 蟆 螈 螅 螭 螗 螃 螫 蟥 螬 螵 螳 蟋 蟓 螽 蟑
f3b0 蟀 蟊 蟛 蟪 蟠 蟮 蠖 蠓 蟾 蠊 蠛 蠡 蠹 蠼 缶 罂
f3c0 罄 罅 舐 竺 竽 笈 笃 笄 笕 笊 笫 笏 筇 笸 笪 笙
f3d0 笮 笱 笠 笥 笤 笳 笾 笞 筘 筚 筅 筵 筌 筝 筠 筮
f3e0 筻 筢 筲 筱 箐 箦 箧 箸 箬 箝 箨 箅 箪 箜 箢 箫
f3f0 箴 篑 篁 篌 篝 篚 篥 篦 篪 簌 篾 篼 簏 簖 簋
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f4a0 簟 簪 簦 簸 籁 籀 臾 舁 舂 舄 臬 衄 舡 舢 舣
f4b0 舭 舯 舨 舫 舸 舻 舳 舴 舾 艄 艉 艋 艏 艚 艟 艨
f4c0 衾 袅 袈 裘 裟 襞 羝 羟 羧 羯 羰 羲 籼 敉 粑 粝
f4d0 粜 粞 粢 粲 粼 粽 糁 糇 糌 糍 糈 糅 糗 糨 艮 暨
f4e0 羿 翎 翕 翥 翡 翦 翩 翮 翳 糸 絷 綦 綮 繇 纛 麸
f4f0 麴 赳 趄 趔 趑 趱 赧 赭 豇 豉 酊 酐 酎 酏 酤
- 1331 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f5a0 酢 酡 酰 酩 酯 酽 酾 酲 酴 酹 醌 醅 醐 醍 醑
f5b0 醢 醣 醪 醭 醮 醯 醵 醴 醺 豕 鹾 趸 跫 踅 蹙 蹩
f5c0 趵 趿 趼 趺 跄 跖 跗 跚 跞 跎 跏 跛 跆 跬 跷 跸
f5d0 跣 跹 跻 跤 踉 跽 踔 踝 踟 踬 踮 踣 踯 踺 蹀 踹
f5e0 踵 踽 踱 蹉 蹁 蹂 蹑 蹒 蹊 蹰 蹶 蹼 蹯 蹴 躅 躏
f5f0 躔 躐 躜 躞 豸 貂 貊 貅 貘 貔 斛 觖 觞 觚 觜
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f6a0 觥 觫 觯 訾 謦 靓 雩 雳 雯 霆 霁 霈 霏 霎 霪
f6b0 霭 霰 霾 龀 龃 龅 龆 龇 龈 龉 龊 龌 黾 鼋 鼍 隹
f6c0 隼 隽 雎 雒 瞿 雠 銎 銮 鋈 錾 鍪 鏊 鎏 鐾 鑫 鱿
f6d0 鲂 鲅 鲆 鲇 鲈 稣 鲋 鲎 鲐 鲑 鲒 鲔 鲕 鲚 鲛 鲞
f6e0 鲟 鲠 鲡 鲢 鲣 鲥 鲦 鲧 鲨 鲩 鲫 鲭 鲮 鲰 鲱 鲲
f6f0 鲳 鲴 鲵 鲶 鲷 鲺 鲻 鲼 鲽 鳄 鳅 鳆 鳇 鳊 鳋
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f7a0 鳌 鳍 鳎 鳏 鳐 鳓 鳔 鳕 鳗 鳘 鳙 鳜 鳝 鳟 鳢
f7b0 靼 鞅 鞑 鞒 鞔 鞯 鞫 鞣 鞲 鞴 骱 骰 骷 鹘 骶 骺
f7c0 骼 髁 髀 髅 髂 髋 髌 髑 魅 魃 魇 魉 魈 魍 魑 飨
f7d0 餍 餮 饕 饔 髟 髡 髦 髯 髫 髻 髭 髹 鬈 鬏 鬓 鬟
f7e0 鬣 麽 麾 縻 麂 麇 麈 麋 麒 鏖 麝 麟 黛 黜 黝 黠
f7f0 黟 黢 黩 黧 黥 黪 黯 鼢 鼬 鼯 鼹 鼷 鼽 鼾 齄
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f8a0
f8b0
f8c0
f8d0
f8e0
f8f0
- 1332 -
D.Simplified Chinese Character
B-64303EN-3/01 APPENDIX Code List
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
f9a0
f9b0
f9c0
f9d0
f9e0
f9f0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
faa0
fab0
fac0
fad0
fae0
faf0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
fba0
fbb0
fbc0
fbd0
fbe0
fbf0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
fca0
fcb0
fcc0
fcd0
fce0
fcf0
- 1333 -
D.Simplified Chinese Character
Code List APPENDIX B-64303EN-3/01
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
fda0
fdb0
fdc0
fdd0
fde0
fdf0
code +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
fea0
feb0
fec0
fed0
fee0
fef0
- 1334 -
B-64303EN-3/01 APPENDIX E.Russian (Cyrillic) Character Code List
А 0xC0
Б 0xC1
В 0xC2
Г 0xC3
Д 0xC4
Е 0xC5
Ё 0xA8
Ж 0xC6
З 0xC7
И 0xC8
Й 0xC9
К 0xCA
Л 0xCB
М 0xCC
Н 0xCD
О 0xCE
П 0xCF
Р 0xD0
С 0xD1
Т 0xD2
У 0xD3
Ф 0xD4
Х 0xD5
Ц 0xD6
Ч 0xD7
Ш 0xD8
Щ 0xD9
Ъ 0xDA
Ы 0xDB
Ь 0xDC
Э 0xDD
Ю 0xDE
Я 0xDF
- 1335 -
F.Turkish Character Code List APPENDIX B-64303EN-3/01
- 1336 -
B-64303EN-3/01 INDEX
INDEX
Display control escape sequences ...............................1089
<Number>
Display language switching ........................................1167
2-byte characters ......................................................... 1094
Display of Simplified Chinese messages.....................1173
<A> Display/acquisition of Russian messages ....................1181
Additional Information on C Compiler Installation .... 1256 Display/acquisition of Turkish messages ....................1192
ANSI C standard library............................................. 19,69 Displayable characters ................................................1093
ANSI C Standard library ................................................. 38 Dynamic language switching ......................................1167
Application of C Language Executor to machines...... 1245
<E>
Application program .........................................................9
Eight-level data protection ..........................................1202
Application program development environment ............. 14
Example of use............................................................1176
Application programming ........................................... 1153
Examples of use ..........................................................1185
Available functions for the window task..................... 1132
Explanation ...1167,1173,1182,1193,1197,1203,1217,1232
<C>
<F>
C language data file series and edition display ........... 1231
FANUC character code list (for 10.4-inch color LCD)1302
C Language Executor........................................................7
FANUC character code list (for 8.4-inch color LCD) .1293
C Language Executor Function................................... 1108
FCA Library ................................................................1027
C Language Library ..........................................................8
Feature...............................................................................4
C Language Library function list .................................... 19
File Operation Library...................................................968
Character Code List..................................................... 1281
File system ..................................................................1115
Checking operation restart after program editing........ 1197
F-ROM Library ...........................................................1061
CNC/PMC window library.................................. 24,50,306
FTP transfer.................................................................1216
cnc_chglang function reference .................................. 1168
Function overview..................................... 1173,1182,1193
Composition of development system .............................. 15
Function reference..................................... 1065,1141,1154
Conditions for displaying the series and editions of user
Function Reference
data files on the system configuration screen.............. 1232
.............74,212,278,314,828,865,970,983,1012,1032,1080
Conforming CNC screen display function .................. 1134
Function references ................................... 1198,1204,1218
CRT display control characters ................................... 1089
Function References........................................................67
CRT operation library ................................................... 861
Customization procedure............................................. 1265 <G>
Graphic library .................................................... 22,47,208
<D>
Dat2mem utility manual.............................................. 1123 <H>
Data access between tasks........................................... 1113 Half-size character code list
Data ID list .................................................................. 1214 (for 10.4-inch color LCD) ........................................... 1288
DEFINITION OF WARNING, CAUTION, AND Half-size character code list
NOTE............................................................................. s-1 (for 8.4-inch color LCD) ............................................. 1282
Describing 2-byte characters in source-codes ................. 65 High-Level Task..........................................................1146
Detailed status of communication error ...................... 1229 High-Level task execution management data..............1156
Development procedure .................................................. 17 How do application program run on each equipment..1135
Diagnosis data ............................................................. 1172 How to make application program ......................... 62,1133
Difference of each task class....................................... 1111
<I>
Display code for single byte characters....................... 1103
Installing the C compiler .............................................1257
i-1
INDEX B-64303EN-3/01
Installing the C Language Library .............................. 1263 Overview of library ..................................................... 1077
Installing the linker ..................................................... 1263
<P>
<J> Parameter setting on CNC...........................................1119
Japanese(Multi-byte character) functions........................ 61 Parameters ................................................................... 1171
Power-on procedure ....................................................1118
<K>
PREFACE ......................................................................p-1
Kanji character code.................................................... 1107
Programming Technique .............................................1241
Key code table............................................................... 841
Key operation at power on .......................................... 1118 <R>
Keycode ...................................................................... 1086 Reading extension MDI keys ........................................843
Keycode of special keys on MDI panel....................... 1087 Reference items...........................................................1230
Keycode, screen control code...................................... 1086 Remarks ..........................................................................66
Keycode, screen control code and Displayable Restrictions..................................................................1240
characters .................................................................... 1085 Restrictions for Use with MANUAL GUIDE i ...........1161
Restrictions for Use with TURN MATE i...................1166
<L>
Restrictions on specification .......................................1137
Library outline .............................. 824,975,996,1027,1061
Return values of data window functions .......................313
List of function.............................................................. 982
Russian (Cyrillic) Character Code List .......................1335
List of functions .......................................................... 1064
Russian display/get function .......................................1184
List of Functions ........................................... 37,1031,1080
Russian mode setting function (crt_setmode function)1183
Lists of C Language Executor original graphic
functions........................................................................ 277 <S>
Lists of Functions................ 69,204,306,827,863,969,1011 Screen display after power-on............................ 1159,1164
Lists of MS-C compatible functions.............................. 210 Serial Library ................................................................975
Series and edition information file format...................1233
<M>
Simplified Chinese Character Code List .....................1310
Making application program ....................................... 1139
Simplified Chinese display function ...........................1175
MDI operation library ................................................... 824
Simplified Chinese mode setting function
Method of specifying a series and edition information
(crt_setmode function) ................................................ 1174
file ............................................................................... 1236
Single byte characters .................................................1093
MS-C extended C standard library...................... 21,42,204
Special files .....................................................................64
MS-C graphic function compatibility list...................... 275
Specification................................................................1147
Multitasking ................................................................ 1109
Specification of the memory card on the personal
<N> computer......................................................................1143
Notes ........................................................................... 1133 Supported display device ..............................................861
Notes on application program creation........................ 1144 System components...........................................................6
System configuration screen display ...........................1238
<O>
Obtaining and installing other tools ............................ 1264 <T>
Other libraries ............................................................ 30,56 Task classes.................................................................1109
Others.......................................................................... 1145 Task execution rule .....................................................1150
Outline of processing .................................................. 1197 Task Management .......................................................1114
Overview of High-Level Task..................................... 1146 Task management library ..............................................996
Overview of installing the C Language Library and Task switching ............................................................1112
creating an application program ...................................... 63
i-2
B-64303EN-3/01 INDEX
<U>
Usable languages......................................................... 1167
Usage of graphic functions............................................ 208
Usage of the window task ........................................... 1130
Use with MANUAL GUIDE i..................................... 1159
Use with TURN MATE i ............................................ 1164
User data file that enables series and edition
information to be displayed......................................... 1237
Using compiler libraries .................................................. 65
Using Memory Card...................................................... 968
Using the drive on the personal computer ................... 1143
<V>
Variables of type 'int' ...................................................... 64
Various techniques ...................................................... 1242
<W>
Wind River Compiler C/C++ installation ....................... 63
Window task ............................................................... 1129
Window task's execution............................................. 1130
i-3
Revision Record
FANUC Series 0i-MODEL D C Language Executor PROGRAMMIG MANUAL (B-64303EN-3)
01 Jun., 2008