LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

specify a cycle count

Solved!
Go to solution

Hey guys, I'm new to labview and I'm working on a project for work. I have my program set up but I would like to add a control that would let me put in a specific cycle value on the front panel, that would allow me to capture data of only the specifed cycles: say 30, or 2000. I already have a cycle counter...is there anyway I could revise my code to allow for a control of these cycle counts?

0 Kudos
Message 1 of 16
(3,950 Views)
Solution
Accepted by topic author glskinner

Hi skinner,

 

- you should make the constant to initialize the counter shift register an integer like I32...

- you should also wire the FALSE case of your counter case structure...

- you should use on of the comparison functions to check your counter value against your limit and wire the result to the loop stop condition...

- you should delete the outer while loop as it's useless...

- you should do some other things as well, but I leave the RubeGoldberg hunting up to you... 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 16
(3,943 Views)

Good morning Gerd, ok, I get making a control for the shift register, although it would be a constant; how could I change this value via the front panel? I'm not understanding what you mean about wiring the False condition of the case structure. Also, yes, the While loop is meaningless.

0 Kudos
Message 3 of 16
(3,939 Views)

Hi skinner,

 

- I didn't mention any controls, you should change the datatype of that constant!

- You didn't wire the FALSE case of that case structure. Instead the output is set to "default if unwired", which (i think) is bad for a counter...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 16
(3,934 Views)

So how to I change the data type? I'm hopeless, I know! 😄

0 Kudos
Message 5 of 16
(3,932 Views)

Hi skinner,

 

ever tried to right-click some objects on the BD? Many options are hidden in the context menus...

 

I thought that was told you in the LabVIEW beginners course offered for free by NI...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 16
(3,924 Views)

Actually the beginners course was more of a sales pitch for the compact RIO. I've done most of my learning on my own and through your help.I think I changed the data type of the register. Now, onto this "wiring" of the false case...any pointers?

0 Kudos
Message 7 of 16
(3,916 Views)

I think I made some progress...is this what I should be doing?

0 Kudos
Message 8 of 16
(3,904 Views)

@glskinner wrote:

Now, onto this "wiring" of the false case...any pointers?



See those case structures with the output tunnels?  Notice that the tunnels are not filled in solid?  That means that not all of the cases are giving an output for that tunnel.  It will output the default value for that data type (typically 0 or FALSE) when it is not wired.  In general, you should not have those.  Define a specific value for those tunnels in each case.

 

Now in the case of your loop count, I think you just want to wire the input tunnel straight to the output tunnel in the FALSE case.


GCentral
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
Message 9 of 16
(3,893 Views)

@glskinner wrote:

I think I made some progress...is this what I should be doing?


Most of your code still does not make a lot of sense.

 

  1. Why is there a 0ms wait and a 0.1s delay time running in parallel?
  2. If you want to change voltages during the run, the terminals belong inside the loop, else they will only get read once at the start of the program.
  3. Why do you connect a DBL to a DBL using "from dynamic data". What do you expect to happen?
  4. You still have uninitialized shift registers
  5. What is the purpose of the ptbypt functions?
  6. You don't need seperate indicators, simply show the digital display of the charts.
  7. There are  "greater or equal zero" and "less than zero", primitives, no need for a zero diagram constant.
  8. Don't do an equal with the cycle counter. If somebody would change it to a smaller value during run, the VI would never stop. Use larger or equal, for example.
  9. Most of your output tunnels are still hollow.
  10. You could read all four channels at once, reducing your related code to 25% of what it currently is.
  11. ...

...

0 Kudos
Message 10 of 16
(3,875 Views)