Jump to content

Counting Events


meocop

Recommended Posts

Hello,

This is sort of a follow up question to my previous post "Keeping Count". Thanks for your help, I now know how to use shift registers to keep count. I am running into a bit of a problem with a real application here at work. I have a pulsing voltage signal that goes from 0 to roughly 4.5 volt and goes back to zero, counting as a cycle. For each cycle the peak is not constant, nor is the duration of the cycle. What else do I need to do to count the cycles when timer and comparators don't do the job??

Thx,

MC

Link to comment
I forgot to attach the VI, sorry. Here it is. Thanks.

MC,

What is the hardware you are using for the Analog Input? And also, what is the maximum expected frequency of pulsing?

One issue I see here is that assuming that if all goes according to schedule, instead of counting transitions, you are counting the number of samples you "catch" over the 4.03 Voltage level. If you have more than one sample above 4.03 Volts before the voltage drops, each of those will samples will cause a new "count" to accumulate.

You may need to set up some way of telling your program to only count once when going above 4.03 Volts, and not to count again until falling below some value close to your low state (say 0.5 Volts or so).

And your sample rate is "nominally" 20 Hz, but it depends on a software loop to remain as such. This can be dangerous depending what else might be going on in the background of a standard PC. Depending on what hardware you are using, there should be more robust sample timing options available.

-Pete Liiva

Link to comment
MC,

What is the hardware you are using for the Analog Input? And also, what is the maximum expected frequency of pulsing?

One issue I see here is that assuming that if all goes according to schedule, instead of counting transitions, you are counting the number of samples you "catch" over the 4.03 Voltage level. If you have more than one sample above 4.03 Volts before the voltage drops, each of those will samples will cause a new "count" to accumulate.

You may need to set up some way of telling your program to only count once when going above 4.03 Volts, and not to count again until falling below some value close to your low state (say 0.5 Volts or so).

And your sample rate is "nominally" 20 Hz, but it depends on a software loop to remain as such. This can be dangerous depending what else might be going on in the background of a standard PC. Depending on what hardware you are using, there should be more robust sample timing options available.

-Pete Liiva

I have an old NI Amux 64I card. Yeah I am aware of all the problems you mentioned, but I don't know how to "tell my program to count once", to use your phrase. Using a timer does not work for me because my process is not stable ( I mentioned above that the cycle duration is not constant). Using a comparator (greater or less than a certain value) does not work either because my signal fluctuates a bit. Can you tell me how to count just once per cycle?

Thank you.

MC

Link to comment
I have an old NI Amux 64I card. Yeah I am aware of all the problems you mentioned, but I don't know how to "tell my program to count once", to use your phrase. Using a timer does not work for me because my process is not stable ( I mentioned above that the cycle duration is not constant). Using a comparator (greater or less than a certain value) does not work either because my signal fluctuates a bit. Can you tell me how to count just once per cycle?

Thank you.

MC

MC,

Most importantly, what do you expect the max count rate should be?

Hardware wise, do you mean the AMUX 64T?. If I remember right, the AMUX 64T needs to be connected to a MIO card of some sort to operate. Which MIO card are you using? It ought to have counter/timers, which would be the ideal way to go. If there is alot of noise on the signal, you may need some signal conditioning.

Are you in a position to be able to buy or assemble a breakout box to get at the various other outputs from your MIO card, or do you have a connecting block to hook directly to the MIO card?

-Pete Liiva

Link to comment
MC,

Most importantly, what do you expect the max count rate should be?

Hardware wise, do you mean the AMUX 64T?. If I remember right, the AMUX 64T needs to be connected to a MIO card of some sort to operate. Which MIO card are you using? It ought to have counter/timers, which would be the ideal way to go. If there is alot of noise on the signal, you may need some signal conditioning.

Are you in a position to be able to buy or assemble a breakout box to get at the various other outputs from your MIO card, or do you have a connecting block to hook directly to the MIO card?

-Pete Liiva

Pete,

I think this is what I have: AMUX 64T hooked up to a SC2050 cable adapter board (these two boards sit in an electrical box), sort of acting like a enclosed connector block. I also have a ATMIO 16E10 board sitting in my computer.

Regardless of the hardware though, I don't feel comfortable with using a timer because something can happen to my process that will throw the timer off. I am thinking about something like a gate switch or event trigger or something of that nature, but I don't have a good knowlege on any of those things. Thanks for trying to help Pete.

MC

Link to comment
Pete,

I think this is what I have: AMUX 64T hooked up to a SC2050 cable adapter board (these two boards sit in an electrical box), sort of acting like a enclosed connector block. I also have a ATMIO 16E10 board sitting in my computer.

Regardless of the hardware though, I don't feel comfortable with using a timer because something can happen to my process that will throw the timer off. I am thinking about something like a gate switch or event trigger or something of that nature, but I don't have a good knowlege on any of those things. Thanks for trying to help Pete.

MC

MC,

Your AT-MIO-16E-10 card is the MIO (Multiple Input/Output) card that is the heart of your data acqusition system. It has analog inputs, analog outputs, digital inputs/outputs, and counter timers. The AMUX 64T card is a multiplexer card that allows the AT-MIO-16E-10 card to read up to 64 separate analog channels, although at a slower maximum sampling rate. It has a temperature sensor on it in case some of those inputs are thermocouples and need temperature compensation. This is a link to the NI manual that covers this card.

At this stage, it is somewhat difficult to help without more description of the measurement being made. I might suggest you try using the following example VI assuming you are running Labview 7.1 on the computer you are trying this on.

post-2931-1150822605.jpg?width=400

This will allow you to get a better handle on exactly what your voltage vs. time signal looks like, and may allow for some real engineering decisions based on the waveforms. If you get signals from this, you could do "Alt-PrtScn" and paste into Paint or some other program for posting here in the Forum. Without better insight as to the exact parameters of your signal (signal to noise ratios, charateristic time constants, average/min/max event frequency, etc.) it is extremely hard to predict what might do the job for you.

-Pete Liiva

Link to comment
MC,

Your AT-MIO-16E-10 card is the MIO (Multiple Input/Output) card that is the heart of your data acqusition system. It has analog inputs, analog outputs, digital inputs/outputs, and counter timers. The AMUX 64T card is a multiplexer card that allows the AT-MIO-16E-10 card to read up to 64 separate analog channels, although at a slower maximum sampling rate. It has a temperature sensor on it in case some of those inputs are thermocouples and need temperature compensation. This is a link to the NI manual that covers this card.

At this stage, it is somewhat difficult to help without more description of the measurement being made. I might suggest you try using the following example VI assuming you are running Labview 7.1 on the computer you are trying this on.

post-2931-1150822605.jpg?width=400

This will allow you to get a better handle on exactly what your voltage vs. time signal looks like, and may allow for some real engineering decisions based on the waveforms. If you get signals from this, you could do "Alt-PrtScn" and paste into Paint or some other program for posting here in the Forum. Without better insight as to the exact parameters of your signal (signal to noise ratios, charateristic time constants, average/min/max event frequency, etc.) it is extremely hard to predict what might do the job for you.

-Pete Liiva

Thanks again Pete. I know some more about my hardware. Well I thought of something and now turn my problem in to this: let say I want to compare two successive signals, and if the first signal is zero and the second signal is not zero, I'll increase my count by 1. Would you help modify my program? I am sweating over here as dealine is around the corner. I use a random number generator in place of my signal. Thanks in advance.

Download File:post-4960-1150825099.vi

Link to comment
Thanks again Pete. I know some more about my hardware. Well I thought of something and now turn my problem in to this: let say I want to compare two successive signals, and if the first signal is zero and the second signal is not zero, I'll increase my count by 1. Would you help modify my program? I am sweating over here as dealine is around the corner. I use a random number generator in place of my signal. Thanks in advance.

I might not completely understand what exactly you're trying to do, but this is one way to check to see if a number has crossed a threshold. You can make it more complex by adding more shift registers and more logic.

Gary

Download File:post-4344-1150826242.vi

Link to comment
I might not completely understand what exactly you're trying to do, but this is one way to check to see if a number has crossed a threshold. You can make it more complex by adding more shift registers and more logic.

Gary

Gary,

Yeah I know that I did not explain clearly what I am trying to do here. But believe, your program helped me get my project done, at leat I am 90% sure at this point. I need to test it over and over to make sure there are no glitches. People on this website are awsome.

Thanks Gary.

MC

Link to comment
  • 2 months later...
MC,

You may need to set up some way of telling your program to only count once when going above 4.03 Volts, and not to count again until falling below some value close to your low state (say 0.5 Volts or so).

-Pete Liiva

A Scmidt Trigger IC (74C914N) is an easy way to filter out the unwanted counts caused by spurious voltages out of range. A breadboard and some wires should be all necesary to wire the chip up.

Link to comment
A Scmidt Trigger IC (74C914N) is an easy way to filter out the unwanted counts caused by spurious voltages out of range. A breadboard and some wires should be all necesary to wire the chip up.

You can also make it even easier by just using a low pass filter i.e connecting a capacitor across the result or the output, but don't choose a too high value of the capacitor because you will filter the good signals too.

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.