Questions regarding variables

Hello, I have some questions regarding variables.

                                               * When i develop a program i make the variables in the variables list associated with that program. When are these variables show in the PLC Data List?
                                               * If i want a variable to be used in the web based HMI, how do i enable the HMI Tag field? It is greyed out, even tho i have variables declared as Global as per the HMI tutorial video.

Program variable list: PLC variable list:
* When i delete a variable from the program variable list, it isnt removed from PLC?
Maybe someone could explain to me how the variable “flow” works? And also what is needed for a variable to be available to be used in the HMI besides it being declared globally?

qr-barcode-recognition.pdf

Hello nems, those are all very good questions. PLCnext Technology introduces the concept of “Port” variables, but apart from that the way that variables are implemented in PLCnext Engineer pretty much follows the IEC-61131 standard. In saying that, I don’t think I’ve ever seen a really good, easy-to-understand article or tutorial showing how to use different IEC variable scopes for different use cases. If anyone has - please let us know! Otherwise I’ll add this to our to-do list here. To answer your specific questions:

                                               * _When i develop a program i make the variables in the variables list associated with that program. When are these variables show in the PLC Data List?_

To make sure I understand - the variables list for the program is this one … and the PLC data list is this one: The answer to the question is: When you declare a Program (or other POU) variable with “External” usage, then a corresponding entry is automatically created in the PLC Data List, if it doesn’t exist already. In the above example, the program variable “MyGlobalVar” was declared as External in the Program, and a variable with the same name was automatically created in the PLC Data List. The PLC Data List contains a set of “Resource Global” Variables, which can be reference by any POU that declares an “External” variable of the same name. In the PLC Data List’s “System Variables” group, you can see lots of interesting global variables that could be referenced in your program using the “External” usage (scope) modifier.
* If i want a variable to be used in the web based HMI, how do i enable the HMI Tag field? It is greyed out, even tho i have variables declared as Global as per the HMI tutorial video.
Short answer: In the current version of PC Worx Engineer (7.2.3), all global variables, and only global variables, can be used as eHMI tags. In the next version of PLCnext Engineer (2019.0) - due to be released in early December - you will also be able to mark variables from the Program Variable list as HMI variables.
* When i delete a variable from the program variable list, it isnt removed from PLC?
Correct, because a Resource Global variable (declared in the PLC Data List) may be referenced in more than one place, so you will need to delete the variable from the PLC Data List manually - or by clicking this button above the list: Hope this helps. - Martin.

Hello Martin, I didnt think the post got through as i was hit by a message about downtime when i tried submitting it yesterday. Thanks for answering my questions, this helps me understand. You are correct in your interpretation of which variable lists / data lists i was talking about. :slight_smile: Ive spent some time reading through the documentation, and that, combined with your answer makes me feel that i have a clearer picture of how it ties together now. One thing that really threw me off is that for a variable to be available to the HMI it has to be declared as a global variable, but if i declare a variable in the program as global then it doesnt show up in the PLC data list. However, if i define it as external then it will show up, but the usage is set to VAR_GLOB. Not to mention that the HMI Tag field will still be greyed out even tho its correctly declared, but you CAN add a HMI Tag if you right click it.. :slight_smile: Declared variables in program: Declared variables in PLC (note how testvar_prog_glob is missing, i understand now that this is because it is not what is called resource-global, but program-global.. Also note HMI Tag field being greyed out): Declared variables in PLC, HMI Tag (right click menu shows possibility to add tag!): I read about this in the documentation where it states that: “Global variables are declared as ‘VAR_GLOBAL’ in the Data List of the ‘PLC’/‘Safety PLC’ node and as ‘External’ in the local variables table of the POU where they are used.” I understand now that most of my questions are caused by a lack of knowledge regarding IEC 61131, and tutorials/documentation are based on that knowledge. I also understand that there are two kinds of global variables, depending on where they are declared. This is a key point. My suggestion is that PC Worx Engineer should make it clearer that the HMI Tag is available to be set (maybe not having it greyed out?) and also that the HMI tutorial video explicitly mentions that the variable has to be declared as external if declared in a program. Thanks again for your input on this!