LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daq 6008 acquire 10 analog signals with external 3 external multiplexer

Hello all,

 

I'm starting enginnering career and the professor asked us to develop an application that acquires multiple analog inputs by means an external mux from texas instruments. So I have developed almost the code but now I have problem in the results I obtain.

 

We have a DAQ 6008, Labview 8 and we are usin 3 Multiplexer from texas instruments so

in the 1st MUX we have 3 analog inputs

2nd MUX we have 4 analog inputs and

in the 3rd MUX we have 3 analog inputs

 

and I have configured the daq as differential lmmeasurement with 4 inputs (3 for the 3 mux and one more for an analog input conected directly)

What I want to do is to acquire each value by commuting the mux from position 0 to position 3 (3/4 inputs per mux) with 2 digital outputs (00 1st input mux, 01 2nd input MUX, 10 3RD INPUT MUX AND 11 STATE FOR THE 4TH INPUT OF THE MUX) and the linearise each value according the sensor where it comes from.

 

sO THE IDEA IS TO ACQUIRE EACH TIME 4 ANALOG INPUTS FROM THE DAQ AND THE COMMUTE THE MUXs to the next state and acquire 4 more inputs and then commute the MUX to the next state and acuire fore more,....sequentially.

 

I have implemented a varaible called Conmux to write in the daq digital outputs the states of the external mux of the mux for this but I have problems with it.

and with the read daq mx also.Please find attached the file .vi to have a look.

 

Please to provide any help regarding this and to advse if i have any programming errors.

 

Thanks in advance.

 

 

0 Kudos
Message 1 of 14
(3,142 Views)
Nothing attached. Please be a little more clear than just 'but I have problems with it'. That describes nothing.

It sounds like you just need a couple of nested for loops. This should be pretty simple.
0 Kudos
Message 2 of 14
(3,131 Views)

@isma86 wrote:

 

 

and I have configured the daq as differential lmmeasurement with 4 inputs (3 for the 3 mux and one more for an analog input conected directly)

 

 

 


I am not sure why you would want to wire the analog inputs directly except as a sanity check.

If you are going to do that, and since the NI USB-6008 has 8 analog inputs, I would wire the 3 for 3 muxs and 3 analog inputs directly (one from each set).

0 Kudos
Message 3 of 14
(3,116 Views)

Hello,

 

to explain you we have the following inputs:

MUX1 FOR VOLTAGES

AI1: 0-10VDC

AI2:0-10VDC

AI3:0-10VDC

CONNECTED MUX1 OUTPUT TO AI1 OF DAQ

 

MUX2 FOR CURRENT CPNVERTED TO VOLTAGE

AI1:0-10VDC

AI2:0-10VDC

AI3: 0-10VDC

AI4:0-10VDC

CONNECTED MUX2 TO AI2 OF DAQ

 

MUX3 FOR TEMP. SENSORS

AI1:0-5VDC

AI2:0-5VDC

AI3:0-5VDC

CONNECTED MUX3 TO AI3 OF DAQ

 

AC VOLTAGE (ANOTHER METER) CONNECTED TO AI4 OF DAQ

 

BECAUSE I HAVE AC AND DC VOLTAGE I CONFIGURED DAQ ACQUISITION AS DIFFERENTIAL, AM I RIGHT DOING THIS?

 

SORRY BUT I COULD NOT UPLOAD MY .VI FILE BECUASE OF AN ERROR IN THE WEBSITE.

COULD I SEND IT TO YOU BY MAIL?

 

THANK YOU FOR YOUR ADVISE.

 

 

0 Kudos
Message 4 of 14
(3,092 Views)

Hello,

 

to explain you we have the following inputs:

MUX1 FOR VOLTAGES

AI1: 0-10VDC

AI2:0-10VDC

AI3:0-10VDC

CONNECTED MUX1 OUTPUT TO AI1 OF DAQ

 

MUX2 FOR CURRENT CPNVERTED TO VOLTAGE

AI1:0-10VDC

AI2:0-10VDC

AI3: 0-10VDC

AI4:0-10VDC

CONNECTED MUX2 TO AI2 OF DAQ

 

MUX3 FOR TEMP. SENSORS

AI1:0-5VDC

AI2:0-5VDC

AI3:0-5VDC

CONNECTED MUX3 TO AI3 OF DAQ

 

AC VOLTAGE (ANOTHER METER) CONNECTED TO AI4 OF DAQ

 

BECAUSE I HAVE AC AND DC VOLTAGE I CONFIGURED DAQ ACQUISITION AS DIFFERENTIAL, AM I RIGHT DOING THIS?

 

SORRY BUT I COULD NOT UPLOAD MY .VI FILE BECUASE OF AN ERROR IN THE WEBSITE.

COULD I SEND IT TO YOU BY MAIL?

 

THANK YOU FOR YOUR ADVISE.

0 Kudos
Message 5 of 14
(3,089 Views)

I see no reason to configure the inputs as differential. You are not providing any signals to the inverting inputs and the signal sources all appear to be single-ended.

 

Since you are a student: Lesson one - learn the difference between single-ended and differential signals.

 

Whether the signal is AC or DC has nothing to do with the configuration of the inputs.

 

Lesson two - learn about the sampling theorem and the Nyquist criterion.

 

Some browsers have problems with attachments. Try compressing your VI into a zip file and attach that.

 

Do the muxes all use the same address value or is each mux addressed separately?  How much time does the system spend at each mux address? What sampling rate are your using?

 

Do you get any errors? If so, what are the error codes and messages?

 

Lynn

0 Kudos
Message 6 of 14
(3,080 Views)

Hello Johnsold,

 

One question if i use RSE configuration the I have to share the same ground for all signals, wether AC or DC?right?

 

Please find attached my program in zip.

All the muxes are commuted with the same signal (Port0:Line0:1) the same time

 

and I think we can use 10ks/s for sampling that it means if we use 4 DIFF signals for example the the DAQ makes 2500samples per second in each channel right and then if each daq ai is connected to 4-input mux does it means for each mux input we have 2500samples/s/4=625samples/s per mux input.

So if I'm right the mux must commut, does it means, I have to activate the digital outputs line0 and line1 each 4milliseconds then I acquire the four ai from daq for the first input of each mux and then i commute to second input of each mux, i spennt 4 millisecond, and the to the next input of each mux....

 Maybe you can have a better idea with the application attached.

 

Looking forward to your advice. Thanks.

 

0 Kudos
Message 7 of 14
(3,059 Views)

Please work through the on-line tutorials for LabVIEW.  Your VI is a real mess.

 

The sequence structure and the local variables are completely unnecessary. In fact some of the local variables keep the program from working. The style guides recommend keeping the size of the block diagram to one screen.  Shift registers are your friend.

 

You have defined the digital task as an output at DAQmx Create Channel.vi. Inside the loop you attempt to write and read with that same task.  Does that generate an error? Well, you probably do not know since you did not wire an error handler VI or indicator to the error outputs.  It appears that you are only reading to get the mux address.  Just use the value that you wrote to the DO lines and eliminate the Digital Read.

 

The Stop button should have mechanical action set to Latch when Released. The terminal should be inside the loop. The way you have the local variable wired the loop will either run forever (stop was false when the loop started) or will stop after one iteration (stop was true when the loop started).  This is basic dataflow - the fundamental paradigm of LabVIEW.

 

Yes, all signals are referenced to the same ground. 

 

Timing calculations: The number of channels used matters. The configuration of the inputs does not. With four channels (single ended or differential) the maximum sampling rate on the USB-6008 will be 2500 S/s per channel.  Your program has a 500 ms wait so the mux will spend 500 ms at each address. So you can get 1250 samples on each iteration if the DAQ Assistant is set that way. However, the mux switching and the analog input run in parallel so you do not know exactly when the switching occurs.  I do not have any idea where you came up with the 4 ms intervals. If you are attempting to switch the muxes after each sample, you are off by a factor of ten. At 2500 S/s samples are taken 400 microseconds apart.  However, the digital outputs are software timed and cannot be switched that fast. Further, OS latencies can introduce much larger delays on occasion (10s of milliseconds or more).

 

Here is what I would suggest. Start with the Nyquist criterion for your AC signal. How fast do you need to sample to get meaningful results?   How many samples do you need to measure whatever parameter of the AC signal is of interest? Those determine the minimum sampling rate and the duration of each sampling interval. Then use a simple state machine to alternate between addressing the mux and reading the analog samples. I did not attempt to implement this in the attached VI because I do not know your signal parameters. I got lots of warnings when I converted the VI to your much older version.  Let me know if you cannot open it.

 

Lynn

0 Kudos
Message 8 of 14
(3,045 Views)

Dear Johnsold,

 

I've reviewed the theory, i think we have in daq 6008 8 rse ai and in diff configuration 4 ainputs: my qestion was if we could share the same ground for ac and dc voltages then we could work as rse having 8 ainputs and using just 3 of them by means muxes, right?

 

For the samplings i think we have 10000samples/s for all ai, in case we have 4 diff signals the rate is  2500 samples/S/channel and in case of 8 rse ai then is 1250samples/s/channel.My question is if we commute the muxes each second, wich sampling rate i have to configure for each channel?

 

Another part of my prject is to generate graphs on demand (by pushbuttton) for 1 hour and one day recording (2 options) and then export the data to an excel file.

Could you check please what I have done untill now and aadvise me for using the pushbutton, the timing (1hour/1day) and wich is the best option for exporting data: i see there is for csv files, for tdms,...

 

Thanks in advance.

0 Kudos
Message 9 of 14
(3,012 Views)

Dear Johnsold,

 

First thank you for the response: i know now how to work with shift registers, Sincerely i dind't find good manuals or maybe it's me that i'm not used to this terminology like channels, lines, ...and so on. If you have good manuals source please advice me.

 

I've reviewed the theory, i think we have in daq 6008 8 rse ai and in diff configuration 4 ainputs: my qestion was if we could share the same ground for ac and dc voltages then we could work as rse having 8 ainputs and using just 3 of them by means muxes, right?

 

For the samplings i think we have 10000samples/s for all ai, in case we have 4 diff signals the rate is  2500 samples/S/channel and in case of 8 rse ai then is 1250samples/s/channel.My question is if we commute the muxes each second, wich sampling rate i have to configure for each channel?

 

Another part of my prject is to generate graphs on demand (by pushbuttton) for 1 hour and one day recording (2 options) and then export the data to an excel file.

Could you check please what I have done untill now and aadvise me for using the pushbutton, the timing (1hour/1day) and wich is the best option for exporting data: i see there is for csv files, for tdms,...

 

Please find attachment.

Thanks in advance.

0 Kudos
Message 10 of 14
(3,010 Views)