Jump to content

GermanM

Members
  • Posts

    4
  • Joined

  • Last visited

GermanM's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. I would like to know if the switch case statement can run more than one single case at the same time. I don't have access to the PLC right now to test it. My idea is to build a switch case to store a value into a Tag depending on the control of the switch case: If Value is 1: Store Apple in Tag1 If Value is 0: Store Orange in Tag1 If Value is 1: Store 100 in Tag2 If Value is 0 Store 50 in Tag2 In case the control value is 1, Tag1=Apple and Tag2=100 Thank you!
  2. Hi Pascal, thank you for your answer! I understand your POV my concern is that I don't see the advantage of declare the "Function_In variable" when I program a function. I just use a global custom made Struct for each function with all the variables that I need, so when one of these variables changes I can use it directly in any part of my project. Well, I think that could be a good idea, some tips from Unitronics with good programming practices managing medium/big projects. How to organize the set of variables, Is good idea use the IO tag name of input directly? These types of things... I suppose that I'm just a newbie!!
  3. Hello everyone, I would like to know your opinion and advices of my procedure to organize my set of variables. I'm developing a program for a machine with many functions. I divide the machine in 10 different functions, each of them is related with one single process. In order to reduce and organize a lot of different variables, (more of them with same or similar name), I decide to create a single STRUCT for each function. These structs contain the variable that I need for this specific function. For example, the "MIXER" is an STRUCT with the following variables: Auto, Enable, End, Alarm, TempLow, TempHigh, Running, etc. So, for example: When I need to use one of these variables, I just call MIXER_1.Auto, instead of the old way that I use with global variables : Mixer1_Auto, and also I can reuse the STRUCT if I have more than one same functions: MIXER_2.Auto My goal is to keep the list of variables as low as I can, but I'm not sure is this is a good idea, o I'm losing other fantastic way to keep the variables well organized. I know that each function can use Function_In and Function_Out variables, but I think that this way to program is worse because I need to double the number of variables. The ones used inside the function, and then the globals that I need to connect to the function when I call it. So, I'm doing something logic or I need to change my way of programming? I hope you understand me... thank you!
×
×
  • Create New...