mshaver Posted March 10, 2014 Share Posted March 10, 2014 Can I change what a pointer points to on the fly in a script program? For example, I have some code that is manipulating status bits in a series of 32 bit shared memory words that a client computer will read. It would be great if I could change what some pointers point to on the fly so I could easily index through the various status words. Couldn't figure out how to change what they point to on the fly. For example, in global declarations, I have the following: M4000->u.user:$0; //Used by GetAxisStatus(0), ALL Motors M4001->u.user:$4; //Will contain status for Motor 1 M4002->u.user:$8; //Will contain status for Motor 2 Etc.Etc. and; ptr mBit0->u.user:$14.0.1; ptr mBit1->u.user:$14.1.1; Etc, etc. And I would have liked to re-aim the pointers programmatically. The power point training on Shared Memory says I can do the following; M100->Sys.Fdata[L10] which would imply I can change the pointer. PPMAC IDE would not accept this code anywhere. No program would accept the pointer declaration. Global declarations will not accept the L10. Must be missing something. MShaver mshaver@pekoprecision.com Link to comment Share on other sites More sharing options...
daves Posted March 10, 2014 Share Posted March 10, 2014 I do the following in script: cmd "R1AmpFault->u.io:$618020.23.1"; // Gate1[16].Chan[0] I assume you could do it with Command("") in c-code but I never have. Also to use your L0 I guess you would have to format the string first. I would also combine this with sendallcmds and Ldata.CmdStatus as shown in some examples. And beware there is some delay between sending a command to the ascii processor and it being reacted to (i.e. reassign pointers and then have a delay as necessary) This may not be the best way to do it but it is the way I have plumped for. Link to comment Share on other sites More sharing options...
Omron Forums Support Posted March 10, 2014 Share Posted March 10, 2014 mshaver, I tried downloading the following in global definitions.pmh: M100->Sys.Fdata[L10]; with firmware 1.6.0.30. It worked fine. Which error message are you getting when you try it? Link to comment Share on other sites More sharing options...
mshaver Posted March 11, 2014 Author Share Posted March 11, 2014 If I place M100->Sys.Fdata[L10]; in global definitions.pmh, the IDE underlines L10, and if I hover over the red underline, I get the following message; "syntax error, unexpected PMAC_LVARIABLE, expecting NUMBER or IDENTIFIER" I've not tried to download. Not much point if the IDE isn't happy. Is this firmware dependent? IDE is 1.0.6.109. Link to comment Share on other sites More sharing options...
steve.milici Posted March 12, 2014 Share Posted March 12, 2014 This will download. The syntax checker needs to be updated for some unusual "syntactical" structures. Link to comment Share on other sites More sharing options...
Recommended Posts