CNC_DOWNLOAD | PROGRAM

When the data processing on the CNC side is delayed and the data cannot be transferred,
this function waits until it can be transferred.
If an application cannot wait, use the cnc_cdownload function.

The procedure of downloading is as follows.

For transferring the data, there are 4 buffers of 256 bytes.
One buffer is used at each cnc_download calling without any relationto the data size.
Therefore, the maximum size which can be transferred by one calling is 256 bytes.

Because importance is attached to the speed of data transfer to the CNC,
in general, return of errors(EW_DATA, EW_OVRFLOW, etc.) may be delayed.
Namely, an error status may refrect the result caused by the previously executed
cnc_download callings.
And the error status for some cnc_download callings just before the finish of
downloading is returned by "End of downloading NC program".

NC program format

NC program to be registered to CNC is a string composed of ASCII characters as the following format.

LF Oxxxx LF Block1 LF Block2 LF ... LF Mxx LF %

where,

LF

0x0A ('\n': EOB)

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 the first 'LF' 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 ;
%

send a following string using cnc_download function.

"\nO1234\nG1F0.3W10.\nM30\n%"

The string data can be sent by multiple cnc_download callings.
For above example, the program can be sent block by block like this.