Jump to content
OMRON Forums

GPASCII access to user data structures


michaelthompson
 Share

Recommended Posts

Most or all of the internal Power PMAC data structures are accessible via gpascii. For example, Motor[3].JogSpeed will be correctly reported when running gpascii -2 or within the IDE terminal window. Likewise (with the side effect of polluting the global name space) we are able to create global P and M variables that gpascii can translate correctly. However, what would really be nice would be to have the same gpascii translation capability with our user-defined structures that we have with the Delta Tau defined internal structures.

 

Example:

 

typedef struct

{

int PLCIndex;

double defaultSpeed;

int param1;

} MY_AXIS_DATA;

 

typedef struct

{

int nAxes;

MY_AXIS_DATA[5];

int param1;

int param2;

int param3;

void* pPointer1;

char* pLastError;

} MY_APPLICATION_DATA;

 

For this example, what I would like to make global is only a single name:

 

MY_APPLICATION_DATA myApp;

 

Then, within gpascii, I would like to be able to interrogate and modify my structure much like I can interrogate Delta Tau's structures. And it would be even nicer if the intellisense in the IDE supported this.

 

myApp.myAxis[3].defaultSpeed=27 // set a variable within my structure

myApp.pLastError // dump last error message text

 

And even better would be if the BACKUP command would let me dump my entire structure or arrays the way that I can backup Delta Tau structures.

 

BACKUP myApp.

 

And getting even more ambitious, it would be nice to call properly initialized and exposed C subroutines by name from gpascii (much like the CFromScript allows C functions to be called from script language). For example:

 

reportMotorDiagnostics(3,verbose) // user defined reporting

 

Are any of these things already supported and I simply don't know about them? If not, how important is this to the general Power PMAC community. If most Power PMAC users are writing small applications, then populating and polluting the global name space with a few variables may not be a problem. Likewise, those users probably do not have a need for gpascii command language extension. However, for those of us with larger applications and the desire to organize our data in data structures (and someday classes with methods), this capability within gpascii would be a huge benefit.

 

There are a few different common C/C++ scripting platforms that could be used as models (or even incorporated into a C app), but I figured that I would first check what Delta Tau (and its user base) has already done (or envisions doing).

 

http://www.debian-administration.org/articles/264

http://csl.sourceforge.net/csl.html

 

Of course, other tools like Ruby and Python could give access to the C data structures as well, but my real interest is for everything to be contained within gpascii.

 

 

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Michael,

 

As far as I know, this isn't doable out of the box as of 04/12. To solve this issue, my company ended up writing a custom Capp (similar to gpascii) that provides tagname based access to certain Delta Tau structures in addition to any user defined variables/structures.

 

As a poor man's substitute, you could make each element in your custom structure be a pointer, and then define global variables for each structure element. Then, all you'd have to do is point each structure element to the address of its associated global variable, and they would be accessible via gpascii.

 

Unfortunately, this wouldn't allow you to encapsulate your tagnames (e.g. you would have to access myApp.myAxis[3].defaultSpeed as "myAppAxis3DefaultSpeed" or whatever name you choose).

 

-Steven

Link to comment
Share on other sites

I agree this would be a very helpful feature. I also needed this and since it was not available made a work around. It is not as nice as having the real feature but it is better than nothing and somewhat automated.

 

The idea in the C code is to declare your structures so they reside in PPmac global shared memory. This probably came from a thread you were involved in. Then I made a simple excel program to translate my structure names into #define's. and to build the required code for the C program.

 

If it helps, attached is the excel program. It does not do all types of variables, just double, int, and float at the moment.

PPmac global structure version_1.xls

Link to comment
Share on other sites

  • 2 weeks later...

I have a question which is an extension to this.

I am using the Power PMAC Component library to create a C# program running on a Windows PC and communicating with PPMAC. What would be the easiest way to access these shared memory data structures as defined in excel through the component library? I can easily access the Power PMAC data structures.

 

TIA

 

----

I agree this would be a very helpful feature. I also needed this and since it was not available made a work around. It is not as nice as having the real feature but it is better than nothing and somewhat automated.

 

The idea in the C code is to declare your structures so they reside in PPmac global shared memory. This probably came from a thread you were involved in. Then I made a simple excel program to translate my structure names into #define's. and to build the required code for the C program.

 

If it helps, attached is the excel program. It does not do all types of variables, just double, int, and float at the moment.

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...