
Format of input data
NC program which is read from CNC is a string composed of ASCII
characters as following format.
% LF Oxxxx LF Block1 LF Block2 LF ... LF Mxx LF %
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 ;
%
you will get the following strings.
In case of fully large buffer.
1st time "%¥nO1234¥nG1F0.3W10.¥nM30¥n%" (24 chars)
2nd and after "%" (1 char)
And in case that the buffer size is less than 24 bytes, you will get
the following strings.
In case that the buffer size is 10 bytes.
1st time "%¥nO1234¥nG1" (10 characters)
2nd time "F0.3W10.¥nM" (10 characters)
3rd time "30¥n%" (4 characters)
4th and after "%" (1 character)