Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

change detect on digital port

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.

0 Kudos
Message 1 of 6
(4,227 Views)

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.   

 

0 Kudos
Message 2 of 6
(4,200 Views)

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.

 

0 Kudos
Message 3 of 6
(4,191 Views)

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.

0 Kudos
Message 4 of 6
(4,182 Views)
Eric Lee, an Applications Engineer with NI told me that he setup a physical 6509 and it worked correctly. He setup a simulated 6509 and it worked the same way as I experienced. He said that he reported the situation to the R&D team for further analysis.
 
0 Kudos
Message 5 of 6
(4,181 Views)

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.

0 Kudos
Message 6 of 6
(4,162 Views)