LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run one part from code

Highlighted

Hello, 

 

The attached .vi is a part of a code that can be used to make reading from the detector. 

In the original code, I open 4 ports. 3 of them to control the sample position which we put in a movement controller (3-D). The port number 4 for the detector.

Simply, the code used to change the sample position in 3-D and read the detector counts. 

The code works fine. Just I detect the start, step, and the endpoint of (x,y z), set the time, and press start. then the system will change the sample position and read the detector counts for every position.

The problem:

Reading the counts can be done only inside the scanning loops. But, what we should do If we want to run only the detector (the part in the snap(test.ping))!

I mean how can we make a test for the detector counts before run the full scan.

in another way--> how can I start only the part of the detector (see the snap)! 

note:

I delete the not important code part and keep only the part that I want to run. 

You will see many and many loops, sequences, and structures because it already contains terminals in the original code which controls the movement stage. 

If you want to see the whole code I can share it. 

I hope you can get my idea. 

 

 

 

Download All
0 Kudos
Message 1 of 9
(331 Views)
Highlighted

I immediately see a major red flag: WAY too many sequence structures.  It looks like you should study up on using a State Machine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 2 of 9
(292 Views)
Highlighted

In my opinion you should scrap this and start from scratch. Your code is not manageable. Do some LabVIEW tutorials. Learn about data flow. Study state machines as crossrulz suggested. Also, study up on using subvis. You will take less time doing this than you will in trying to do what you want with this mess. You should be able to program this using one loop rather than a series of nested loops and sequence structures.

0 Kudos
Message 3 of 9
(266 Views)
Highlighted

@johntrich1971 wrote:

In my opinion you should scrap this and start from scratch. 


I completely agree. While the Mayans were great architects, they were not great "LabVIEW architects" so don't try to adapt their designs.

 

altenbach_1-1596485689777.png

 

 

All you probably need is one loop and one case structure to tie it all together. Start with some simple tutorials and templates.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 9
(234 Views)
Highlighted

Hi,

 

wow, 4 stop buttons to finally stop a VI…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 5 of 9
(227 Views)
Highlighted

@GerdW wrote:

wow, 4 stop buttons to finally stop a VI…


And since the terminal labels are hidden, we can only guess what belongs to each loop.

 

(... and good luck stopping anything if there is no error in the innermost two loops and an unreasonably large times had been entered)


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 9
(219 Views)
Highlighted

I expect that maybe you will miss the idea,

I said in my post that I deleted the residual code, and keep only the important part. 

I attached the whole code, please check it to build the complete idea. 

 

0 Kudos
Message 7 of 9
(185 Views)
Highlighted

@BaJa_2020 wrote:

I expect that maybe you will miss the idea,

I said in my post that I deleted the residual code, and keep only the important part. 

I attached the whole code, please check it to build the complete idea. 

 


I still come to the same conclusion (possibly more so): you need to invest in building a proper State Machine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 8 of 9
(161 Views)
Highlighted

@BaJa_2020 wrote:

I expect that maybe you will miss the idea,

I said in my post that I deleted the residual code, and keep only the important part. 

I attached the whole code, please check it to build the complete idea. 

 


Actually, no, the "residual code" only makes the problem worse, not better. You are wasting your time with this mess.You do not need multiple nested loops and sequence structures.

0 Kudos
Message 9 of 9
(133 Views)