Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 354 -
For example, to execute commands such as
M3 S2000 ;
T14 ;
G0 X10. ;
G0 Z-5. ;
M30 ;
send a following string using cnc_dnc function.
cnc_dnc( "\nM3S2000\nT14\nG0X10.\nG0Z-5.\nM30\n%", 32 ) ;
The string data can be sent by multiple cnc_dnc functions.
For above example, the commands can be sent block by block like this.
cnc_dnc( "\n", 1 ) ;
cnc_dnc( "M3S2000\n", 8 ) ;
cnc_dnc( "T14\n", 4 ) ;
cnc_dnc( "G0X10.\n", 7 ) ;
cnc_dnc( "G0Z-5.\n", 7 ) ;
cnc_dnc( "M30\n", 4 ) ;
cnc_dnc( "%", 1 ) ;
There is one buffer (256 bytes) between CNC and C library. It is used
as a ring.
Buffer size = 256 bytes
+--------------------------------------------------+
+-->| 1st output | 2nd output | ... | | --+
| +--------------------------------------------------+ |
| |
+----------------------------------------------------------+
When any data can not be output because operating process has not been
completed (i.e. the buffer is full), the C library waits until it can
be output. ERROR 5 may be returned late because NC program is sent to
CNC via buffers. That is, the return code of an output process may be
one of it several times before.
Moreover, return codes of several output before the last one may
be returned by "Stop output NC program to be executed(cnc_dncend)".
DNC operation executes each NC command just block by block. Therefore
it can't executes the NC command, whose execution is not started while
reading of multiple blocks is not completed such as multiple
repetitive cycles for turning, or which refers to the other block such
as branch command of macros. For executing the block that multiple
blocks are required for its execution like above, the following method
is possible.
(1) Program the multiple-block NC command using macro program format.
(2) Store the above program in the tape memory of CNC unit.
(It is possible to store compiled code of program in ROM using
Macro Compiler.)
(3) Execute macro-call command (such as M98) to execute registerd
macro program in DNC operation. (It is possible to call
registered macro program in the memory for DNC operation.)