01-22-2019 04:16 PM
Hi everyone, this is Osman,
I am currently working on a project and all the hardware side is done now. The only problem I have is changing the duty cycle with buttons. Whatever I have done and search for it, found nothing. I mean, really I do not understand if the while loop of LabVIEW works fine. Anyway, could you please help me with this case.
This is the video of the software I want to make one: https://www.youtube.com/watch?v=zkiU2CZrSZA
I attached the .vi file to this post.
Inside of the file, you will see some buttons and their tasks are following;
Top Button: (Duty Cycle * 0) + 1 (Which will make the duty cycle 255
Up Button: Add one more duty cycle that we set
Down button: Subtract one more duty cycle that we set
Bottom: (Duty cycle * 0) (Which will make the duty cycle 0)
Kindly
Solved! Go to Solution.
01-22-2019 05:42 PM
Hi Osman,
I could not view your VI (I'm stuck in 2016) but I would recommend using an event structure inside a while loop to response to button presses. This will ensure you catch the button press very quickly, but you don't have to waste CPU cycles checking if the button has changed.
01-22-2019 07:15 PM
This is how you can do.
But I strongly suggest you to merge all of them in one loop if they share common hardware. You will save a lots of CPU.
Then put your hardware in a separate loop with a Queue structure (consumer)
You GUI can be put in a loop with a event structure (producer)
That will become an easily scalable application and easy to maintain.
Others advantages:
-it will fit in one screen.
-Improve user experience (no blinking and more responsive)
Benoit
01-23-2019 12:45 AM - edited 01-23-2019 12:47 AM
Hi, thank you for quick response,
I am now not near to my computer, I will try it. But, what about the broken wire in your example? I am stuck with this issue, will change all the interface after solving the major problems that I am facing with.
Best 🙂
01-23-2019 12:52 AM
Hi, thank you for your quick response. I already am using it inside of a while loop. But the problem is, while it is in a while loop it gets only 1 source. I stuck with changing the value with buttons. I hope you may see my vi 🙂
Best,
01-23-2019 01:02 AM
I looked at you VI already.
You need only 2 loop. One for the GUI another one for the hardware.
GUI (around a event structure)
Hardware (around Queue pushed by the event structure)
Benoit
01-23-2019 02:13 AM
Hi Bseguin,
Could you please fix at least one of the control buttons and upload the vi.
I don't understand that it is not working. I already tried many ways with following the same steps in youtube, in this forum. Those are working but not mine. I want you to fix only one of the controller please, I will fix all the other 😞 It is now deadline time..
Best,
01-23-2019 02:35 AM
do you understand my previous picture?
01-23-2019 03:19 AM
Here is the problem,
Normally, Duty cycle comes from a control box. We set a number like 20% of Duty cycle and all the selenoids are working with that. If I want to change a specific selenoid like S4, I have to use those buttons. But while using those buttons it stuck with the number I set in control box. This is the exact issue that I am facing with.
Best,
01-23-2019 01:25 PM - edited 01-23-2019 01:42 PM
Here I tried your suggestion for one of them. The result is satisfactory fine but I still have problems. If I use while loop, it just uses the settings inside of the default case which is "0". And, although the formulas are correct, 3rd and 4th cases are not working as I expected. I attached 2 vi files that one is exactly your description and the other one is the case I made.