Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read a pulsed input on an SCB-68 counter channel?

Hello all, I have been searching through the DAQ help and this board for a few hours now and I cannot find an answer that addresses what should be a simple problem. Let's start with hardware and software: I have a 6062E PCMCIA DAQmx card connected to a SCB-68 (E Series) connector block. I am running Version 7.1.0.306 of Measurement Studio for Visual Studio .NET and am coding in C#. So please, no LabView answers.

I am trying to read the pulsed output of the Omega HHT-1501 Digital Tachometer - it outputs a TTL LOW pulse every time the sensor is triggered, I would like to read in these pulses and  get the frequency to determine RPMs.  As far as I can tell I need to connect the pulsed signal line to CTR0, which is PFI9/GPCTR0_GATE on the connector block, pin #3. I have verified that the tachometer is indeed pulsing correctly. I have used the DAQ Assistant to create a DAQmx task to acquire the frequency of a digital signal using the 1 Counter Low Frequency Measurement method, input range is set from 1Hz to 1KHz, starting edge is set to falling. For Task Timing the Acquisition Mode is Continuous, Samples to Read = 100.

When I run the test I get no response. And it also seems that the GPCTR0_GATE is always at +5V. I have tried just about every other combination of inputs, including using CTR1 on GPCTR1_GATE, pin 41, all with the same result - no signal read.
So what is the problem? Every post or help article I have read makes it sound like plug and play to read the pulses but this is not the case - does the counter gate need to be configured as an input in either software or hardware? Am I supposed to have a signal set on the SOURCE, and if so what? And what about my ground line from the pulse source? I have tried attachign that to DGND, still no result, and if I attach the pulse signal gnd to the GPCTR0_SOURCE it causes my tachometer to lock up.

This thread http://forums.ni.com/ni/board/message?board.id=170&message.id=34826&query.id=3937#M34826 seems to be very closely related to what I want to do but is as vague as the help articles - it mentions using one of the two timebases as the source input - what does this mean in terms of code/wiring? Additionally in the NI-DAQmx help article under Device Considerations->Counter Signal Connections->AO/E/S Series it says "The count direction terminal must be tristated to use an external signal. Reset the device to ensure the terminal is tristated" for edge counting. A) Is this related? and B) how does one tristate by reset? Power cycling the scb-68 has no apparent effect on anything.

I would appreciate any help on this matter, hopefully with as much detail as possible since the help manuals seem to be mostly useless for guiding one in performing any task.

Thanks!
                   J. Slater

0 Kudos
Message 1 of 10
(6,131 Views)

Hello J Slater,

Lets take the software out of it. Go into the Measurement and Automation Explorer (MAX). Right click on your device and open a test panel. Under the Counter I/O tab select Edge Counting as the mode. Change the signal from the gate to the source of the counter. Does MAX detect the edges? If it does, create a frequency task, change the signal back to the gate, and test it. Does it work properly.

How did you verify that the tachometer is pulsing correctly?

What is the actual frequency of your signal? Can you give a more narrow range?

Please let me know if you have any questions. Have a great day!

Sincerely,

Marni S.

0 Kudos
Message 2 of 10
(6,103 Views)
Hi..I've been posting in here for a similar problem..but having no success in resolving the issue after talking to NI support either. I have a low freq tach signal in the form of a ttl square wave (2-50 Hz)..trying to use counter pins on teh daq board to measure frequency using meas dig freq-low freq 1 ctr.vi..with no success. When i use test panels in max and count edges on the counter source pin having the signal connected to it..i can see the edges being incremented..so that work! But if i try to use the vi to meas freq..it give me all kinds of random numbers! I am measuring the same using a scope which gives me perfect results all the time. I came across this thing about "tristating the count direction terminal to use an external signal"..Is this necessary and how can it be done. The counter pins work fine if i generate a pulse train on them using max and i can see that working fine on teh scope. Its just measuring freq/period that doesnt seem to work! Any help would be greatly appreciated.
Thanks,. Shyam.
0 Kudos
Message 3 of 10
(5,696 Views)

Hi Shyam,

Were you able to verify that your edge count is counting at the correct rate? You explain that the frequency measurement returns random values, but are they within a certain range? Maybe you could post some of the data that is returned. If your signal is noisy your measured frequency could appear to be very different than your expected frequency. What is generating the signal you are measuring? When you perform an edge count measurement your signal should be connected to the counter source, while in a frequency measurement your signal should be connected to the counter gate.

Steve B

0 Kudos
Message 4 of 10
(5,678 Views)
Hi Steve,
   Yes i am connecting the signal to the source pin of the counter when i do edge detection and the gate pin when i do frequency measurement. the displayed random values are anywhere from 300 to 1khz..while my signal is of the order of 15-20 hz. I can see the edges when i use the daq board test panels to do edge counting..but the funny thing is when the edges are incremented they keep jumping up..like there might have been just one pulse of the signal and the count will go up 15-20..so def something funny happening there.. I am in the process of trying to obtain a schmitt trigger to try to see if the rise time is too slow or the signal is not good enough for the counter..At teh same time the scope that i am using has no problems in getting the right frequency with the same signal! My signal is coming from an optical speed measurement sensor which sends a pulse every time it sees a reflective tape cut across the light beam.
Shyam.

0 Kudos
Message 5 of 10
(5,667 Views)
Just to add..is this "tristate the count direction pin to measure external signal" necessary??
Shyam.
0 Kudos
Message 6 of 10
(5,666 Views)

Hi Shyam,

Based on your description of the edge counting it makes sense why you are seeing an increased frequency measurement. In order to perform a frequency measurement, the counter is actually counting the number of clock ticks of a known time base between rising edges of your signal. The number of edges that occur can be turned into the period and frequency of your signal. If the edge count is counting more edges than it should, the higher frequency is expected. Can you try to measure another known signal, perhaps from a function generator or even from the board itself. You can route a pulse generation into a frequency measurement to check its behavior. If your signal is noisy the noise could be interpreted as edges of your signal which would cause a higher edge count/frequency measurement. You should not need to tristate the count direction pin for this measurement.

Steve B

0 Kudos
Message 7 of 10
(5,645 Views)
Thanks Steve. I have checked the counter by getting the other counter to generate a pulse train and route that signal to the source of the other counter..then running the measure frequency vi and that works fine. So i guess its just the signal..i am in the process of trying to rig a hardware schmitt trigger to maybe clean up the signal. My only other concern was how the scope was getting a good frequency with the same signal..something which the counter pins arent able to do.
Shyam.
0 Kudos
Message 8 of 10
(5,641 Views)
Hi Shyam,
 
The major factor that would come into play with the signal having some noise is that the counter is expecting a TTL signal and the oscilloscope is measuring an analog input signal. If your signal floats above the TTL thresholds or does not rise/fall within the specifications, the behavior is not predictable and it can be measured as a high or low by the counter. An oscilloscope will measure the analog signal and you may be able to measure the frequency of the noise on your scope by analyzing a smaller timeframe of the signal.
 
What Is the Definition of a TTL (Transistor-Transistor Logic) Compatible Signal?
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/acb4bd7550c4374c86256bfb0067a4bd
Steve B

0 Kudos
Message 9 of 10
(5,624 Views)
Hi, I ended up using a schmitt trigger circuit..input from sensor going to trigger and output going to daq counter pin..This solved alll the problems..the signal probably had a slow rise time or something and the ic seems to fix that problem!
Thanks to all, Shyam.
0 Kudos
Message 10 of 10
(5,587 Views)