LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controls and event structure

Solved!
Go to solution
i currently have a while loop that works by data flow.
i am hoping to change this work as a while loop and inside the while loop. it will have an event structure.
currently, if SINGLE STEP is TRUE.
then it will enter a manual programming mode.
if i press CONTINUE. it will go back to auto mode
if i press ADV. it will skip the current postion.
if i press stop. it will stop at the current position
if i press ADV&STOP. it will stop the program
if I press ADV&STOP&DELETE. it will stop and delelete the current log file.
i dont know if anyone can point me to the right direction.
it seems like its impossible?

Best regards,
Krispiekream
0 Kudos
Message 1 of 25
(4,175 Views)
Hi krispiekream,

from your description it seems you should rather look for a state machine architecture...

And you still use too much locals! And maybe you should also look at the "compound arithmetic", as it can add/multiply/AND/OR multiple inputs...
And please don't hide terminals far far away from the main part of the block diagram. Use those terminals to avoid locals!
See attachment with changes and commentsSmiley Wink


Message Edited by GerdW on 08-05-2008 09:09 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 25
(4,164 Views)
thanks for your help! i see that there is anot i have to learn.
i just want to clean up my codes.
but from the look of what i used to have. this is so much better.
let me send you the full code and see if you can add any comments for me.
i need help the most ending the two loop. i dont  know if i should get rid of those local variables since they control how the program will end.

Best regards,
Krispiekream
0 Kudos
Message 3 of 25
(4,152 Views)
looking at this image. i think its safe for me to remove the flat sequence?
just making sure?




Message Edited by krispiekream on 08-05-2008 05:27 PM
Best regards,
Krispiekream
0 Kudos
Message 4 of 25
(4,137 Views)
Certainly the one on the right. Dataflow assures that the while loop is finished before the Press to Continue executes and that will be done before the case structure at the left.

The one on the left? I cannot tell from the picture. The cluster wire coming in to the Bundle by Name comes around the inner case structure. If you put the True constant inside that case structure (all cases or wired through all cases), then neither the Bundle by Name nor the local variable would need to be in the sequence.

Lynn
0 Kudos
Message 5 of 25
(4,124 Views)
thanks Lynn,
I have attached my program here.
can someone have a quick look to see if there is anything else i can do to make it better. the end of the loop especially.
i dont know if my block diagram is too long. i am thinking that i should make subvi to reduce the diagram sizes by the local variables to display in the frontpage is killing me.
also, i dont know what to do with the local variables of the control.
i can't use wires because i noticed that my problem doesn't run PROBABLY when i run the wires.
when the user press the control button, the wire doesnt remember it.
i hope its clear.

Best regards,
Krispiekream
0 Kudos
Message 6 of 25
(4,121 Views)
Hi krispiekream,

at the moment I can't save back to LV7, so all I can do is giving some textual comments:
- at "delay to stabalize system"/"measure tempearature" you write the temp to the cluster, but then you don't use that changed cluster and so "forget" about this change...
- you write to "error out" locals 22 times! But then at the end of your program you write to the terminal after those file functions and all the previous error states are lost... (typical race condition)
- when using "index array" with index=0 you don't need to wire a zero constant; when indexing consecutive elements you only need to wire the first index
- enable "auto grow" on all structures to avoid hiding block diagram elements... Use left-to-right wiring when other people should analyze your code!
- use compound arithmetic instead of all those NOT/AND instructions...
- use matching datatypes for indicators to avoid coercion (unless there's a reason to do so)
- at the right side of the big (light green?) loop there a construct of "index array(array size)" - this will fail every time as the last element of an array of size n has the index n-1!
- you can use the case selector as an input to the case structure: you can avoid a lot of (TRUE) constants this way
- make (more) subvis as the block diagram is way to big to get an overview
- in the init while loop (yellow colored) you have a case structure having only one case "0, default" - what is it good for? (Rube-Goldberg code)

Well, now it's getting late and I need to recover for the next daySmiley Wink


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 25
(4,087 Views)
i have labview 8.5 also in my laptop. maybe i can see it from there?
Best regards,
Krispiekream
0 Kudos
Message 8 of 25
(4,085 Views)
Hi krispiekream,

now it's enough for today, see attachment!

And I found the classical Rube-Goldberg (atleast) two times: if TRUE then TRUE else FALSE Smiley Very HappySmiley Very HappySmiley Very Happy
Don't forget: all the previous comments still apply!


Message Edited by GerdW on 08-06-2008 10:15 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 25
(4,076 Views)


you can use the case selector as an input to the case structure: you can avoid a lot of (TRUE) constants this way



can someone show me a diagram of what a case selector it? i tried looking it up in the HELP. but i couldnt find it.
thanks

Best regards,
Krispiekream
0 Kudos
Message 10 of 25
(4,065 Views)