LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

waveform chart x axis

Hello,

 

I am currently writing a labview script to take in current/voltage data from the NI-USB 6008 device and outputting it to a waveform chart and binary file. Unfortunately I am having trouble changing the X-axis scale on my chart as well as getting the chart to continuously record data while updating the minimum value on my x-axis.  I have attached my script. 

 

Thanks,

 

Mmoon 

0 Kudos
Message 1 of 10
(3,963 Views)

You are appending waveforms to each other in your While Loop, then passing that to a waveform chart.  The only problem is that a waveform chart already keeps a history of what it has received.  So you waveform chart is going to have data that looks like 1.   1 1 2.   1 1 2 1 2 3.   1 1 2 1 2 3 1 2 3 4.   Just send the waveforms to the WF chart and they'll show up as 1 2 3 4

0 Kudos
Message 2 of 10
(3,959 Views)

Hello RavensFan,

 

(I go to school in Baltimore). I tried this but now my graph is acting very strange, I have attached the updated code and a screenshot of the graph.

 

Mmoon

 

 

Download All
0 Kudos
Message 3 of 10
(3,956 Views)

Great!.  Which school?

 

Try the attached.  I simplified it a bit.  The conversions through the dynamic datatype don't help anything.   Also, the waveform data has the t0 built in, so I'm not sure if some of your problems are coming from manipulating that.

 

I see you are acquiring 512 samples.  What is your acquisition rate?

 

One other possibility is that if the act of writing the data to the file is taking longer than it should, you could wind up with the problem of not keeping up, and the DAQ buffer overflowing and giving errors.

 

If that seems to happen, take out the file writing part and try it.  Make sure the chart looks okay.  We can add the file writing back in using queues and the producer/consumer architecture.

0 Kudos
Message 4 of 10
(3,948 Views)

Hopkins.

 

Unfortunately the revised code is not updating the minimum as it records data . The data acquisition is also running uncharacteristically slow. My acquisition rate is 1k Hz. I attempted to take out the file writing i/o to see if it would make the program run more smoothly, but it didn't make any noticeable difference.

 

Mmoon

0 Kudos
Message 5 of 10
(3,937 Views)

UMBC for me.  I got into Hopkins, but it was too expensive.

 

Make sure you have timing set up with the sample clock so that it is set to run continuous samples.  I don't see anything like thaa on the diagram, but perhaps it is built into the DAQmx task.  If it is starting and stopping the acquisition on every iteration, that would cause gaps.

 

I'm not sure what you mean by "updating the minimum".    I feel like you are talking about the T0 time since you are setting that in mulitple places in your VI.  But T0 should be created as part of the waveform when the DAQ read runs.

 

As the waveform chart fills up, it will push old data off the left edge of the chart.  If you need to show more data, then you can increase the chart history length.

0 Kudos
Message 6 of 10
(3,931 Views)

The tuition is really ridiculous unfortunately.

 

I have my DAQ-mx channel configured to run continuous samples.

 

Ok that makes sense then. I am still confused on how to get my program to acquire samples as a faster rate. Nothing seems to be working.

 

Mmoon

0 Kudos
Message 7 of 10
(3,924 Views)

Concentrate on the data acquisition to start.

 

Set up a simple loop with the DAQ assistant and a waveform chart.  Make sure that can run as fast as you want it to.

If that is working, right click on the DAQ assistant. There are a couple of choices there such as Open Front Panel which converts it to regular LabVIEW code.  But I think there is also another create code option there.  Whichever works, see if you can get a working DAQ assistant converted to working regular LabVIEW code.

 

Also look in the Example finder for examples of DAQmx data acquisition code.  Something in there should get you set up.

 

Once you know you can get the data acquisition working as fast as you need, adding the file logging won't be a problem.

0 Kudos
Message 8 of 10
(3,918 Views)

I have managed to get my acquisition working correctly. But I am still struggling to figure out how to get my waveform chart to update the x axis as more data is being processed, as opposed to keeping all of the read data on the graph. Do you have any idea how to adjust the chart?

 

I have been seeing if switching between the different update mode options but havent had any luck.

 

 

Mmoon

0 Kudos
Message 9 of 10
(3,890 Views)

I don't understand where you are having problems.

 

Try running the attached VI.  I stripped it down to the simplest acquisition.  I don't have a DAQ device installed, so I created a simulated on in MAX.  Then I created a task set for continuous samples at 1kHz.  A screenshot of the MAX screen is saved in there.

 

When I run this, I have no problems with it keeping up.  Roughly every half second a new set of data is added to the chart.  (I fixed your X-axis to show abssolute time.)

 

One thing I did notice when I opened up your earlier VI is that it said there were changes based on being recompiled and coming from a different OS or platform.  What kind of PC do you have?

 

See if this runs quickly on your PC.  If it doesn't, then you have some sort of hardware problem that I can't help with.

 

EDIT:  Can you also try deleting the chart and placing a new waveform chart.  The more I ran the VI I started seeing a lot of graphic oddities after about a minute.  When I  put in a new waveform chart, it ran a lot smoother  Maybe that was because the update mode on your is a scope chart and a typical waveform chart is strip mode.  Maybe its a bug in LabVIEW in that display mode and it is the issue you are seeing.

0 Kudos
Message 10 of 10
(3,881 Views)