Jump to content
OMRON Forums

Pointers to P-Variables possible?


mshaver

Recommended Posts

I'm developing an application for a client. Client has a legacy Windows application originally written for a PMAC and wants to use this same Windows application with the PPMAC I am developing for him. Mostly no problem. However, Windows app does most interaction through PMAC-style P-Variables which, in and of itself is no problem for the PPMAC except that I would like to use more intuitive variable names than P8101, for example.

 

I tried to make pointers, ptr RampRate->P8101 which would allow client to write to P-variables and me to program with intuitive variable names. IDE was not at all impressed with my feeble attempt and declared hairball.

 

Is there a way to declare pointers to P-variables? If not, I suppose I can use Define statements to accomplish the same end.

 

I know that declared global variables are really mapped to underlying P-Variables. Is there some way for me to declare a variable and tell the IDE which underlying P-Variable to map it to? I think I remember reading that I can but I can't find the reference now.

M. Shaver

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

mshaver:

 

In Capps, you can do something like:

 

double *RampRate = &pshm->P[8101];

 

I hardly ever use script or motion programs, so I don't know if they have an equivalent syntax. If they do, I would guess they would use the ".a" operator? Maybe someone who is more familiar with script can comment here.

 

Also, check out page 365 of the Power PMAC User's Manual for comments about PVARSTART in pp_proj.ini which lets you specify which Pvar the first 'global' starts at.

Link to comment
Share on other sites

I think, like C, "#define myvariable P100" does not actually define a pointer and does not create a variable that an external device can access. It's just a text substitution at compile time. IE; an external device using GPASCII is not going to be able to access P100 via "myvariable". The IDE will, because it's aware of the definition, but an external device will not be able to access via this name. However, in this case, I think this fills the bill because my customer wants to access these variables via their Pnnnn definitions and it lets me program using the #define name.

 

Thanks;

Link to comment
Share on other sites

I think, like C, "#define myvariable P100" does not actually define a pointer and does not create a variable that an external device can access. It's just a text substitution at compile time. IE; an external device using GPASCII is not going to be able to access P100 via "myvariable". The IDE will, because it's aware of the definition, but an external device will not be able to access via this name. However, in this case, I think this fills the bill because my customer wants to access these variables via their Pnnnn definitions and it lets me program using the #define name.

 

Thanks;

 

mshaver,

 

If you use your own ssh connection, call the gpascii with -2 option call and all your #defines and global, ptr and csglobal parameters will be accessible without requiring you to know what parameter it is being referenced in PMAC.

If you use our communication library, you don't need to do anything special and you have access to all #defines and global, ptr and csglobal parameters.

 

On a side note: Have you considered taking the Power PMAC training course? Most if not all of the answers to your questions are included in the training and it takes less than a week to complete.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...