Jump to content

Count digital inputs


Recommended Posts

Hi all,

I want to count the number of digital inputs I am getting.

I found the “Toggleincrement” function (see attachment) that is counting inputs controlled by a Boolean Control using an Event Structure.

Now, when I change the Boolean Control for my digital input the Event Structure does not work anymore.

Could somebody help me please?

Thanks!

Carola

toggleincrement.vi

Link to comment

If you're leaving the code in the boolean control's Value Change case, the reason the counting doesn't work is because the event will only fire for a Value Change for the boolean control. You can either use DAQmx Read in a loop to poll the input and detect changes or you can check to see if your hardware supports DAQmx Events.

Link to comment

The Event Structure are designed and used USUALLY to respond to the user interface actions. You can although use the timeout case for detecting hardware digital inputs. It may not therefore be suitable in this context.

Can you detect the hardware in your setup as it stands now. Can you just wire a simple boolean indicator, change the stage of your digital input and see the response.

Is so then just wire the simple case structure to the same wire which wires to the boolean indicator showing your digital input, Put an increment function inside the true case and the use shift register to count up to the previous value

Link to comment

Thank you for your replies. I am new with that and I am a little bit lost...

So, I learned from the Labview forum that to do what I wanted to do with the event structure was not possible.

I am finally trying to use the Count_Digital Events.vi although right now I still cannot use it because it is counting the photodetection events way too fast. Alternatively I wrote something it is working more or less OK.

Thank you for your help!

Count_Digital_Events.vi

CARO_Count_PHOTODETECTION.vi

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.