Jump to content
OMRON Forums

#define a macro for a cmd program command


HJTrost

Recommended Posts

I am converting a set of Turbo Pmac programs to Power Pmac in order to make the transition from the Turbo Clipper to the Power Clipper ARM (specifically targeted at the CK3C-AX1100).  I noticed that #define's for cmd program commands are not properly recognized, e.g., with

#define    CmdPhaseX    cmd"#1$"

I get an error for a line in a PLC

CmdPhaseX ;

saying "Illegal syntax, expecting type definition or operator".

I haven't found any hint in the Power Pmac SRM why the token string   cmd"#1$"   should be illegal.  I'd appreciate any explanation and suggestion.

Hans-Jochen Trost

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Good question.  One of my .pmh files contains these lines:

&1    #1->x
#2->y
#3->Z
&3    #4->W
&4    #5->C

Putting the coordinate system explicitly into the CmdPhase definitions does not change the error message.  Putting the actual command in place of the macro instruction makes the error go away.

By the way, I am working on a PC and am telling the IDE that there is no device connected.  I'm issuing Build commands just to find bugs like this one.  The #define is in a .pmh file, the instruction  "CmdPhaseX ;" is in a PLC.  There are more than one location where these commands are used, which is why I want the macro to ensure that all occurrences use the same command.

Link to comment
Share on other sites

OK, but doesn't CmdPhaseX work now, using Dave's approach?

I believe the problem with not seeing an error message is that you're not looking in the right place.  The PLC is on a different thread than the Terminal Window.  Try checking Ldata.CmdStatus in the PLC after the CmdPhaseXYZ command.  I believe you'll get a "-21" error code.   See under the SRM manual's description for the "cmd" command.

Link to comment
Share on other sites

I don't have my trial project (setting of variables, macro definitions and 3 basic PLCs out of my Turbo program conversion) far enough to actually hook up to my controller, so it will be a while until I get to see the Ldata.CmdStatus. pp_proj.h gets loaded with errors, creating among other issues somehow duplicates from definitions in my .pmh files.  I'll take that into a new thread next week.  Thanks for your guidance so far.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...