LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiplexing timing and control

Hello,
 
I have been working on a group project in which we use a 16-channel biopotential amplifier with built-in multiplexing. The amplifier has 16 analog inputs, 1 analog output, and 4 digital inputs that control the multiplexing. We were told that we could control the multiplexing using LabView so that we could "tell" the amplifier which channel we want to view. We also would like to be able to view this data as close as possible to real time and at a sampling rate of about 1000 samples/sec per channel.
 
Our current approach has been to generate a digital pulse wave on four of the digital output channels of our DAQ board. These pulse waves would be used to "turn on/off" our 16 channels, so we would have to adjust their respective frequencies. We would like to be able to cycle through each of the 16 channels repeatedly. We have tried to combine two example vi's: Gen Dig Pulse Train-Continuous.vi and Cont Write Dig-Port-Ext-Clk.vi. However, we have been having trouble with assigning physical channels and creating the proper tasks.
 
Currently we are using LabView 7.1 and the USB-6221 DAQ board. We purchased the 6221 board to use its timing capabilities but we are not entirely sure how to access them.
 
Any help or advice is greatly appreciated!
 
Thank you very much,
 
Monica
0 Kudos
Message 1 of 7
(3,557 Views)

Hi Monica,

It sounds like you are on the right track with combining those two examples. The Digital Output Task in the Cont Write Dig-Port-Ext-Clk.vi example is configured to be a continuous hardware timed digital output. You must provide an external sample clock to time this output however. This is where the Counter Output task comes in.  The Gen Dig Pulse Train-Continuous.vi shows you how to setup a counter to generate a clock for you. This clock can be used to time the Digital output task.  Here are some important things to remember when setting this up.

  • With the USB-6221 you must use Port 0 for the digital output in this case. This is the only port that supports hardware timed output
  • The clock source for the digital output task will be the counters internal output. So if you use ctr0 for your counter output task then the clock source will be “Dev1/ctr0internaloutput”. Where Dev1 is the name of your USB-6221. If this option is not listed in the front panel control then right click on the control and select “I/O Name Filtering…” Check the “Included Advanced Terminals” box and hit OK. The counter internal output should now be listed in the control.

  • I would recommend starting the counter task first and then starting the Digital output task. This can be accomplished by wiring the error line so that the counters start task executes first.

Please let me know if you have any questions and take care.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 2 of 7
(3,533 Views)
Hello,

Thank you very much for your help earlier. We have gotten the digital output to work, but now we're stuck on how to record voltages.
We want to be able to record the single analog input that contains the multiplexed signal onto 16 separate waveforms that would correspond to each channel from the amplifier.
Any suggestions on how we can do this?

We have tried looking at Cont Acq&Graph Voltage-Ext Clk.vi as well as the Queue Multiplexer.vi, but had no success.

Thank you again for your help,
Anna
0 Kudos
Message 3 of 7
(3,480 Views)

Hi Anna,

The best way to do this will depend on the rate you are trying to acquire at and how the data will need to be split up. How quickly are you scanning through the 16 amplifier channels? Do you need to have more than one sample from each channel before it moves on to the next and if so how many samples? It would be best to make the sampling rate of the analog input task a multiple of the digital task’s sampling rate. If you just need one sample per amplifier channel for each pass of the digital task then you could use the same clock driving the digital output task for the analog input sample clock. If you do this I would make the digital task change on the rising edge of the clock and the analog input task on the falling edge. This way you have half a period for the digital lines to change and the amplifier to settle before the sample is taken.  I would recommend reading the data as an array instead of a waveform if you do not need the timestamp information in the waveform. This is because it will be easier to split up as an array. You can then use the Decimate 1D Array to split the array up into 16 parts.  Let me know if you have any questions.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 4 of 7
(3,462 Views)
Hello Nathan,
Thank you for your prompt reply.
We are aiming to sample each channel at 1000Hz. We also do need the timestamp information because we are using the program to record cardiac biopotentials and it is important to know voltage vs. time for data analysis. As long as the sample frequency for each channel is 1000Hz it should be possible to only take one sample before moving on to the next. The amplifier can MUX up to 30KHz and needs at least 1us per channel to settle.
Using the Cont Acq&Graph Voltage-Ext Clk.vi we have set up the virtual AI Input as our Dev1/ai0 and the sample clock as the same Dev1/ctr0internaloutput used to time the digital portion. We are not sure, however, how or where to split up the data into separate waveforms. Is it possible to split up the waveform? You suggested it would be easier using an array. Is it possible to make a 2D array with voltage and time and then split that? Also, I'm unsure how to designate that each falling edge of the ctr output directs the recording to a different graph. Would this just require putting the recording portion of the code into a loop that iterates after every 16 samples?
Once again, thank you very much for your help!
Anna
0 Kudos
Message 5 of 7
(3,443 Views)

Hey Anna,

You can specify which edge of the sample clock the digital output and analog input tasks use by setting the “active edge” terminal of the DAQmx Timing VI for each task. You can set the active edge to either rising or falling. Since you need the time stamp data from the waveforms it can be a little complicated splitting the waveforms up correctly. I’ve attached a VI I wrote that does this. You can use this as a subVI. Pass your waveform into it and wire the number of channels you have to the “# of Decimated Waveforms”. In your case this should be 16. The output will then be an array of 16 waveforms, one for each of your amplifier channels. Make sure the number of samples in your original waveform is a multiple of 16. You can do this by setting the “Samples to Read” terminal of your DAQmx Read Vi to a multiple of 16 also.  Let me know if you have any questions.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 6 of 7
(3,418 Views)

Hello Monica

Now, I have the same project to deal with multiplexer using labview. Would you please provide your Vi? I think this will help to solve the problem.

Thank you very much!

 

gjhtim

 

0 Kudos
Message 7 of 7
(2,692 Views)