Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Starting and stopping 6602 counters simultaneously and extracting measurements from them. All this to be done in VB

I have a motor that is driving two encoders.

These encoders currently have the same pulses, but that could change at a later date.

I have the motor spinning at anywhere from 500 to 1000 RPM�s. The norm is 833 RPM�s. These encoder signals are going into the counter. I need to display two text boxes with incrementing values to the user. Encoder 1 is the master encoder. Encoder 2 is the slave encoder.

I need both encoders to start counting simultaneously. When Encoder 1 (Master) reaches a count of 100000, I need to get the exact count at that time from Encoder 2(Slave).



Since the resolution of these encoders are both the same, 4096 c
ount, both should display 100000 at the same time. Currently in my program, the slave encoder never displays the same count as the master. It always exceeds it by at least 400 counts.



Some Visual Basic code and a possible solution with this would be greatly appreciated. I thank you very much in advance of your hard research into my dilemma.



I am emailing you from my home email address. If possible could you respond back to this address: stephsotos@earthlink.net. If that is not possible, my work email address is ssotos@dancon.com.
0 Kudos
Message 1 of 2
(3,329 Views)
Hi Steph,

I'm not sure how you have your counters configured but to have them synchronized for buffer operations (simultaneous sampling) there is one main thing to do. You select the gate of your slave counter to be the gate of your other counter (either next or previous). In VB:

CWCounter1.GateSource = cwctrPrevCtrGateGS
-which represents the previous counter's gate

So as long as your gate signal isn't pulsing until both counters are configured and armed for their specific operation, the counters shouldn't be off by more than 1 pulse (delay due to internal routing). If you do notice internal delay between both gates and the 1 pulse is unacceptable, you will have to use something called "Pad Synchronization". I don't believe this is explicitly expo
sed in VB but the NI-DAQ driver call to perform this is:

Line_Change_Attribute(iDevice, ulLineNum, ND_LINE_FILTER, ND_SYNCHRONIZATION);

Hope this helps.

Ron
0 Kudos
Message 2 of 2
(3,329 Views)