Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CompactDaq AI with Visual Basic .NET

I am reading 31 channels with one CompactDAQ chassis and one task.  Our SCXI systems read >60 channels, 100 S/ch, and do it in ~300ms.  I took the same code to read from CompactDAQ, but I had to change the CreateDAQTasks function to create one task per chassis rather than one task per module.  I also took out the autozero mode.  Those are the ONLY changes I made, but I can't get CompactDAQ to read past the first sample.  This is especially odd because before I made a few changes that you guys requested it would at least read every 2 seconds.  I guess I need to try to get back to that point, but I've tried so many samples per channel and  sample rate configurations I have no idea where I was at.  I'm sure you guys test these units in worst case scenarios (32 TC channels) using all software platforms available.  Have you run across this problem?
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 51 of 115
(1,940 Views)
Hi Michael,

I am going to see if I can round-up 8 NI 9211s to try this for myself.  Previously, I have been using simulated devices, but that may not demonstrate the true problem.

I will get back with you on my findings.

Regards,
Erik
0 Kudos
Message 52 of 115
(1,934 Views)
Thank you for your persistence.  I wish I could get back to the state where it would actually read at 0.5 Hz and then start playing from there.  Like I said...now it just reads once and continues to write that data without changing.
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 53 of 115
(1,922 Views)
What is it about this task that won't allow me to read more than once?  I am using finite samples in my normal program (for scxi) and it works fine.

Subroutine attached.


Message Edited by SCXI and MS 2k3-VB.NET on 01-15-2007 10:19 AM

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 54 of 115
(1,919 Views)
If you want to sample continuousy, then it is always suggested to use SampleQuantityMode.ContinuousSamples.  What happens when you change the code above to Continuous?


I wish I could get back to the state where it would actually read at 0.5 Hz and then start playing from there.
Isn't your old code linked to this Discussion Forum?  You could retrieve it from a previous page.  It may take some time to find eight 9211s, but I'll let you know when I do.

Regards,
Erik





0 Kudos
Message 55 of 115
(1,906 Views)
Continuous reads the first time I read data, but it will not throw any errors or read new data after that.  I changed the program so that one button would read the channels, one would create the task, one would create the file, one would read data, and one would write data.  I also timed these processes in ms.  I'd start by pressing the first three, then I would press 4 5 4 5 4 5 4 5, but the data was all the same.

They shut the Institute down today, but I will work on this as soon as I am back.  I'll revert back to the old code on the forum and look for the differences.
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 56 of 115
(1,903 Views)
Hey Michael,

I had a light bulb appear over my head early this afternoon.  The task above might not run more than once because the samples per channel input on a Finite task sets the total amount of samples that will be acquired for the entire duration of the task.  Your first call to read these samples may read them all and therefore, there are no more samples on the buffer so the task stops.

If the sampling mode is set to Continuous, samples will continuously be placed on the PC buffer and the task will keep running.  The samples per channel input in the configure clock method sets the buffer size.

If your code was reading continuously, but the task was set up as Finite, then the task would have to stop and restart for you to acquire any more samples than specified by the samples per channel input.  This may be why the acquisition with your code seemed to be going slow, Finite will not allow a single task to acquire continuously so it was starting and stopping multiple tasks.  I would strongly suggest using Continuous as your acquisition mode and debugging from there.  If you find that you keep running into the buffer overflow error, then you can set a property to allow unread samples on the buffer to be overwritten.

We just opened this afternoon but there's still a lot of ice around.  I hope it goes away soon!

Regards,
Erik

0 Kudos
Message 57 of 115
(1,885 Views)
I've been checking into this again.  I reverted back to a previous version, and I can almost get 1 Hz data only when reading one sample per channel.  I've attached the data file to this post.  The very right most column shows the delta t, which moves between 500-1500 ms.  This is unacceptable.  I'll paste the task creation in the next post.  Have you had any luck on your end?

Some things to note:

Sample Rate: 100 S/s
Number of Samples per Channel: 1
Sample Type: FiniteSamples
ColdJunction: 25 C
AutoZero: None


Message Edited by SCXI and MS 2k3-VB.NET on 01-18-2007 03:36 PM

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 58 of 115
(1,876 Views)
    Public Sub CreateDAQTasks()
            While ChannelCount < numChannels
                While AIChannels(ChannelCount).Device = Device
                    TasksChannelCount(TaskCount) += 1

                    With AIChannels(ChannelCount)
                                Tasks(TaskCount).AIChannels.CreateThermocoupleChannel(.Device & "/" & _
                                                .Channel, Trim(.Name), .Min, .Max, AIThermocoupleType.K, _
                                                AITemperatureUnits.DegreesC, 25)
                                Tasks(TaskCount).AIChannels(.Name).AutoZeroMode = AIAutoZeroMode.None
                                If Not .Device.Contains("cDAQ") Then
                                    Tasks(TaskCount).AIChannels(.Name).LowpassEnable = True
                                    Tasks(TaskCount).AIChannels(.Name).LowpassCutoffFrequency = 4
                                End If
                    End With
                    ChannelCount += 1
                    If ChannelCount = numChannels + 1 Then Exit While
                    If AIChannels(0).Device.Contains("cDAQ") Then
                        Device = AIChannels(ChannelCount).Device
                    End If
                End While
                ' Tell the task to take 100 readings of each channel at 10 kS/sec on the rising edge of the clock.
                Tasks(TaskCount).Timing.ConfigureSampleClock("", frm.numSampleRate.Value, SampleClockActiveEdge.Rising, _
                                                             SampleQuantityMode.FiniteSamples, frm.numSamples.Value)
                Tasks(TaskCount).Control(TaskAction.Verify)
                Tasks(TaskCount).Control(TaskAction.Unreserve)
                ' Create a reader object for this task.
                reader(TaskCount) = New AnalogMultiChannelReader(Tasks(TaskCount).Stream)

                TaskCount += 1
                TasksChannelCount(TaskCount) = 0
                Device = AIChannels(ChannelCount).Device
            End While
    End Sub
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 59 of 115
(1,871 Views)
Hi Michael,
 
My name is Salvador Santolucito.  I am the Product Support Engineer for the CompactDAQ product line.  I see that you have been having some issues with your cDAQ and 9211 system.  Since this thread has gone on for so long, could you give me a summary of exactly what you are trying to accomplish?  Once I know what you want to do, I can help you figure out the best way to do it with cDAQ.
 
Thanks,
Sal
 
 
0 Kudos
Message 60 of 115
(1,846 Views)