Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Different output from VI test window and indicators

Hello,
 
I'm having a problem getting the indicators on the front panel to match the output from the express VI DAQ assistent test panel.  I'm using a PCI 6602 card with a SCB-68 board, and Labview 7.1.  A USDigital HB6M optical encoder is attached to the board with channel A to PFI 35 (source) as instructed by the express VI and channel B to PFI 8 .  It's externally controlled and active edge: rising. 
 
In the VI test window, when the linear shaft rotates the signal from the encoder starts at the maximum value (something like 4.294967295G) and continually counts down.  That continuously down counting is one problem since my understanding was that for rotation in one direction it should count down while in the other direction it should count up. 
 
The other problem is that when a numeric indicator is attached to the express VI output it only ever indicates 0 or the max number mentioned above.  None of the intermediate values that appear in the test window appear in the indicator.  I have increased the number of significant digits, so I don't think its a matter of the number just not fitting in the box.
 
To add more differences, when the same PFI 35 channel is tested in MAX the initial value is 0, and no matter what direction of rotation the value increases.
 
I'm fairly new to Labview and haven't used counter/timer channels before.  Any suggestions would be much appreciated.
 
Thanks.
0 Kudos
Message 1 of 5
(3,564 Views)
Several little tidbits:
 
1. You refer to "externally controlled", which I assume means that you're configuring the counter for edge counting, with externally controlled count direction.  You really should use one of the "position measurement" counter modes which will decode your encoder's quadrature input more reliably.
 
2. If you're using PFI 35 (Source 1) for channel A, you *should* be using PFI 33 (Aux 1) for channel B.  PFI 8 corresponds to a default output pin from a different counter.  Somewhere you've gotten bad info on pin assignments.
 
3. Since your "B" signal is in the wrong place, then when you specify externally controlled count direction, there's no signal truly controlling it.  That empty terminal is just floating at the board default.  If memory serves, it floats high due to an onboard weak pull-up resistor which in turn causes perpetual decrements. 
 
4.  In MAX when you specify "edge counting", you cannot specify externally controlled count direction.  So it defaults to standard "increment on every edge" behavior.
 
5. You can easily convert unsigned 32-bit values like 4.2 G into more manageable values like -1,-2,-3,...  by using the "To I32" numeric conversion function.  (In a subpalette under the numeric functions).
 
For more general info, examples, etc., check the shipping examples, docs, and this site using keywords like "position measurement", quadrature, encoder, etc.
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 5
(3,554 Views)
Hi,
 
Thanks a lot for those tidbits!  With the sensor now attached to the proper channel A and B pins, in the DAQ ExpressVI test window I a count up in one direction and down in the other which is good.  However, when I add an indicator to show the output I still only get a single value (either 0 when rotating one direction or really large rotating the other way, which can be made smaller as suggested using the "to I32").  I was assuming the output from the ExpressVI would be a continuous count, the same as what is in the test window.  Is that not actually the case?
 
Also the counter is configured for edge counting because there is C++ code in addition to the Labview application that this data is sent to.  I'm not familiar with that code, but the conversion to a linear displacement value seems to be occuring there instead of in the Labview code.
 
Any other suggestions?
 
Thank you.
0 Kudos
Message 3 of 5
(3,536 Views)
Hi KVB,

Do you have the Acquisition Mode in the DAQ assistant configured for "1 Sample (On Demand)" or another mode such that you have to provide an external clock?  If not, ensure that your external clock is being provided correctly.

After configuring the DAQ Assistant, you should be prompted to contain it within a loop.  Make sure that the DAQ Assistant is within a while loop so that your acquisition runs continuously and monitors for any changes in the counter.  The test mode automatically runs continuously, but in the block diagram a loop is necessary.

Regards,
Andrew W
National Instruments
0 Kudos
Message 4 of 5
(3,513 Views)

Hi Andrew,

Thanks a lot!  It is indeed set to "on demand" so no external clock, but the express VI was not in a while loop (this was never prompted for either) and for running I was just using the "run continuously" button.  However, putting it into a while loop appears to have solved all problems.  It now counts up and down exactly as expected.

Everyone's help much appreciated.

-Kelleigh

0 Kudos
Message 5 of 5
(3,503 Views)