Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Can Edge counting perform using Digital Pin?

Solved!
Go to solution

Hello Everyone.

I am using labview 2014 and  NI USB 6353 daq  card.

I am developing application for multi UUT Testing.

In my Application i have to drive stepper motor for fixed amount of pulse  and this pulse also has to be measure for accuracy testing. i can test 4 UUT Simultaneously right now. as 4 counter channel are available in daq card.

but need to increase No of  uut Testing parallel.

Pulse frequency is 500 Hz.

How can i measure pulse count without using counter channel. or is there any way using digital pin?

My application is asynchronous. Any uut testing can start   or stop asynchronously as well as simultaneously also.

my state machine for UUT testing are separate.

 

Download All
0 Kudos
Message 1 of 6
(3,027 Views)

Do you need to generate finite pulse trains to drive the steppers?  Or do you drive them via commands to a controller over a comm link?   The code you posted shows only measurement functions, no pulse generation functions.

 

Generally speaking, pulse counting is much more straightforward with a counter task.  There are ways to approach it with hardware-timed digital input, but they put significantly more burden on your CPU and your programming perfection.  Basically, it comes down to how you feel about pain and consternation.  

Do you tolerate it?   Then see answer #1. 

Do you *enjoy* it?  Then see answer #2.

 

1. Dedicate 1 counter to each axis of pulse measurement.  Task config is very simple, the hardware does the counting, programming is pretty easy to get right.  If you only need to measure pulses, you need 1 daq board per 4 axes.  If you will also generate them, you need 1 daq board per 2 axes.

 

2. Try to capture all the pulse signals via hw-timed digital input.  Continuously monitor this task and store the most recent state of all the signals so you can detect transitions.

   If you do this with a constant sample rate, make it high enough to be sure to catch all transitions.  Nyquist demands at least 1 kHz, but I'd add a bit of safety factor on that.

   If you do this with change detection, be aware that more than one signal may show a transition on a single change detection event/sample.

   Also, this task will need to run continuously and you'll need a smart manager wrapper around it to handle the asynchronous starting and stopping of various axes.  You may need to bias the input pins to a known state to prevent false detection of transitions on inactive axes.  And so on...

 

 

-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).
Message 2 of 6
(2,995 Views)

Hi kevin,

Thanks for your Answer.

For your information, i am driving stepepr motor by drv board  along with  vco which is generating steps pulses for stepper with frequency of 500 hz and i am giving command for driving DRV board using digital pin. file is attached herewith.

I have mechanical moving system which i have to move between home position and end position repetitively to test mechanical assembly accuracy.

I have slot sensor  at home position but  not at  end position.

I am measuring pulses generated by vco using counter channel.

From home position, i am  driving stepper motor to end position till it complete 1000 pulse count.

I reset counter once it reach end position, then reversing direction and start counter again and  and driving  stepper till  reach home position by detecting slot sensor.  No of pulse required to  reach home position is slightly vary.  For good mechanical assembly pulse count difference is very less. and faulty assembly, pulse count difference is comparatively high.

I have to test 10 UUT.

I agree that pulse counting is much more straightforward with a counter task.

but as hardware limitation of counter channel i  have to entertain my self with your idea no 2.

Thanks again for your meaningfull explanation.

 

 

 

Download All
0 Kudos
Message 3 of 6
(2,978 Views)
Solution
Accepted by topic author Nisarg

This is going to sound critical but I mean it to help save you grief in the long run.

 

By the sounds of it, you are setting yourself up for unreliable results.  Your tester will be a significant (possibly dominant) contributor to the deviations and variability you measure.

 

While you *can* get an accurate count of step pulses using DIO and post-processing, you *cannot* confirm that the # steps observed was the # *needed*.   There is latency between the moment the home sensor toggles and the time when your software becomes aware of it.  And then just a little more time until you can run the code that disables the vco.  During this unknown latency time, the vco continues stepping the motor an unknown # steps past the home sensor transition.

 

The variable latency time will directly impact your measured step count, which you are using as an indication of mechanical assembly accuracy.  Well, it isn't just that.  It's also a measure of your program's response speed, and that won't be constant.

 

 

You're going to need a more controlled testing approach to get more reliable data.

 

 

-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 4 of 6
(2,952 Views)

Dear Kevin.

Your explanation is absolutely right.

There will be latency when my home sensor detect  home position and  software will turn of vco.

As my VCO frequency is 500 hz.  if i assume time latency is under 1~2 msec then  count error would be max 3~4 pulse count. That is acceptable. 

Faulty mechanism , Pulse count difference is more then 10 counts.

 

Regards,

Nisarg Shah

 

 

0 Kudos
Message 5 of 6
(2,941 Views)
Solution
Accepted by topic author Nisarg

Hi,

Finally i could count pulses using digital pin.

Here it attachment using express vi. but same thing can be done using low level daqmx vi.

I have acquired 2 digital input channel in continuous acquisition mode with sampling rate of 2k and samples to read 5. In this application counting  pulse of any one channel.Same way multichannel counting can be done.

 

I could count my pulses of 500 hz frequency accurately.

 

Regards,

Nisarg Shah

0 Kudos
Message 6 of 6
(2,919 Views)