LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Voltage vs. Time help

Hello,

 

I'm new to labview and was wondering if I could get some help or be pointed in the right direction.  I'm trying to do a voltage vs. time plot and have the data also save to excel.

 

The hardware I'm running:

 

I have a mac computer, I'm using the usb-6009 daq device, and the data (fluorescence light) is captured from Hamamtsu PMT h7732

I'm currently running Labview 8.6 and have daqmx base 3.2

 

So far I have some the following vi, not sure if I have done much right.

 

 

Appreciate the help, thanks 

0 Kudos
Message 1 of 16
(6,184 Views)

Hi Solis,

 

First of all it's good to put some time delay (such as 50ms) within your while loop so you can free your processor to do other things also. Don't use a delay only when you have to go as fast as possible but especially when you write those values to a file is good to have some timing.

 

Second i assume that when you say time you want to display on the graph and save on the Excel file the time in seconds since you start acquiring data (please let me know if not).

 

So what i did i modified your VI to do that. The VI below will build a 2-D array first column will be time in seconds and second column will be your voltage amplitude and write it ti an Excel file (note that i have change your filename and added a .xls extension so you can open it straight away with excel). I have used a shift register so i can add 50/1000 (0.05sec) every time the loop iterates to get the time correct.

 

To convert the Axis of the graph to show time (in seconds) i have used a Waveform Chart and on the Properties--->Scales--->Time(X-Axis)----> i have changed the Multiplier to 0.05 (because my loop timing is 50ms) and that will be enough.

 

If you have any problem let us know

 

Have fun.

 

Dimitrios

 

 

0 Kudos
Message 2 of 16
(6,162 Views)

The proposed modification is, unfortunately, flawed. It's dependent on software timing and assumes the loop will iterate every 50 msec. This cannot be guaranteed on any non-real-time operating system. Thus, the actual time entries will not be correct. Also, the method for building the 2D array is flawed. The single time entry is being built into a 1-element array. But the data is not necessarily a 1-element array. This means that when the 2D array is created, the time entries will be filled out with zeros:

 

 

As for the question itself: Have you taken a look at the examples that ship with DAQmx? There are numerous examples and there are several that do precisely what you want to do. 

Message Edited by smercurio_fc on 04-26-2010 09:55 AM
Message 3 of 16
(6,149 Views)

The truth is that i have run into problems doing that in the past with not accurate timing. If the code is small and the application is not critical that would usually give me acceptable results thought.

 

I used timed-loops to get around that problem once but i am sure there is a better way of doing it and i would like to know that for the future also.

 

Dimitrios

0 Kudos
Message 4 of 16
(6,137 Views)

Hello,

 

Thank you for the suggestions thus far.  I have been researching a little on my own.  As previously stated, I am using a MAC so I only have use of DAQmxbase.  So far I have been able to come up with this.  I am testing my data using a power supply connected to the USB-6009.  

 

What I want to have is a continuous plot of voltage vs change in time, but right now I'm getting a single reading continuously without it plotting time.  Also, in the test, the power supply is supplying 2.4v but the graph is reading 1v, is there a reason for this?  Lastly, I want to try to export the data into an excel file, if you can show me how to do this, that would be great.

 

Also, I am creating an analog input task using mxbaseconfig. 

 

Thanks for the help, I really appreciate it

 

My file:

 

0 Kudos
Message 5 of 16
(6,097 Views)

Still having trouble on this.  For some reason when I run the program, the graph starts at -1.3V even though my power supply is not even on yet, what would be the reason for this?  

 

I also cannot figure out how to do a continuous plot of voltage change over time, right now I just have the chart showing the voltage it's currently at.  Thanks for the help 

0 Kudos
Message 6 of 16
(6,053 Views)
How do you have the power supply wired to the DAQ device.  A -1.3 V reading sounds like you don't have a common ground plane and have a 1.3 V differential between the common or ground of the DAQ card and the power supply.
0 Kudos
Message 7 of 16
(6,042 Views)

I have the common from the power supply hooked in GND on the DAQ device, and the +6V to the ai0 on the DAQ.  Do I not need the common wire?

 

 

0 Kudos
Message 8 of 16
(6,039 Views)

You do need the common wire.  The next question is how do you have the task setup.  Is it setup for a Referenced, Single Ended channel?

0 Kudos
Message 9 of 16
(6,031 Views)
Using DAQmx Base Task Configuration Utility, I made an Analog Input Voltage Task with Coupling set to Single and Task Timing Continuous
0 Kudos
Message 10 of 16
(6,024 Views)