LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count number of times an analog input happens?

Seems that decreasing the 'wait' in the loop helps.

 

Would there be any benefit to making this into a subvi to run in a larger loop?

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 11 of 19
(824 Views)

Hi Ralph,

 

- your loop timing determines the sampling speed. You cannot detect pulses with lower switch time than your sampling time. Fundamental data aquisition knowledge...

- you can put that into a subVI. That doesn't change the behaviour, but makes the (main VI) block diagram nicer Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 12 of 19
(819 Views)

In use as a subvi, one wouldn't want a while loop, would you?

 

If not, how do you handle the shift registers...  Make them inputs and outputs of the subvi and run them through the main loop?

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 13 of 19
(816 Views)

Hi Ralph,

 

you can do your task without shift registers: use feedback nodes instead 🙂

 

check.png

When you create a subVI you should think/learn about reentrancy and it's (ab-)uses!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 14 of 19
(814 Views)

Oh neat.

 

I'm a hack so all help is appreciated.

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 15 of 19
(808 Views)

Hmm.

 

Made it into a sub, trying to run two separate instances and they're behaving oddly.  Just running away and no distinct control.  Do I need to add error in and out to 'sequence' the subvis?

___________________________________________________________________
Still confused after 8 years.
Download All
0 Kudos
Message 16 of 19
(809 Views)

Hi Ralph,

 

did you read that last sentence of message #14? It's important and I wrote it for a reason...

 

You really should know what you're doing when you create programs. RTFM! Learn the basics!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 19
(802 Views)

I took all three courses five years ago and knew everything pretty well then, it's been a couple of years.

 

If I don't ask, how will I know?

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 18 of 19
(797 Views)

OK, I set the Execution properties for the sub vi to Reentrant with preallocate for each clone and the functionality seems to be there.

 

Glad I had this conversation, because I have some VI's with multiple calls of the same vi that are very, very large and I had been using the error handler to sequence the subvi's.  This was causing some major slowness in the operation.  As a result of this conversation, I believe I can go fix things that have been bothering me for years.

 

The classes didn't really cover reentrancy.  This is all new to me.  Thanks.

___________________________________________________________________
Still confused after 8 years.
Download All
0 Kudos
Message 19 of 19
(794 Views)