Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQ-6229 Speed With VB.NET

I'm using a Ni-DAQ 6229 Card and programing it via VB.NET 2005 but am having a speed issue.

The Main Setup (Not showing Everything)
[code]
    Public AbortOut As DigitalSingleChannelWriter
    Public Red_in As DigitalMultiChannelReader
    Public Abort_Out As Task
    Public Ready_In As Task
    Public RNull as boolean
sub setup()
        Abort_Out = New Task("AbortControl")
        Ready_In = New Task("ReadyLine_IN")
        Abort_Out.DOChannels.CreateChannel("DAQ_01/port1/line1", "Abort_Out", ChannelLineGrouping.OneChannelForEachLine)
        Ready_In.DIChannels.CreateChannel("DAQ_01/port1/line3", "Ready_In", ChannelLineGrouping.OneChannelForEachLine)
        Red_in = New DigitalMultiChannelReader(Ready_In.Stream)
        AbortOut = New DigitalSingleChannelWriter(Abort_Out.Stream)
end sub

Sub TimeTest()
        AbortOut.WriteSingleSampleSingleLine(True, (1))
        RNull = Red_in.ReadSingleSampleSingleLine(0)
        AbortOut.WriteSingleSampleSingleLine(True, (0))
        RNull = Red_in.ReadSingleSampleSingleLine(0)
End Sub

private sub Button1_click
        TS = (Now.Minute * 60 + Now.Second) * 1000 + Now.Millisecond
        For I = 1 To 10000
            TimeTest()
            'TestStatus.Value = I / 40
        Next
        TE = (Now.Minute * 60 + Now.Second) * 1000 + Now.Millisecond
        MsgBox(Str(TE - TS))
end sub
[/code]

The timing is quite slow though (Running on a vista Box with 4 Gig of Ram / AMD 64X2 4600

Loop Value 10,000

No Sets / Reads       = 3-5 ms
No Sets / 1 Read      = 1856 ms
No Sets / 2 Reads    = 3543 ms
1 Set / No Reads      = 2097 ms
2 sets / no reads      = 4021 ms
2 Sets / 2 Reads      = 7561 ms

My Question is how can I speed up the Writing to the Digital Port & The Reading of the Port so that it's faster than 0.18ms per read & 0.2ms per write ?

I'm using it for controlling an external device, and it has to watch the digital lines to go high to start it's test, and returns on the read line when the test is finished.
0 Kudos
Message 1 of 4
(3,141 Views)
Hello Everyone,

This customer has contacted National Instruments for support.  We will post the final solution once the issue has been resolved.

Regards,
Daniel S.
National Instruments
0 Kudos
Message 2 of 4
(3,119 Views)
When I add this change, I get a speed up, but not enough.

private sub Button1_click
        Trigger_Out.Start()
        Abort_Out.Start()
        For I = 1 To 10000
            TimeTest()
        Next
        Trigger_Out.Stop()
        Abort_Out.Stop()
end sub

But when I add this change, the systems get out of sync, and it appears as though it's getting false readings.
But only when I "Start" the reading (Ready_In / Trigger_In) Functions.
If I don't "start" them, and just use the read function (that starts & stops the channel each time it's called) then the two systems stay in sync.

private sub Button1_click
        Trigger_Out.Start()
        Abort_Out.Start()
        Trigger_In.Start()
        Ready_In.Start()
        For I = 1 To 10000
            TimeTest()
        Next
        Trigger_In.Start()
        Ready_In.Start()
        Trigger_Out.Start()
        Abort_Out.Start()
end sub
0 Kudos
Message 3 of 4
(3,107 Views)
Ok, that spead it up, the DAQ software was actually getting ahead of the Keitley TSP Script.
Thanks, the Start / Stop commands helped.
 
0 Kudos
Message 4 of 4
(3,103 Views)