Jump to content
OMRON Forums

Recommended Posts

Posted

Hi all,

 

I am trying to get some, perhaps odd, functionality implemented on the PMAC. I have a string that is received through EtherCAT, and deposited in ECAT[0].IOBuffer[] at a certain offset. I would like to be able to copy that string and somehow pass it to the cmd command. I'm sure I can do this through some C++ code, but I'm trying to avoid that.

 

It looks like any string manipulation (strcpy/etc) is only using the Sys.CData[] region of memory. I haven't been able to specify the source to be in the ECAT[0].IOBuffer region.

 

I can certainly write a loop that transfers the bytes from the IOBuffer to CData one by one, but that seems rather inefficient...

 

Any suggestions?

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Posted
I think you have identified the best method for doing what you need. Hopefully you can embed the transfer to the user buffer in a Script subprogram so the details are then transparent to your application.
Posted

I think you have identified the best method for doing what you need. Hopefully you can embed the transfer to the user buffer in a Script subprogram so the details are then transparent to your application.

 

Thanks for your reply Curt. I was hoping there was some way to point cmd "%s",x directly to ECAT[0].IOBuffer[x], or a way to use memcpy/strcpy but I guess there is not.

 

Thanks for confirming that, and yes, this will be wrapped into a script with monitoring whether or not the command executed and if there were errors.

 

Incidentally, we're going to be using an EL6695 Master-Master module from Beckhoff to talk to the PMAC in this way (from our other EtherCAT master), rather than using TCP/IP (and gpascii). We have a few variables that need to be transferred in more of a real-time fashion. But for the occasional oddball command, this string buffer seemed like a possible way to tackle that without having to create a custom command structure.

  • 1 month later...
Posted

Curt,

 

Following up on this question -- I have gotten it to work fine, however, the speed at which the (even plc0) script executes is a bit too slow for what I'm trying to do. The problem is mostly in moving data around. So I'm porting my code to C.

I wasn't able to find anything on this in the documentation -- but is there any way to send a string to the PMAC parser from C? (like the "cmd" command from script)

 

Thanks!

Posted

The C-API for background C-programs has the “Command()” and “GetResponse()” functions:

 

int Command (char * pinstr)

Sends a command to the Pmac Command Processor. The input string is converted from symbolic to PMAC compatible commands and variables.

Parameters:

*pinstr - ptr to PMAC input string

Returns:

0 == OK, - == error number

 

int GetResponse (char * pinstr, char * poutstr, size_t outlen, unsigned char EchoMode)

Performs a string send with an expected return from the Pmac Command Processor. The input string must have PMAC compatible commands Note: Doesn't handle "gpascii" commands like "$$$" or "reboot".

Parameters:

*pinstr - ptr to input string

outlen - max length of output string

EchoMode - PMAC "echo" parameter which determines the format of the response

*poutstr - ptr to output string

Returns:

0 == OK, - == error number

 

There are many other function available like “GetPmacStatus()” and “GetPmacVar()” to name a few.

 

See the IDE “Help” under the “PowerPMACCLanguageManual”. If your version of the IDE does not have this help add-in (vs 3.x and vs 4.x) you can install it manually here:

"ftp://support.deltatau.com/DT-USA/milici/PPMAC%20IDE/Help%20Files/"

Posted

Thanks Steve!

 

With the Command() function, when it returns, can I assume the command processor has completed the command? Or should I use GetResponse() for that? In my case I'm not interested in the response to the commands, just that they have been executed.

Guest
This topic is now closed to further replies.

×
×
  • Create New...