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.