LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in Quadrature counting

Hi,

Currently i am using DAQ 6024E and the LS7084 chip to count the number of counts produced by a rotary counter.

The functions that i used are
GPCTR_Control (1, ND_COUNTER_0, ND_RESET);
GPCTR_Set_Application (1, ND_COUNTER_0, ND_SIMPLE_EVENT_CNT);
GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_UP_DOWN, ND_HARDWARE);
GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_INITIAL_COUNT, 100000);
GPCTR_Control (1, ND_COUNTER_0, ND_PROGRAM);

One problem i encounter is that when i run my program, the initial count should be 100000 due to the GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_INITIAL_COUNT, 100000);
however, the number -1 will appear. I cannot consistently get the initial count as 100000. Also when the integer -1 appear, i need to r
estart my computer and run lab windows again to get the desired value of 100000.

when the output initial count is 100000, i am able to get the desired number of counts from my rotary encoder. However when the output is -1 instead of 100000, the number -1 will not change when the shaft of the encoder is rotated.

Please advise.

Regards,

Leroy
0 Kudos
Message 1 of 2
(2,559 Views)
Hello Leroy,

I was able to find an example program for CVI that was installed on my machine. I found the project in the C:\Program Files\National Instruments\MeasurementStudio\CVI\samples\daq\Ctr\ directory. The name of the project is STCeventCount.prj.

In the STCeventCount.c file, you will find a local variable with the name �ulCount� this variable is initialized to 0 by default, but I was able to change the value to 100,000 and run the application with the count starting at 100,000. This variable is used as a parameter in the GPCTR_Change_Parameter() function on line 89 of the file.

I encourage you to examine code in this example program and try to write your application in the same fashion. I have attached the files below in case you cannot find t
hem on your machine.

Regards,
Bill B
0 Kudos
Message 2 of 2
(2,559 Views)