LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event timing at Specific time intervals

Hey Matt,

 

Thanks for your suggestion, the problem was solved when I set the acquision mode to NChan 1Samp. 

 

Now that I've essentially finished the code for the data acquision of one detector, I need to clone that code so that I can log data from multiple detectors at once (eventually twenty at once, logging 40 analog input channels).  I want to be able to turn the acquision on and off for each detector with the boolean switch on the Front Panel. I started this process by simply copy/pasting the code in VI, creating duplicate code within the same VI.  I renamed all of the buttons, file paths and property channels such that the two tasks would be logging different data, yet I cannot get both tasks to sun simutaneously. 

 

When I run the VI with both Boolean switches enabled, only one will collect data, while the other grabs zeros (at a much faster rate than 1 Hz) and logs them hundreds of times the second of the cutoff of the desired interval time.  If I try to turn boolean switches on/off during the program's operation (or start the program with one of them off), I get an error message:

 

"Error -50103 occurred at DAQmx Start Task.vi"

Possible reason(s):
The specified resource is reserved. The operation could not be completed as specified.
Task Name: _unnamedTask<BD>

 

 

I've tried naming the tasks separately, and ensuring that both tasks are referencing different objects, but I cannot get the program to do what I want: Log data simultaneously from 2 different sets of 2 analog inputs.

 

Is my approach at running multiple tasks at once viable for collecting data from more than one source?

 

Or should I take a different approach of acquiring all data in one task, and just duplicate the code in the while loop for multiple detectors?  If so, how can i turn Pairs of AI channels on and off from the the front panel while collecting data?

0 Kudos
Message 11 of 16
(1,342 Views)

Ben,

 

You can not do that - a card can not be accessed by two different tasks simultaneously.  All data from the card should be logged by a single task (there is just no other way to do it, unfortunately).  There should be no extra overhead with just taking all of the data off the card - if you want to turn off the acquisition for a particular channel, simply have a boolean that might be associated with certain portions of an array (i.e. bool1 for the index 0, bool2 for index 1, etc etc) and take only the data associated with the indices that are true.

 

Cheers, Matt

0 Kudos
Message 12 of 16
(1,333 Views)

Ben,

 

You can not do that - a card can not be accessed by two different tasks simultaneously.  All data from the card should be logged by a single task (there is just no other way to do it, unfortunately).  There should be no extra overhead with just taking all of the data off the card - if you want to turn off the acquisition for a particular channel, simply have a boolean that might be associated with certain portions of an array (i.e. bool1 for the index 0, bool2 for index 1, etc etc) and take only the data associated with the indices that are true.

 

Cheers, Matt

Message 13 of 16
(1,333 Views)

Thanks Matt,

 

You've been such a great help for me so far!  I've attached a VI for the controlling of two detectors. Everything works as I think it should, but I anticipate the block diagram to get very messy once I duplicate the code 18 more times.  I have a few questions about how to organize and simplify my code from here:

 

1) Is there any was that I can simplify or iterate the code such that it will not look so messy when I duplicate it 18 more times? 

Would a Flat Sequence structure help here, or is that going to be difficult with all of the shift registers passing data around the while loop?

I understand if this is not possible, I just wanted to see if I could make it simpler to understand for the eventual users of this program who are not skilled in LabVIEW. 

 

2) As far as the file writing goes, earlier you suggested that I use a lower level VI rather than the 'write to LVM' Vi:

20443i7AAA60B9B9E7B0FA

The image of that VI is not available in my LabVIEW 7.0.  Is that the image for "Write to spreadsheet file" VI?

 

3) would it be possible for me to set up column labels in the spreadsheet?

(Ex. Ch A UV, Ch A Temp, Ch B UV, etc...)

I imagine this is possible, but I dont know how to apply them after I send the data into my 'singnal math' VI for modification.

 

4) Is it necessary for me to duplicate the 'Get Time in Date/Seconds' part of my code shown below?

20441i12F56D92C490A68A

Or should I just wire the boolean output of the '/=0' operator to the case structure for each detector?

0 Kudos
Message 14 of 16
(1,320 Views)

Hi Johnsold, 

 

 

 

Do you have an example of this architecture, but also with the ability to handle user events? I have tried various producer/consumer and event loop arrangements but can't get the flow right. 

 

i.e. an event driven producer/consumer, with system clock inputs as triggering events. 

 

 

Graham

0 Kudos
Message 15 of 16
(527 Views)

Hi Graham,

 

You may be better off asking your specific question by creating a new forum post instead of asking it in this old one thread where it is unlikely to be answered.

 

Regards,

 

 

Mike B.
Technical Support Engineer
National Instruments
0 Kudos
Message 16 of 16
(509 Views)