Jump to content
OMRON Forums

GetResponse block read order


RickJames

Recommended Posts

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.
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

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" Parameters: *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 Returns: 0 == OK, - == error number [/quote]
Link to comment
Share on other sites

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)->u.io:$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. http://forums.deltatau.com/showthread.php?tid=17&highlight=user+buffer
Link to comment
Share on other sites

Correct. 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.
Link to comment
Share on other sites

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: [code] #define FirstPointer M5000 #define SecondPointer M5001 FirstPointer->u.io:$A00000.8.12; SecondPointer->s.io:$B00000.8.12; [/code] 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.
Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.

×
×
  • Create New...