From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Frequency counting

Attached you will find my program, my problem is that my measured frequency is not correct. Maybe someone can help me to fix that problem. The following hardware and software is used:
AT-MIO-16-E2
NIDAQ 6.9.1 with
I/O 0x100 - 0x1ff
interrupt request 7
DMA 5, 6 and 7
visual c++ 6.0(proffesionell)
measurement studio 6.0(full development)
windows NT 4.0
The guys from NI here in Germany have no propper knowledge about visual c++ and working with activex controls, so I hope somebody can help me from NI in the states

Regards
Stefan
0 Kudos
Message 1 of 5
(3,334 Views)
Stefan,

It is very difficult to go through your code and determine what the problem is. It would be much easier if you gave us a description of your problem.

Are you trying to measure and analog or digital signal?

What frequency are you expecting, how are you generating it, what are you getting?

If analog, what is your sampling frequency?

If digital, how do you have your counters set up?

Also, if it is neccesary to read your code, the project you attached does not open properly, it complains that LEBENSDAUERPRUFUNGDlg.ico is missing.

Please describe your problem further as described above, and we'll see what can be done.

Regards,
Amaury R.
-NI Applications Engineer.
0 Kudos
Message 2 of 5
(3,334 Views)
Hello Amaury R. ,

here my answers to your questions and attached you will find my programm

Are you trying to measure and analog or digital signal?
digital signal coming from PFI9 direct

What frequency are you expecting, how are you generating it, what are you getting?
frequency between 0 to 30 Hz on counter0, and I'm getting sometimes the right frequency, but mostly I get totally wrong measurements

If digital, how do you have your counters set up?

Counter0 is set up for period rising edge measurement

Regards
Stefan
0 Kudos
Message 3 of 5
(3,334 Views)
Stefan,
I am still unable to open you code sucessfully, but I do have a couple notes I think may be helpfull to you.

First, you say you are measuring between 0 and 30Hz. Note that for low frequncies you may be seeing the counter reach it's maximum pulse count and roll over before the pulse is measured. If this is the case, you will need to reduce the counter time base.

Also I have attached some very simple CVI code to single period measurement which you may want to look at.

Regards,
Amaury
0 Kudos
Message 4 of 5
(3,334 Views)
Thanks a lot hope it helps
Happy X-mas and a happy new year

Stefan
0 Kudos
Message 5 of 5
(3,334 Views)