Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coordinate systems D-variables
#1
Hi,

Is it possible to configure a global variable from communication-thread D-variables?

I cannot access the position readback of virtual axes individually from a PLC file, and I don't know why. I just want to map a readback position to a Q variable, but it is not that easy from a PLC file...

The only thing I want is the numerical response for one axis, not string for all axes like the output for "&1p" command.

Example:

&1p
X111 Y222 // string output with all axes set in D0 mask
&2p
X333 Y444

I can access the desired values with commands like:

&1D // Apply "CS1 environment" to D-variables
X111 Y222
D6 // Query CS1 axis X position
111 // this is the output I want
D7 // Query CS1 axis Y position
222 // this is the output I want
&2D;D7 // Change D-variables to CS2 environment; query for CS2 Y position
X333 Y444 // first command output (undesired)
444 //second command output (desired)

But these commands only work from communications threads / scripts other than PLC files.
So I tried to access from PLC file the D-variables from coordinate systems and PLCs, but these are different domains.

What I am missing? How can I access these values from PLC?

Controller: Power Brick LV


Best regards,
Marcelo Moraes
Reply
#2
If you issue the equivalent buffered program command (pread) from inside a program, you can access the results directly with D6, D7, etc. from within the same program (top-level program or its subroutines).

If you want to access these values from outside that particular program, you can use the full data structure name. If the command was issued from a PLC program, you can use Plc[n].Ldata.D[6] etc. If the command was issued from a motion program, you can use Coord[x].Ldata.D[6] etc.

You cannot access the local variables of a communications thread from outside that thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)