Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9401 pulse width measurement.

Solved!
Go to solution

Hello,

 

I'm not sure I fully understand the pin-out diagram. At present I have a NI9401 in a NI 9172 chassis. 

 

DIO0 and DIO1 are connected to light gates. I have an opto switch and I want to measure the pulse width when an object blocks passes through the slot. Can I use any of the other free input to do this?

 

Free inputs are, DIO2, DIO4 and DIO5.

 

The other I/O pins are being used as triggers. 

 

Cheers

 

0 Kudos
Message 1 of 10
(10,081 Views)
Solution
Accepted by Kamilan

Hi Kamilan,

 

If you go into Measurement and Automation Explorer (MAX) and find your 9401, you can right click the device and select 'Device Pinouts' which pulls up a window that details what functionality each pin as on the device.  For example, according to this document, DIO2 is PFI2, CTR0 AUX, CTR0 B, and FREQ OUT.

 

To answer your second question, right click your device and create a new task for your 9401.  You should do a Acquire Signals » Counter Input » Pulse Width and select CTR 1 on your device.  Once you do this, you can set up the parameters of your task and in MAX it will tell you where you need to hook up the source of your signal, which on my side is DIO5.  

 

Let me know how this works out for you, thanks!

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 2 of 10
(10,072 Views)

Hello,

 

That fully answered my question. The MAX tells you which input to use!

 

 

Thank you

 

0 Kudos
Message 3 of 10
(10,050 Views)

Hi

 

I am also doing a similar work with you. My work is to use NI 9401 together with cDAQ9171 as a timer. What I did is to measure the pulse width. There is one thing I don't understand, it seems everytime I want to obtain one pulse width, I have to measure two pulses to obtain one data. I am wondering whether I can use NI 9171 to obtain a single pulse width?

 

Could you please help me?

 

Cheers

Daisy

0 Kudos
Message 4 of 10
(9,009 Views)

Hi Daisy,

 

Could you clarify what you mean when you say "I have to measure two pulses to obtain one data"? Are you seeing an incorrect result if you only read for one pulse? How do you currently have your application set up to read pulse width?

 

Thanks!

Emily C
Applications Engineer
National Instruments
0 Kudos
Message 5 of 10
(8,988 Views)

Hi Emily

 

Thank you for your reply. I and using DAQ Assistant to realise data acquisition from NI 9401 in Labview. In the configuration, I set the acquisition mode as 1 sample and starting Edge with falling. However, I can't get anything from the measured value until the rising edge of the second pulse comes, and I don't know why. Then, I select continuous sample in the acquisition mode and choose only 1 smaple to read. This time I can get the value when the first rising edge comes. However, the new problem is if I choose continous samples, the second counter cannot work because the counter 1 is still working. Could you please tell me how to solve this problem?

 

PS, another question is I can only measure pulse width when the starting edge is set falling, if I select the rising edge the value is incorrect. Also when I test the device with function generator, I found that with low frequency (<100kHz) the pulse width I got is equal to the period. Only with high frequency, the value I read is correct. Have you got the simliar problem with NI 9401?

 

   

Cheers

Daisy

0 Kudos
Message 6 of 10
(8,985 Views)

Hi Daisy,

 

If you open your DAQ Assistant properties, and read the Measuring Pulse Width help on the side, you'll see that "You can use the counters on your measurement device to measure pulse width. Pulse-width measurements measure the time between either a rising and a falling edge, or a falling and a rising edge." If you change the Pulse Width Setup Starting Edge setting to Falling edge and look at the picture above, you'll see that the pulse width it's measuring the width from a falling edge to a rising edge (the pulse width while the signal is low). So this measurement will go from the falling edge of your first measurement to the rising edge of your second measurement. If you want to measure the width of the first pulse (while the signal is high) you need to set your Starting Edge to Rising. 

Do you know whether the width that you want to be measuring is while the pulse is high or while it's low? Starting Edge Rising and Starting Edge Falling should give you different measurements, because they're measuring different things. You should verify which result it is you want, and what it is you're trying to measure. 

 

Hope this helps!

Emily C
Applications Engineer
National Instruments
0 Kudos
Message 7 of 10
(8,968 Views)

Hi Emily

 

Thank you but I still in the trouble. It seem s the 9401 has interference between two counters. Have you meet a similar problem with me? I uses two counters in 9401. For the counter 0 (CTR0,pin16) I connect to the pulse I want to measure about 2 Hz. I connect counter1  (CTR1, pin 22) to the function generator, which generate a square wave with frequency of 2kHz. Follows are the problems I met:

1. The two counters are shown the same value of pulse width (interference)

2. The pulse width I measured is 496us ( function generator create 1kHz square wave) when I choose the starting edge is 'Falling'. But if I choose the starting edge is ' rising', the value is only 1.8us. It seems the rising starting edge cannot work.

 

Could you help me to solve the problem, particullarly the interference problem?

 

Cheers

Daisy

0 Kudos
Message 8 of 10
(8,931 Views)

I also have interference with my 9401, I am using my counters to read the output of an encoder ctr0 and ctr1 when one encoder would send data it would affect the other. am I doing something wrong or is thi a common thing?

0 Kudos
Message 9 of 10
(8,009 Views)

momo200, this is not expected behavior so let's do some troubleshooting.

 

First, could you describe your physical setup (wiring) and ambient environment to me. I ask so that we can determine the likelyhood of noise or cross-talk occuring before the signals enter the 9401.

 

Also, what chassis are you using the module with?

--------------------------------------
0 Kudos
Message 10 of 10
(7,996 Views)