Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize analog input and digital output without counters

I am developing an application that requires 4 analog inputs (0-10VDC), an encoder, and a stepper motor.  The DAQ needs to be USB based.  In working with NI Application Engineering, they specified the USB-6341.  Unfortunately, they were 6-8 weeks lead time.  In the meantime, I am using a USB-6229 OEM to generate proof of concept.  The problem I have is that there are only two counters available on the USB-6229 OEM, and I need both for the encoder.  

 

I'd like to sequentially acquire AI, send a pulse train to the stepper (being controlled by a motor driver simply looking for STEP pulses), all while monitoring the encoder counters.  I have been reading about synchronization of AI and DO, however, as noted, with only two counters, I'm not sure how to pull this off.  My sense is that I can use the AI sample clock, but I don't know how to divide this down to a pulse train for the motor (which would need to be on a DO line since the counters are busy with encoder counting).

 

I do have an application written, but it contains proprietary algorithms for the processing of the AI signals and I can't post that here.  I could write a MWE, but hoping someone can orient me to the tools I need to put this together before I do that.  

 

Thanks very much in advance...

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

Hi jwebster,

 

I think that there are a couple of things that you might be able to do. One of the advises is that if you do not have the physical USB-6341, you can simulate it on NI MAX and use it on LabVIEW, so you can make your program and still have a proof of concept. If this does not fit your requirements or if you do not like this possible workaround, then you might be able to use the AO Sample Clock because you will be using the AI Sample clock for its respective tasks. Also, if there is a chance to insert an external clock through a PFI line, you might be able to use it.  

I hope this might be useful for you.

Regards,

 

Luis Calderon

National Instruments

0 Kudos
Message 2 of 3
(3,798 Views)

Why is it that you need 2 counters for your encoder?  A single counter can handle most standard encoders -- including quadrature (A,B channels plus Z index), up/down pulses (2 channels, one each for up and down), or pulse and direction.

 

As to the pulse train, that's a little trickier.  Your future X-series board will let you generate a finite pulse train on a single counter.  Your short-term M-series board requires 2 counters working in tandem.  However, there's a workaround that Luis mentioned.

 

You should be able to make a dummy AO task and export the AO Sample Clock to a PFI pin that you wire out to your stepper drive.  You *can* set up a finite acquisition AO task to control both the frequency and # of step pulses.   Here's an example to start from:

 

ao clock for stepper.png

 

 

You'll need to double-check for the possibility of an off-by-one count error that could come up, depending on the default digital state of your output terminal, the polarity of your AO Sample Clock, and the active edge of your motor driver.  

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 3
(3,787 Views)