08-17-2005 03:50 PM
I installed a simulated NI-6509 for testing purposes. I used the following code to configure a change detection task for port 0.
myTask = New Task("DItask")
'Create channel
myTask.DIChannels.CreateChannel("dev4/port0/line7, "myChannel", ChannelLineGrouping.OneChannelForEachLine)
myTask.Timing.ConfigureChangeDetection( "dev4/port0/line7, "", SampleQuantityMode.ContinuousSamples, 10)
myDigitalReader = New DigitalSingleChannelReader(myTask.Stream)
myDigitalReader.SynchronizingObject = Me taskRunning = True myDigitalReader.BeginReadSingleSampleMultiLine(New AsyncCallback(AddressOf OnDataReady), Nothing)
It appears as though an event is generated every time any line of port 0 changes, not just line 7. I have tried SampleQuantityMode.ContinuousSamples and SampleQuantityMode.FiniteSamples. They both behave in the same fashion, as far as generating events anyway. I have tried ChannelLineGrouping.OneChannelForEachLine and ChannelLineGrouping.OneChannelForAllLines. They also appear to behave the same way in generating events for changes in any line on the selected port, instead of changes only in the selected lines.
Is this they way the hardware and software is intended to behave?
It would seem to me that it would be more appropriate if an event was generated only when line 7, or whichever lines are selected, changed state.
08-18-2005 05:47 PM
Hi,
You will be able to use change detection to capture the port data based on the change of a single line. I took a look at the code you posted and I think that you are currently using the correct functions to do this.
Try substituting the following line of code in your program:
mytask.timing.ConfigureChangeDetection("dev4/port0/line7","dev4/port0/line7",SampleQuantityMode.ContinuousSamples ,10)
It will enable change detection for the rising and falling edges for Dev4/Port0/Line7. Also, please make sure that all quotations are closed after being open.
Regards,
Hal L.
08-19-2005 10:30 AM
Thanks to Hal for the reply. However I have tried the code line suggested as well as several other modifications of the same code.
No matter how I construct the call, an event is generated for any change on any line of the selected port. I even tried other ports thinking that maybe port 0 might behave differently than the other ports. However, they all behave the same.
Maybe it has to do with the fact that I am using a simulated device instead of an actual physical device.
Anyway, I have submitted a request to the technical team and they have responded that they will install a 6509 and test it. I will let you know wahtever I find.
08-22-2005 10:53 AM
Hello,
With NI-DAQmx Simulated Devices, all timing and triggering occurs instantaneously. Because there is no physical connection for triggering (or change detection in this case), it cannot be simulated.
Let me know the results of your 6509 testing.
Regards,
Sean C.
08-22-2005 11:50 AM
08-23-2005 05:14 PM
Hello,
Because change detection is essentially triggering, it doesn't realy make sense to "trigger" off of a nonexistant signal with a simulated device. This feature will work with a USB-6509, however.
Regards,
Sean C.