Jump to content

Analog data aquisition


Minis

Recommended Posts

Hello,

I am very new to Labview and i have to make a program for DaqPad 6020e to read two analog input channels.

So far what ever i did using standard VI i could not get both of the channels read. I used AI-config, AI-Start and AI-read.

It does read one channel without any problems however when i try to make similar program for second channel i get transfer error. I suspect that i cannot use two instances of AI-config and other related VI's.

I have also tried to use other functions such as AI-wave and AI-cont, however those seem to record data in buffer size portions and i get some data missing or something that i do not currently understand.

My task is to measure two channels and save every measurement into file. One data channel is related to the other and i need to see how they change relative to each other.

I would appreciate any pointers what should i explore or how should i try to solve the problem.

Thanks!

Link to comment

Crelf,

Thanks for the reply. I am trying to attach code and screenshot of the program that i used. The part for channel AnCH2 is what i essentially need and that part works until i add the other part for channel AnCH3. When i add that part it stops working. I would really appreciate any comments.

George,

Thanks for the reply. I did look at the examples and learned alot from them. However the examples that i have usually deal with simulated inputs and they are too complex for me to understand at this point.

post-16909-126202508299_thumb.jpg

new_MR_aquisition_program_two_channels.vi

Link to comment

If I'm seeing this properly, you're doing a point-read for AnCH2 and a buffered-read for AnCH3 (or maybe vice versa?) - is there a reason for this? Either way, it looks like you're mixing channel-based and task-based paradigms.

You're using Build Arrays on all the channel terminals - have you tried putting AnCH2 and AnCH3 in an array together, passing that into your Config/Wave VIs and seeing what is spat back out?

And maybe most important - wire your error terminals together!

Link to comment

Hi, Asbo,

Thanks for the reply. I am not aware about the difference in paradigms. I am absolute newbie in LabView and learned it only from help, which does not delve into paradigms at all (or at least i did not find that part yet). The program that i posted is just one instance of what i have tried. I did try to read both channels using AI-wave and both channels using trio of AI-config, start and read, neither gave me good result.

I think i tried to built an array of two channels into an array, but i think that i gave me an error of type mismatch which i could not resolve.

What would error terminal connection give me? sorry but i really did not see the point of that.

thanks again for your time.

Link to comment

Hi, Asbo,

Thanks for the reply. I am not aware about the difference in paradigms. I am absolute newbie in LabView and learned it only from help, which does not delve into paradigms at all (or at least i did not find that part yet). The program that i posted is just one instance of what i have tried. I did try to read both channels using AI-wave and both channels using trio of AI-config, start and read, neither gave me good result.

I think i tried to built an array of two channels into an array, but i think that i gave me an error of type mismatch which i could not resolve.

What would error terminal connection give me? sorry but i really did not see the point of that.

thanks again for your time.

This NI article might delineate the two for you. Again, that there are two different paradigms available is just my presumption from looking at your block diagram.

You really ought to be googling something like "labview DaqPad 6020e example". Also, here are some caveats of the DAQPad-6020E.

You can read a lot about error terminals on the LabVIEW Wiki. In a nutshell, writing code without error handling is like driving at night without headlights - you may pull it off, but it's a really bad idea.

Link to comment

Hello again,

Just wanted to share that i solved my problem for now and put the program for any other newbie like me to see how is it done.

My first frustration was that i could not easily duplicate VI's and get two channels read at the same time. All examples or programs that i looked at (more than 20 pages of google search and several manuals) were detailing one channel input without much discussion how to go to multiple channels.

Asbo's hint to put both analog inputs into a build array helped to get both channels read at the same time by the same AI-Read VI, which was essential. I was sure that i have tried that before but apparently did something wrong and could not remember. So i tried it again and it worked fine this time.

Thanks for your help !

post-16909-126209586014_thumb.jpg

post-16909-126209586937_thumb.jpg

new_MR_aquisition_program_one_channel.vi

Link to comment

Here are a few suggestions for cleaning up your block diagram and inmplementing some error handling (if an error occurs, the loop will stop and then report the error to the user).

Sorry - I don't have NI-DAQ installed, so those VIs aren't found (hence the "?" subVIs). Also, is there a reason that you're using NI-DAQ and not the newer and awesomer NI-DAQmx?

post-181-126210352055_thumb.gif

Link to comment

Hi, Crelf,

thanks for the block diagram. I just have one question - why do you have that clock inside the loop ?

I do use NI-DAQ instead NI-DAQmx because of limitations of that traditional DaqPad that we have. I think that there is no way that it can be programmed using NI-DAQmx, well at least i did not find anything. In fact i am not a programmer i just know a little bit of many things that help me in my materials related research and sometimes i come upon some problems that i cannot stand standard software and i write my own simple programs.

While i was testing my program i found that the file format that save wave as a spreadsheet does not work the way i want. It's not a big deal, but do you or anybody knows the way that i could split those waveforms that are coupled in one array into two separate waveforms or at least two separate arrays of Y values. Because i find that my very first attempt to write Y values into data file was better.

thanks again, it was very helpful to hear some thoughts.

Asbo, i think you have a valid point i need to look for that in the manual :) (again)

Link to comment
why do you have that clock inside the loop ?

It's kind-of a habit of mine - there are occasions when a loop without a sleep can take control of the thread execution engine in Windows, and essentially lock it - adding a 0ms wait sends an explicit message to the thread execution engine that it's okay to sleep this thread if needed. As you can imagine, there are situations where you wouldn't want the 0ms wait in there, but, as I said, it's a habit of mine. Read more here.

I do use NI-DAQ instead NI-DAQmx because of limitations of that traditional DaqPad that we have.

Oh - of course - you're right: the old DAQPads aren't supported under DAQmx.

While i was testing my program i found that the file format that save wave as a spreadsheet does not work the way i want. It's not a big deal, but do you or anybody knows the way that i could split those waveforms that are coupled in one array into two separate waveforms or at least two separate arrays of Y values.

The output of the NI-DAQ subVI in the loop is an array of signals - you could use index array to split it into two separate wires...

thanks again, it was very helpful to hear some thoughts.

Hey - that's what LAVA's here for wink.gif

Link to comment
I just wanted to point out it is very important to clear the data acquisition task after you use it. This frees up the task and prevents memory leaks. post-8614-126218190236_thumb.jpg
Good point Dan, although I wouldn't pass the NI-DAQ reference wire under the error handler lest it looks like the error handler uses it. Actually, I'd put the error handler at the end in this case (swap the AI-Clear and Simple Error Handler).
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.