LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: stop "whlie loop" while inside "stacked sequence structure"

Can you give me an example of a state machine like the one you described? thank you🙏

0 Kudos
Message 1 of 8
(432 Views)

Hi sinclair,

 

no need to ask in a ~20 years old thread when you could select the "Create Project…" entry in the File menu and choose the "Simple State Machine" template!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(427 Views)

There is also this: State Machine



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(364 Views)

Gerd and crossrulz thank you for your response, previously I will create a program to move 2 motors with very different characteristics as well as the program, here I will create many programs with different motor movements, which will use a lot of case structures that are very stacked. One of the movements that I will make is almost the same as the raw file that I attached.

according to the instructions and examples I avoid stacked whileloops, my problem now is how to find a last value in a new program, without whileloops and without saving it, (the last value must not change before the loop has finished in a structure). how to do it? because it is an important component that must be there to run the program, I hope anyone can help, help me master, thank you very much🙏

0 Kudos
Message 4 of 8
(326 Views)

This vi is in LabVIEW 2025. Most people that are going to provide support are not using LabVIEW 2025. You should save for a previous version and save for like LabVIEW 2020. This way you get more help.

Tim
GHSP
0 Kudos
Message 5 of 8
(316 Views)

LabView 2008

Download All
0 Kudos
Message 6 of 8
(300 Views)

Hi sinclair,

 

thanks for downconverting your code. (Next time please don't rename the CTL file after conversion…)

 


@sinclair15 wrote:

I will create a program to move 2 motors with very different characteristics as well as the program, here I will create many programs with different motor movements, which will use a lot of case structures that are very stacked


No, you don't need "a lot of stacked case structures"! Use a better code architecture!

 

  • Your "old program" is wrong because it uses way too many local variables. Ever heard of shift registers and how/when to use them?
  • Ever heard of "comparing floats for equality" is wrong?
  • Ever heard of "using more than one event structure per VI" is a sign of bad code?
  • What's the point of event structures with a (single!) timeout event when there is no timeout defined???
  • What's the point of an enum typedef when the enum only contains items "0", "1", "2" and "3"? Either use descriptive item labels or simple integer values…

@sinclair15 wrote:

according to the instructions and examples I avoid stacked whileloops


Which "instructions"?

Why do you want to use (or avoid) "stacked while loops"?

 


@sinclair15 wrote:

my problem now is how to find a last value in a new program, without whileloops and without saving it, (the last value must not change before the loop has finished in a structure). how to do it? 🙏


  • This "last value" should not change inside the loop? Then read it before the loop! (And say loud and clear "THINK DATAFLOW!")
  • Where do you need to "find" that "last value"?
  • Why do you need to "find without using while loops"???
  • Why do you need to handle a "last value … without saving it"???

You really need to learn how to describe/express your requirements much better.

Describing requirements correctly is the first step in creating good programs!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(269 Views)

problem has been solved, just fix the data flow logic, thank you gerd, thank you all🙏

0 Kudos
Message 8 of 8
(199 Views)