Xrockyman Posted July 15, 2008 Report Share Posted July 15, 2008 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:) Quote Link to comment
mross Posted July 15, 2008 Report Share Posted July 15, 2008 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 Quote Link to comment
Xrockyman Posted July 16, 2008 Author Report Share Posted July 16, 2008 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> Quote Link to comment
mross Posted July 16, 2008 Report Share Posted July 16, 2008 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 Quote Link to comment
Xrockyman Posted July 17, 2008 Author Report Share Posted July 17, 2008 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.