Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder distance interval callback in CVI

 

We have a continuous product going down a

 

I have a NI PCIe-6321. I need to take a measurement every time the encoder input indicate a certain amount of movement has occurred (e.g.. 10 mm).

 

I can have a loop and poll the encoder counter continuously, but this is a major waste of resources.

 

I would like to have a callback in LabWindows/CVI called automatically everytime a predetermined number of encoder counts have been received. Is there any CVI DAQmx function I should be using to achieve this?

0 Kudos
Message 1 of 3
(3,171 Views)

Hi Steve,

 

I am Applications Engineer at National Instruments. Below is an article that explains how you can create a callback function to indicate change in the encoder counter indicator.

 

Using Callback Functions to Respond to User Interface Events

http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/uiref/cviusing_callback_functions_to_resp/

 

Please let me know if this helps.

NabilahF
Applications Engineer
0 Kudos
Message 2 of 3
(3,127 Views)

The DAQ card itself is capable of generating events in several circumstances (the link is LabVIEW-focused by the same events apply in CVI):

 

http://www.ni.com/white-paper/5384/en/

 

 

 

None of those are an exact fit for your use-case, but you should be able to make this work with the Counter Output Event:

 

1.  Set the initial position to -10 mm (or whatever interval you want the event)

2.  When the counter reaches 0, it will issue a counter output event (generating a hardware signal on the counter's internal output as well as generating the event).

3.  Use the hardware signal to reset the encoder back to -10 mm (i.e. set the Z index to be the counter's own internal output--it sounds like it wouldn't work but I've been doing this for a while on one of my applications without any issues).

 

If you need cumulative position you could keep track of the events in software or use another counter to count the internal output signal.  If the encoder turns the opposite direction the events won't start back up until it reaches the point of the previous event + 10 mm.

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 3
(3,117 Views)