LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

manual software counter triggering

Hello guys. I want to trigger a counter of NI USB-X 6353 by pressing a button on the front panel to generate a finite pulse. To do so, I made a vi but I am not sure whether it is a good or not. I tested it on a simulated device, it works. I just want to know your suggestions on it. Maybe, there is a better way to do it. Thanks, in advance.

Egemen
Download All
0 Kudos
Message 1 of 7
(3,986 Views)

Hi Egemen,

 

do you think it's a good idea to start a DAQmx task and immediatly after stop that task again?

And using a Latch button you woudln't need to reset the button using a local variable…

Best regards,
GerdW


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

Hello GerdW,

 

You are right, it can be problematic. So, does deleting the stop task vi make it better?

 

I want this counter to be retriggerable from the front panel button, that's why I use latch button and reset. I thought that using latch button can be problematic in terms of loop speed. Which button mechanical action is more suitable?

 

I have changed the vi according to your suggestions. What do you think? Instead of case structure for retriggering, utilizing an event structure is better or not?

 

Thank you very much.

 

counter retriggerable.png

Egemen
0 Kudos
Message 3 of 7
(3,960 Views)

Hi Engeman,

 

- when your VI depends on the state of your CTR task you can read it's state using "DAQmx Task Is Done?" function…

- in your first image you used a switching button as latched buttons don't allow local variables…

- why do you use InsertIntoArray when all you need is BuildArray?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,955 Views)

Hi GerdW,

 

-Actually, my VI does not depend on the state of this finite counter generation. I use this counter to send a finite signal to trigger a device to generate high voltage. I want to trigger this counter manually while other counters and AOs or AIs are still operating. I also change this part like in the screenshot. Is using a stop vi better or not in this way?

 

-I have changed the mechanical action of that button from switching to latch one.

 

-I use insert into array because, sometimes I stop the whole vi, so it is possible to lose previous values, and as I said I can use that counter as retriggerable. If I use buildarray, I can lose old values, I thought.

 

counter retriggerable 2.png

Egemen
0 Kudos
Message 5 of 7
(3,939 Views)

@newbieeng wrote:

Hi GerdW,


 

-I use insert into array because, sometimes I stop the whole vi, so it is possible to lose previous values, and as I said I can use that counter as retriggerable. If I use buildarray, I can lose old values, I thought.

 

 


That's not the answer to the question.

 

The question is why are you using Insert Into Array rather than Build Array?    Build Array should be used about 95% of the time, Insert into Array 5% of the time.  When you know you are going to build data onto the beginning or end of an array, then Build Array is the correct function to use.  It is very straightforward.  Only use Insert Into Array if you need to insert elements into the middle of an array.

0 Kudos
Message 6 of 7
(3,914 Views)

Hi RavesFan,

 

I got the point. I misunderstood the functionality of the buildarray function. Thank you.

Egemen
0 Kudos
Message 7 of 7
(3,876 Views)