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!