Jump to content

Count pulses on a finite pulse train


Recommended Posts

Im using a counter to generate a digital finite pulste train. And I got a stop button so the user can stop the generation of pulses. This is done with a while loop that runs while the task is not done and the user have not pushed the stop button. But how can I calculate how many pulses the counter generated?

Link to comment

Hi goran,

there seems to be no task or timing or channel or or or ... property that gives feedback about the amount of time a task was running or the number of pulses which were generated. And getting a system timestamp right after starting and stopping the task and then calculating that probably xy pulses where generated might be ok only with very low frequencies.

An accurate solution is to use a separate counter and task to count the digital events of the pulse train task. Use 'Count digital events.vi' - Example for starting.

Regards,

Frank

Link to comment

Hi goran,

there seems to be no task or timing or channel or or or ... property that gives feedback about the amount of time a task was running or the number of pulses which were generated. And getting a system timestamp right after starting and stopping the task and then calculating that probably xy pulses where generated might be ok only with very low frequencies.

An accurate solution is to use a separate counter and task to count the digital events of the pulse train task. Use 'Count digital events.vi' - Example for starting.

Regards,

Frank

I tried to modify 'Count digital events.vi' but I get errors. What counters should I use? I got a DAQCard-6036E.

edit: Dont know why the preview of the screenshots are black but they work if you click on them.

post-12262-127166162836_thumb.jpg

post-12262-127166164786_thumb.jpg

Edited by goran
Link to comment

Hi goran,

I'm sorry for my mistake. Due to the fact, that you specified the number of pulses which you want to generate, the counter out task uses automatically the second counter to detect when to end the task.

As your DAQCard-6036E has only 2 counters they are both needed for your CO task. If you change your CO task to continuously generating pulses my solution should work. This is probably not a correct solution for your problem.

If you only want to end the puls generation after quite a while and it is not too important if there is a 'jitter' of about some 10 or 100s millisecond in stopping the train you could try the following:

- generate the puls train continuously with one task

- count the generate edges with another task

- stop it by button click or

- stop it, if more than xy pulses where counted

If you have to stop the puls train after exactly xy pulses, you might need an additional (3rd) counter. Or someone else whose counter knowlege is better ;-)) and who can provide another solution :lightbulb:

Regards,

Frank

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.