Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Execute cmd using a string in ecat[0].IOBuffer[]
#1
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?
Reply
#2
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.
Reply
#3
(03-05-2019, 12:20 PM)curtwilson Wrote: 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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)