Jump to content

Help counter


Xrockyman

Recommended Posts

Hello,

I a NI DAQPad-6015, and I'm trying to use a counter from that hardware. I have tried to use an example but I simply can't put it working. The example as the following name:"Count Digital Events.vi".

In my hardware I've do counters and I tried to connect a switch( this is the digital event that I'm trying to count) in evry pin of the counter and nothing!

See the image below:

Thanks in advance and sorry about my bad English:)

Regards.

sorry about the image, it was not compressed:)

Link to comment

QUOTE (Xrockyman @ Jul 14 2008, 11:58 AM)

In my hardware I've do counters and I tried to connect a switch( this is the digital event that I'm trying to count) in evry pin of the counter and nothing!

Please check the following in this order of priority:

The counter must be wired correctly.

The signal must be correct.

The channel must function.

Then finally, the VI must work.

Be certain that you have correct wiring to the counter. There is a note in the Block Diagram directing you to information about correct wiring.

The signal must adhere to TTL specifications (if it never rises above 2.5 volts, or never drops below 0.8 volts there will be no valid change of state to count).

Any mechanical switch used in this way will need electronic debouncing. The counter is sensitive enough to see the contacts settling, even if the time is very short. This will produce many counts instead of one count - therefore this not your current problem, but you WILL have this problem without debounced switches.

You should set up a task using (MAX) Measurement & Acquisition eXplorer and be sure to test the task and circuits in MAX before procedding to use the channel in a LabVIEW VI.

If you successfully get the counter to work in MAX then we can talk about how the VI is operating.

Good luck,

Mike

Link to comment

QUOTE (mross @ Jul 14 2008, 05:24 PM)

Please check the following in this order of priority:

The counter must be wired correctly.

The signal must be correct.

The channel must function.

Then finally, the VI must work.

Be certain that you have correct wiring to the counter. There is a note in the Block Diagram directing you to information about correct wiring.

The signal must adhere to TTL specifications (if it never rises above 2.5 volts, or never drops below 0.8 volts there will be no valid change of state to count).

Any mechanical switch used in this way will need electronic debouncing. The counter is sensitive enough to see the contacts settling, even if the time is very short. This will produce many counts instead of one count - therefore this not your current problem, but you WILL have this problem without debounced switches.

You should set up a task using (MAX) Measurement & Acquisition eXplorer and be sure to test the task and circuits in MAX before procedding to use the channel in a LabVIEW VI.

If you successfully get the counter to work in MAX then we can talk about how the VI is operating.

Good luck,

Mike

Thanks for you quick answer:) I allready my problem solved, the counter is working correctly with a debounced button.

I have another question, how can I reset the counter while the program is still running?

I tried whith a case structure, when it is "true" to close the daq task and after start it again but this solution doesn't work, an error apears: "Error -50103 occurred at DAQmx Start Task.vi:3

Possible reason(s):

The specified resource is reserved. The operation could not be completed as specified."

Thanks and best regards.

Task Name: _unnamedTask<1B>

Link to comment

QUOTE (Xrockyman @ Jul 14 2008, 07:01 PM)

Thanks for you quick answer:) I allready my problem solved, the counter is working correctly with a debounced button.

I have another question, how can I reset the counter while the program is still running?

I tried whith a case structure, when it is "true" to close the daq task and after start it again but this solution doesn't work, an error apears: "Error -50103 occurred at DAQmx Start Task.vi:3

Possible reason(s):

The specified resource is reserved. The operation could not be completed as specified."

Thanks and best regards.

Task Name: _unnamedTask<1B>

The set up you have is sort of a one shot. You see that initial count control? That has to be redone so you must expand the VI to a lower level to find that function and get it inside the loop. You will also need to institute a Stop function inside the loop. The simplest thing might be to look for a different example that extends the VI to be reset, or another counter VI that resets to get an idea. (I apologize, but I haven't used counters much with DAQmx).

This is point where I would start using an Event Driven Queued Producer Consumer architecture. You have a fast machine operated function (counting) and a slow human input GUI function where you pick on screen and it resets and perhaps begins or waits for a signal, this is what the EDQPC is designed for.

Mike

Link to comment

QUOTE (mross @ Jul 15 2008, 11:56 AM)

The set up you have is sort of a one shot. You see that initial count control? That has to be redone so you must expand the VI to a lower level to find that function and get it inside the loop. You will also need to institute a Stop function inside the loop. The simplest thing might be to look for a different example that extends the VI to be reset, or another counter VI that resets to get an idea. (I apologize, but I haven't used counters much with DAQmx).

This is point where I would start using an Event Driven Queued Producer Consumer architecture. You have a fast machine operated function (counting) and a slow human input GUI function where you pick on screen and it resets and perhaps begins or waits for a signal, this is what the EDQPC is designed for.

Mike

Thanks for the tip, I've search around and I didn't find any quick or easy solution, so what I'm going to doo is simply not reset de counter. I know what it is his limit, so I can solve my problem from that characteristic.

Thanks and regards.

Sylvain

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.