JeffB Posted September 23, 2021 Share Posted September 23, 2021 I need to see if a given PLC routine is running in my C background code. The line bRoutineRunning = pshm->Plc[14].Running; yields an error : 'PlcData' has no member named 'Running'. Maybe this should calculated from the Ldata like program running, e.g. bProgramRunning = ((pshm->Coord[1].Ldata.Status & 0x2E) == 0x20);? What is the analogous syntax for plc routines? What if my PLC is declared textually, i.e. 'open plc ScanLogPLC'? Thanks Link to comment Share on other sites More sharing options...
Smakarem Posted September 24, 2021 Share Posted September 24, 2021 We can use the GetResponse command to issue the script command "PLC[14].Running" to PMAC and get a result. One method for retrieving the status of your PLC parameter can be seen in the code below: char *Cdata; Cdata = (char *)pushm; char szdata[100]; GetResponse((char*)"Plc[14].Running",&szdata, sizeof(szdata), 0); Cdata[10]= szdata[16] - 48; For your second question: "What if my PLC is declared textually, i.e. 'open plc ScanLogPLC'?" Answer: It's best practice to use the PLC ID number (i.e. Plc[14]). Link to comment Share on other sites More sharing options...
steve.milici Posted September 27, 2021 Share Posted September 27, 2021 You can view the PLC number for a “named” PLC in the IDE’s “Task Manager” under the “PLC” tab. See attached picture. Link to comment Share on other sites More sharing options...
Recommended Posts