Jump to content
OMRON Forums

IO Hardware acess in a CPLC


RaphaelM
 Share

Recommended Posts

Hello,

 

I would like to change the value of an output in a CPLC.

 

In a PLC, I write in GateIO[0].DataReg[3], but I can't do that in a CPLC.

 

I can do that with pointers but it's a PLC script which upload the outputs with the pointers values. So the speed of my process is impacted by speed of the PLC.

 

I search the best solution to synchronise a moove on an edge signal.

 

Thanks for your help.

 

RM

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Raphael,

 

In order to write to gate structures in C, you must first define the gate pointer. Pages 483 and following of the Power PMAC User Manual describe this in detail. To get that manual, click "FileDepot" near the top right of the forum page and then go to Power PMAC-->Manuals.

 

Basically for your card, a GateIO card, define a pointer like this:

 

volatile GateIoStruct *MyFirstGateIoIC;

 

Then, assign the pointer to your card's memory address. Since you wrote in your post that you're using GateIo[0], you can use the 0th index in the GetGateIoMemPtr() function as follows:

 

MyFirstGateIoIC = GetGateIoMemPtr(0);

 

Then you can access DataReg[3] like this:

 

 

MyFirstGateIoIC->DataReg[3]=value;

 

where value is the value you want to write to DataReg[3].

 

Is that clear?

Link to comment
Share on other sites

What about the ECAT structures? I can't find anything in the manuals about how to access them from a cplc. Is it possible?

 

Thanks,

 

Matthew Dean

Hi Matthew,

If you want to use it in C, this is how you will access.

Use pshm->ECAT[slave].IO[number].Data to access from C background program.

Typically you will setup the device using system setup. The utility allows you to create user names for the PDO. Using export variable (Right Click on the master) option you can generate the .pmh and .h file , which can be added to your project.

Thanks

Atul

Link to comment
Share on other sites

Raphael,

 

In order to write to gate structures in C, you must first define the gate pointer. Pages 483 and following of the Power PMAC User Manual describe this in detail. To get that manual, click "FileDepot" near the top right of the forum page and then go to Power PMAC-->Manuals.

 

Basically for your card, a GateIO card, define a pointer like this:

 

volatile GateIoStruct *MyFirstGateIoIC;

 

Then, assign the pointer to your card's memory address. Since you wrote in your post that you're using GateIo[0], you can use the 0th index in the GetGateIoMemPtr() function as follows:

 

MyFirstGateIoIC = GetGateIoMemPtr(0);

 

Then you can access DataReg[3] like this:

 

 

MyFirstGateIoIC->DataReg[3]=value;

 

where value is the value you want to write to DataReg[3].

 

Is that clear?

 

Charles,

 

I have follow the user manuel like you wrote.

 

I don't understand why, but I have a syntax error on the declaration of the pointer in red.

 

See my code:

____________________

 

#include

#include

#include

 

#define _EnumMode_

#define _PPScriptMode_

#include "../../Include/pp_proj.h"

 

void realtimeinterrupt_plcc()

{

volatile GateIoStruct *MyFirstGateIoIC;

 

MyFirstGateIoIC=GetGateIOMemPtr(0);

 

MyFirstGateIoIC->DataReg[3]=1;

 

}

____________________

 

Thanks for your help.

[/align]

RM

Link to comment
Share on other sites

didnt think you could define both of these?

#define _EnumMode_

#define _PPScriptMode_

 

Yes. Once _PPScriptMode_ is defined it will not use the _EnumMode_

 

#ifndef _PP_PROJ_H_

#define _PP_PROJ_H_

//******

.....

#ifdef _PPScriptMode_

.....

#else

#ifdef _EnumMode_

.....

// end of #ifdef _EnumMode_

#else

// ***** Standard default mode *****

...

#endif

#endif

#endif //_PP_PROJ_H_

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...