03-26-2020 11:04 AM - edited 03-26-2020 11:06 AM
@johntrich1971 wrote:
@labview99 wrote:
Thank you.
Sorry, what do you mean when you say to try to clean that to fit on one screen? I don´t understand what do you mean..
Your block diagram is extraordinarily large. It can actually be made better with Clean up diagram from the Edit menu (if you write good code this actually makes it worse, but it might be a good starting point for you). You've got lots of white space. Put things closer together and make the wires neat. Making the block diagram so large means that many have to scroll to see the whole program, making it extremely difficult to follow the flow. Read up on LabVIEW style for more information.
^^
A useful thing you might not have known.
Holding Ctrl and dragging the mouse adds whitespace between things.
Holding Ctrl + Alt and dragging the mouse removes whitespace.
Works on the front panel and block diagram.
Can do strange things when removing space in Case Structures (or things with hidden code) but generally still useful if used with a bit of care (or in small chunks at a time).
That's basically the main tool I used to produce this edited version.
03-26-2020 11:41 AM
Thank you very much for all your advice and for your help!!
Do you think that now is it doing ok what I want it to do?
I attach the program
03-26-2020 01:22 PM
Sorry, I have a question regarding my program.
To pass from one state to another the array that comes out of the VI that I am using in the first case called "meter posicion", to be able to pass this array to other states and to be able to modify that array, I have to do it with the shift register as I have it set ?
03-26-2020 01:44 PM
If you need to pass data from one state to another then yes you do that with a shift register. Don't forget to wire the value across for those state where the value does not change. If you start getting too many shift registers one common method is to make a bundle that contains all of the data that needs to be passed and then use bundle by name and unbundle by name to update the values.
03-26-2020 01:50 PM
@labview99 wrote:
Thank you very much for all your advice and for your help!!
Do you think that now is it doing ok what I want it to do?
I attach the program
That looks a lot better. There's still some room for improvement. Try to make your wires straight when possible. Also, when possible try not to have wires which go from right to left. Finally, I saw at least one hidden wire.
You still have a lot of controls/indicators that I don't think that you need. Replace those with the values that you would have sent to the subvi.
03-26-2020 05:06 PM
The coherence dot on the enum is a bit concerning
You should consider changing the enum into a type-def
03-27-2020 06:35 AM
@Frozen wrote:
The coherence dot on the enum is a bit concerning
You should consider changing the enum into a type-def
Good catch Frozen. Yes, enums should be a type def.
03-27-2020 12:02 PM
@Frozen wrote:
The coherence dot on the enum is a bit concerning
You should consider changing the enum into a type-def
To expand on this thought a bit:
The reason why you want to do this is because changing the items in the typdef'd control will flow its changes to all instances of that typedef. The change will flow to your state case structure and it will break your code because there won't be a match in the case statement for the new item. This makes it very easy to figure out where you need to add the additional code for your state machine.
Another advantage is that if you change the name of an item, any case structures depending on that enum get updated so the code WON'T break unnecessarily.
Deleting an item will also cause broken code. You can then easily find the case structures that are broken and delete the orphaned case.
03-27-2020 01:09 PM - edited 03-27-2020 01:15 PM
Ok, I have changed!! Thank you for your explanations
Do you think that since I have made now the state machine and since I have all the cables connected, will my program do the following?
When I rearm the machine in the "rearmar" state and the condition I have set is met, it will change the number of position 4 in the array to 0 and then send it to the "start flag" state to put number 1 in the position 4 of the array?
Best regards
03-27-2020 04:07 PM
I should probably not jump into this....
There are still too many coding issues for you program to work.
Most notably, you are not using the shift register correctly.
You need to maintain the information between cases by wiring every case all the way across, like this for *every* case of your state machine.