6.5.1 Create a File for Data Entry


Format: 

M60


Within the PLC's M code, a file name must be specified in "plc.ncCommand.data.x", and this name must be rarely used because if the file of this name exists, it will not go through any confirmation procedure and will be replaced. In the following example, "0000DATA" will be used as the filename:

case 60: // to create a data file

if( sts.state0.bRun && !sts.state0.bDnc && !sts.state0.bMdi && !sts.state0.bManual ) {

 if( (plc.ncCommand.flag&0xff) == NC_COMMAND_CREATE_DATA_FILE && plc.ncCommand.finish ) {

  plc.ncCommand.flag = 0;

  plc.mCode.finish = 1;

 } else if( plc.ncCommand.flag == 0 ) {

  plc.ncCommand.flag = NC_COMMAND_CREATE_DATA_FILE;  

  plc.ncCommand.data.x = (long)"0000DATA";

 }

} else

 plc.mCode.finish = 1;

break;