Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get 6008 counter to work with DAQmx 8.0 in VB.NET app

Using DAQmx 8.0 with my VB.NET 1.1 app, I can't get the 6008 counter to work.
 
Stepping through the following code in VisStudio (loosely based on the CountDigEvents example), I noticed that PFI0 stays high all the time, so obviously the counter never gets incremented.  But shouldn't PFI0 go low once my task defines it as a counter-input channel?  Or am I not using the correct line/channel?
 
There is no section about the 6008 in the Device Considerations section of the Help, so I'm just assuming that I should use PFI0 and "Dev1/Ctr0" 
 
Dim ciTask As NationalInstruments.DAQmx.Task ' counter input task
 
ciTask = New NationalInstruments.DAQmx.Task

ciTask.CIChannels.CreateCountEdgesChannel("Dev1/Ctr0", "Count Edges", _

NationalInstruments.DAQmx.CICountEdgesActiveEdge.Falling, _

Convert.ToInt64("1"), _

NationalInstruments.DAQmx.CICountEdgesCountDirection.Up)

Dim counterReader = New NationalInstruments.DAQmx.CounterReader(ciTask.Stream)

ciTask.Start()

Dim count As UInt32

Do

     count = counterReader.ReadSingleSampleUInt32()

Loop

0 Kudos
Message 1 of 2
(2,899 Views)
Are you inputting a pulse into PFI0?  The fact that you create a task for event counting doesn't necessarily guarantee that the input/source pin (PFI0) of the counter will automatically go low.  You should be connecting an input signal that you want to perform event counting on into PFI0.  First, I would test the functionality of the counter input through the event counting in the MAX test panel.  If you transition the signal on this line from high to low a few times and you are seeing that the count doesn't increment, there may be a problem with the connections or device itself.

Thaison V
0 Kudos
Message 2 of 2
(2,883 Views)