09-09-2024 05:28 PM
I found these two VIs online for building a stopwatch and I want to create a similar VI with continuous counting logic. My goal is to implement start, pause, stop, speed control, and error handling features using a Queued Message Handler (QMH). These VIs closely match what I'm trying to achieve. I'm completely new to LabVIEW—can anyone provide guidance, useful links, or possible solutions? Thanks in advance
Solved! Go to Solution.
09-10-2024 12:13 PM
@mrinalk30 wrote:
I found these two VIs online for building a stopwatch and I want to create a similar VI with continuous counting logic...
09-12-2024 04:08 PM
Hello, thanks for your response.
Answering your questions below-
1. If you attach code found elsewhere, it would only be polite to provide links to the original.
For vi1 -https://forums.ni.com/t5/Example-Code/Simple-While-Loop-Counter-Using-LabVIEW/ta-p/3510297
For vi2- https://forums.ni.com/t5/Real-Time-Measurement-and/Simple-Stopwatch-Timer-for-front-panel-resetable/...
2. Define the term "continuous counting logic".
In this case, "continuous counting logic" refers to a system where the counter starts and runs without stopping until a specific event (like a pause or stop) occurs. It reacts immediately to user inputs, like changing speed or pausing.
3. If the VIs already "closely match", what else do you need?
I need to create a counter program using a Queued Message Handler (QMH). The counter should run continuously and respond instantly to user inputs, allowing them to start, stop, pause, and adjust the counting speed. Additionally, the program should have an error threshold. If the counter exceeds this threshold, an error is triggered, and the QMH’s error handling system will manage it. There should also be a switch that determines whether the error is treated as critical (fatal) or not.
4. A stopwatch typically should not generate errors. What kind of errors are you trying to handle?
In my case, I'm not building a typical stopwatch, but rather a counter with additional functionality. The errors I'm handling are related to exceeding a predefined threshold for the counter. For instance, if the counter runs too long or reaches a specific value, it triggers an error within the error-handling system of the QMH. This is important for managing scenarios where the counter may behave unexpectedly or needs to be constrained.
5. When attaching code, it is recommended to "save for previous" (2020 or below) so more uses have a chance to contribute. many don't have newer versions.
Thanks for the suggestion! I will make sure to save the VIs in an older LabVIEW version for broader compatibility.
Looking forward to your response, thanks in advance!
09-13-2024 10:06 AM - edited 09-13-2024 10:10 AM
@mrinalk30 wrote:
2. Define the term "continuous counting logic".
In this case, "continuous counting logic" refers to a system where the counter starts and runs without stopping until a specific event (like a pause or stop) occurs. It reacts immediately to user inputs, like changing speed or pausing.
Of course a stopwatch only has two "speeds": (a) stopped/paused, (b) running at 60 seconds/minute. Any other speed is no longer a stopwatch.
All you need is a simple state machine. Start with defining all required controls and indicators and place them on the front panel. On the diagram, create a toplevel loop running at a reasonable rate, an enum constant with all required "states" (reset, run, pause, stop, etc. and implement the logic for each case.
Can you explain why you think you need a QMH? What parts should be handled by QMH instead of directly?
Terms like "continuously" and "instantly" need to be defined. Even a picosecond delay is no longer instantly.
09-15-2024 02:50 PM
Hello,
Of course a stopwatch only has two "speeds": (a) stopped/paused, (b) running at 60 seconds/minute. Any other speed is no longer a stopwatch.
I was actually trying to make a continuous counter, however I could not succeed. So I used stopwatch just as an example.
Can you explain why you think you need a QMH? What parts should be handled by QMH instead of directly?
I have been told by my professor to compulsorily use QMH to make continuous counter. Below is the word to word task I have been assigned:
"Implement a counter program in QMH with the following features:
A continuous counter is to be implemented which reacts immediately to user input. The
counter should provide the functions: start, stop, pause and changing the counter speed.
An error threshold should be added which raises an error within the error handling system
of the QMH template whenever the counter exceeds the threshold. A switch should control
whether the error is handled as fatal."
Looking forward to your reply, thank you.
09-16-2024 12:11 AM
Obviously, your professor thinks that you have sufficient LabVIEW knowledge and training for this simple task. If you don't think you can do it, you need to tell the professor.
It would be unethical for us to do your work, but we would be very happy to look at your attempts and offer suggestions for improvement. Be very specific when describing what parts are giving you problems. See how far you get.
09-16-2024 01:06 AM
You are right, I did not expect the community here to build a vi for me but help me with doubts. Thank you for the help so far and I would definitely write here for further help.