2.14.5 Communication Record


To assist in debugging, communication record can export to a file, and this file as refer for PLC finds any communication error in PLC procedure. For plc.ncCommand.flag must set as NC_COMMAND_SERIALLINK and plc.ncCommand.attr must set as SERIALLINK_ATTR_EXPORT_TRACE.


  • Example: M70 to start the transmission record to the output file.


void plcRun(Status &sts, PlcBlock &plc)

{

 ...


 if( plc.mCode.flag ) {

   switch( plc.mCode.data ) {

     case 70:

       if( plc.ncCommand.flag == NC_COMMAND_SERIALLINK && plc.ncCommand.finish ) {

         plc.ncCommand.flag = 0;

         plc.mCode.finish = 1;

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

         plc.ncCommand.flag = NC_COMMAND_SERIALLINK;

         plc.ncCommand.attr = SERIALLINK_ATTR_EXPORT_TRACE;

       }

       break;

   }

 }

 ...

}


  • The export file name will in order of STRACE_A.CNC, STRACE_B.CNC, STRACE_C.CNC, STRACE_D.CNC so on. The content of export file:


The generated communication record file can be opened in editor mode or FTP download with instrument software to open the view.


Serial link trace, total 13 bytes:

> T54 e65 s73 t74 .0d .0a

< H48 e65 l6c l6c o6f .0d .0a



Explanation:

> send

< receive

T 54 : T→ASCII code, 54→Hex data.