Jump to content
OMRON Forums

Plc[n].Running in C program


JeffB
 Share

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...