LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add Counter Input to this program

Hello all,

 

I have searched through examples and other programs to find a solution to this problem, and I haven't been able to come up with anything.

This particular problem should have a very simple solution, but I'm simply unable to figure it out.

 

The picture shows the basic function of sending pulses to a stepper motor which slowly pulls over time.  I am simply trying to add a counter input which will be able to take the number of pulses sent to the stepper motor and count them to be used to determine the exact distance the stepper motor is moving.  I have tried wiring to my second counter (Dev1/ctr1) from my first counter (Dev1/ctr0) and using that to create a new task which will count the edges, but then it tells me that it requires an counter input, but it's telling me that Dev1/ctr1 is a counter output.  I follow the Count Digital Pulses.vi example to build it, but I would either run into problems saying that the Start Task input is reserved, or that Dev1/ctr1 isn't being used as a counter input for some reason.  Is this even possible to do with this set up? 

 

The screenshot attached is the point of interest, but I will go ahead and add the VI as well if that's needed. 

 

James

Download All
0 Kudos
Message 1 of 2
(2,503 Views)

Hello, I looked at the code and here are a couple suggestions. First, the counter output structure...seems like you eliminated the loop for continuos generation. It does send only one pulse but it should look like the example in the attach picture.

 

About the counter input task, you are on the right track, the out from counter 0 should be wired to the source of counter 1. The programming structure should follow the one from the example Count Digital Events.vi, the key is to allow this task to run at all times, otherwise you will loose the pulses that you are trying to read.

 

Now, if you are having troubles with the DAQmx tasks then notice that you are sending one pulse at the time, you can count the times you execute the code (in the case structure) and it will be the same as counting the pulses of the counter output task.

Alejandro C. | National Instruments
0 Kudos
Message 2 of 2
(2,473 Views)