Jump to content
  • 0

Compile Error: A Device which is latched has been assigned for VAR_GLOBAL class


Bryon Sol

Question

Have you ever received one of the following compile errors in GX Works3?

a)  A device which is latched has been assigned for VAR_GLOBAL class.  Please change to VAR_GLOBAL_RETAIN class.

or

b) A device which is not latched has been assigned for VAR_GLOABL_RETAIN class.  Please assign a device which is latched.

Well what do these mean? Simply put, you created a label and told the compiler that you wanted it retained (VAR_GLOBAL_RETAIN class), but assigned it a register in the non-retained area.  Or vice versa, you created a label and told the compiler you didn't want it retained (VAR_GLOBAL class) but assigned it a register in the retained area.

For example neither of these work:

image.png.84bdccfcf8535e14c0f9d49c4dc1bc85.png

When you look at the parameters for this PLC any register above D200 is in Latch Area 1

image.png.7c1b211cba51c39e70539098fd22b8a7.png

So if you try to set any Global label as retained under D200 you will get an error, and if I try to set any Global label as simply VAR_GLOBAL at D200 or above you will also get an error.

This is solvable simply by moving the assigned register, or switching from VAR_GLOBAL to VAR_GLOBAL_RETAIN (or vice versa).  

But what about in the following scenario?  I have both non-retained and retained values inside of a Structured Data Type (SDT).

image.png.790f7dac05fbaaf34b20b59f69c30724.png

If you absolutely need to do something like this, there's one option available to you.  It's a setting in the Convert options of GX Works3.   

"Check the Consistency of Global Label".  The default is YES, but if we set it to NO then it stops checking VAR_GLOBAL vs VAR_GLOBAL_RETAIN and the registers

image.png.afd2b4338ea306eae463bdd558d22db1.png

Upon making this change you can now compile the program and point labels to any register/bit without experiencing the error.  However, the danger becomes that you may not have placed something in the correct memory area to do what you need it to do.  Please use this setting with caution.

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   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...