Jump to content
OMRON Forums

Redirect pointers programmatically?


Recommended Posts

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



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;


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.



Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

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

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

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...