LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

digital sampling

I am having some timing issues.
 
I am sampling analog inputs at 1kHz, and also sampling some digital signals "continuously" but I can not figure out how to increase the sampling rate of the digital signal. I need to get the sampling rate of the digital signal up to 1kHz to "coincide" with my analog data. I am using the DAQ assistant express VI to acquire both the analog and digital signal.
 
Thanks
 
Scott Donahue
University Of Illinois Urbana-Champaign 
0 Kudos
Message 1 of 19
(4,665 Views)
Also I am using a 6025E Daq card.
0 Kudos
Message 2 of 19
(4,645 Views)
To make your digital read synchronous with the AI read, look at the shipping example called Multi-Function-Synch AI-Read Dig Chan.vi. It can be found from Find Examples>Hardware Input and Output>DAQmx>Synchronization.
Message 3 of 19
(4,628 Views)
That won't work for me because I am using the daq assistant express vi to input my data, so I only have a digital line available to process the timing, not a task. Also I have 8 analog inputs, and 10 digital inputs so that code would take up too much space. Isn't there a way to change the sampling rate on the Daq assitant express VI?
I am not sure what to do.
 
Thanks
Scott
0 Kudos
Message 4 of 19
(4,624 Views)

Whether you have 1 channel or multiple channels, the example uses exactly the same diagram (assuming all of the analog channels are set the same). In the channel list, you can specify single OR multiple channels. For multiple consectutive channels, it would be Dev1/ai0:7. The example is monitoring a whole port (8 lines) but that can be changed to a single digital line, multiple lines, or multiple ports.

I may also have misunderstood your problem. I thought you wanted to acquire a single digital input of all lines at the same time you acquired the anlaog. If you want to acquire 100 scans of all digital lines in each loop, you can't.  Since the digital I/O is software timed, you will read the digital lines once for each loop iteration. You don't have a hardware clock to scan x number of channels at a certain rate like the analog input does. You could have the digital read in a separate while loop with a short delay but since the clock in a pc is not accurate and the OS isn't deterministic, the best way to read the digital lines every msec is to use a timed loop if you have LabVIEW 7.1. The other way is to get a digital I/O card with hardware timing.

Message 5 of 19
(4,613 Views)
How would I implement a timed loop? Right now the only loop that I am using is the one for the "stop" function.

0 Kudos
Message 6 of 19
(4,605 Views)
The timed loop is on the Structures palette but this is only available in LabVIEW 7.1 or higher. There are some shipping examples that demonstrate how it's used.
Message 7 of 19
(4,595 Views)
I tried to use the timed loop, but It did not increase the sampling rate of the digital signal. I tried to speed the loop up (1ms period), decrease my analog freq and number of samples per loop, but that still did not work.
 
When I try to use run the multi-func-synch AI-read dig chan Vi I keep getting an error message 200077. It says that I can not use the sample clock, and I must use either handshake or On Demand, this defeats the purpose of using this VI though. I need to be able to choose the same sample rate for both inputs. 
 
The format of the VI seems to be what I need. It appears that If I can get it working I can synchronize my analog and digital signals to both sample at 1000 times per second, or 1000 Hz.
 
I am enclosing a link to my file with read and write privileges, I hope that you can help me with my issue. I appreciate your time and patients with this "labview newbie"
 
 
Thanks
Scott
0 Kudos
Message 8 of 19
(4,585 Views)

You didn't have to provide a link. You can just use the attachment button below the message body. And, when you post a VI, that doesn't include ths subVIs. What you should do is Save With Options and select Development Distribution. That will create an LLB that contains your main and subVIs.

From looking at the main VI, it seems you're doing a lot of post processing and also a file write with each iteration. All of this is going to drastically slow down how fast you can run the loop. You may want to pull out the digital I/O into it's own while or timed loop and pass the data to the main loop with a queue. You could also speed up the file write considerably by writing a binary file and not using the Express function. You might also want to consider waiting to write the data when the main while loop stops. I also don't understand why you're building 7 different tables. It would probably be more effecient to build a single table with 7 different rows.

0 Kudos
Message 9 of 19
(4,567 Views)
new link
 

Message Edited by sdonah2 on 09-01-2005 05:47 PM

0 Kudos
Message 10 of 19
(4,549 Views)