Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetResponse block read order
I've declared a series of pointers to Sys.Idata and Sys.Fdata variables. I've declared the pointers to the data in a specific order, but the type order mixed matched. When I issure a GetResponse block read, and reference a pointer (example. GetResponse(PointerName,100) ) as the starting point, it seems to return the values in the order that the pointers were declared. Is that always the case? Or would I be better to organize the Sys.Idata and Sys.Fdata seperately and read them as 2 GetResponse commands.
I'm not quite sure whether you're referring to GetResponse in a windows program using Power PMAC CommLibrary or the GetResponse in C language section of Power PMAC Project. The correct syntax for GetResponse in Power PMAC C Language is:

Quote:int GetResponse (char * pinstr, char * poutstr, size_t outlen, unsigned char EchoMode)
Performs a string send to 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"

*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

0 == OK, - == error number
Sina Sattari
Hardware Engineering Manager
Delta Tau Data Systems, Inc.
I think you are saying that you made some "ptr" declarations not pointers to shared memory from C code.

When we auto-assign PPmac variables to user names we do this solely based on a first seen first assigned idealology. So what you are describing sounds normal.

1. You could reorganize your declarations to get the data sequentially.
2. You could declare these as arrays.

// Note ptr Arrays to memory (not self defined) must have a '+' at the
// end to increment variable type address for each array element.
ptr pArray(4)->$800008.8.8+, pArray2(4)->*, pArray3(4)->*u.16, mymvar1->*;

3. You could access the memory directly with a C pointer. If you do this you do not get to use the same names as you had in the script language, you must just know which memory locations to access.
I just wanted to make sure the "prt"s are created in the order that I declared them so I can retrieve them in that order. I think this statement "first seen first assigned idealology" answered my question. Thank you.

As long as you make all assignments in global definitions.pmh you will have no trouble controlling the order. If you try and make definitions in individual .plc and .pmc files then you will have trouble figuring out which file is parsed first.
You can also specify exactly which M-Variables to use for the pointers by using #define statements, rather than allowing PMAC to choose the order for you via the "ptr" statement. Example:

#define FirstPointer    M5000
#define SecondPointer    M5001

The upside of this method is that you can define them in Global Definitions.pmh, above a PLC, above a motion program, or whatever, in whatever order you want, and the definitions will hold exactly as you define them, as long as you keep track of which variables you are using or not. Keep in mind that the downside of this method is that you must manually keep track of which variables are used for which purposes. In contrast, if you use ptr, then PMAC figures all of that out for you.
That's exactly what I wanted to hear. Thanks Brad. Thanks Charles.

Forum Jump:

Users browsing this thread: 1 Guest(s)