Jump to content
  • 0

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

Bryon Sol


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.


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:


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


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


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


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.

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