Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6221 Frequency Measurement

Hi all,

I am currently trying to create a vb program to create a task to read a 0-5V TTL signal from my sensor and read the frequency of the signal continuously. The frequency will be dynamic so I cant just use the ctr0 to count on edge (0-250Hz max). I have tried using the examples given although they do not return any measurements. 

How should I wire this? Could somebody give me a rundown on the visual basic examples such as the LowFrequencyCtr or the one for period measurement because im not entirely sure how they work. The Countdigitalevents example was easy to understand becuase it only required a looptimer although the more complicated ones use callback functions which confuse me.

 

Thank you.

Tom.

 

 

0 Kudos
Message 1 of 3
(2,201 Views)

Hi Tom,

 

What examples are you referring to here?

 

If you are talking about how you should wire the PCI-6221, I would recommend having a look at:

http://www.ni.com/pdf/manuals/375303c.pdf

http://www.ni.com/documentation/en/multifunction-io-device/latest/pci-6221/overview/

 

Kind regards, 

Michael

0 Kudos
Message 2 of 3
(2,177 Views)

The Count Digital Events VB example lets me count on every edge without fail, although I cannot calculate the frequency here because the frequency will be changing. 

My project is basically using my sensor to detect a ttl signal created by a rotating motor shaft, and I want to chart the frequency in my VB program. The example above cannot measure a dynamic frequency so I should be using the 'Measure Pulse Width' (i think) to measure the pulse widths and then calculate the frequency. 

After that I need to create some sort of a feedback loop to sense the motor torque being upset, and then for the program to bump up the voltage to correct it, but ill try get the frequency charted first of course.

Sorry the last message was not clear. Must I wire an external gate frequency into the ctr0 gate pin to measure the widths? Or is this the correct way to go about this. 

 

Thanks for the reply

Tom

0 Kudos
Message 3 of 3
(2,163 Views)