goran Posted April 16, 2010 Report Share Posted April 16, 2010 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? Quote Link to comment
goran Posted April 16, 2010 Author Report Share Posted April 16, 2010 (edited) The VI looks like this and I want to know how many pulses where generated How can I do that? Im using counter: Dev1/ctr0 Edited April 16, 2010 by goran Quote Link to comment
FrankB Posted April 16, 2010 Report Share Posted April 16, 2010 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 Quote Link to comment
goran Posted April 19, 2010 Author Report Share Posted April 19, 2010 (edited) 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. Edited April 19, 2010 by goran Quote Link to comment
FrankB Posted April 19, 2010 Report Share Posted April 19, 2010 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 Regards, Frank 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.