12-05-2019 04:02 PM
Hello! I am working on a project for school and have exhausted all of my resources (until now, hopefully.) This VI is meant to run like a blood pressure monitor. There is a part of the program where if the patient tries to "meausre their blood pressure" more than 5 times using the quick 1 minute reading time, the program should automatically switch the slower 5 minute reading time. I have used a case structure for the different reading times.
In previous attempts, I have used a while loop where if the iteration count is equal to 5 after being incremented by 1, then the loop stops. However, this presented two problems:
1. It causes the program to run continuously for 5 iterations. I need the program to only run once unless the "Patient" chooses to run it again.
2. Even after it stops, I have no idea how to get it to the next case in the case structure, which is the 5 minute option.
So to summarize, I need help getting the program to only run once each time it is called, keep track of the iterations, and then force to the next case if it is called 5 times consecutively.
I have attached what I have so far below. Thank you!!
12-05-2019 04:40 PM
Some comments (as this is a very incomplete "program" -- there are no loops, for example):
Homework Assignment (before coming back with your Reply):
Bob Schor
12-05-2019 05:33 PM
I decided to delete the While loop because I wasn't sure of how to use it in order to accomplish what I need, thus, it was mostly taking up space at the moment.
In terms of the project, it is meant to simulate a blood pressure monitor, so I have to ensure the monitor does not cause damage to the arteries, hence why I need to add in this part to begin with. If the patient tries to test their blood pressure five consecutive times using the 1 minute interval, the monitor should automatically switch over to the 5 minute interval in order to prevent harming the patient. It is for this reason that I am trying to get my program to keep a running count of the iterations and switch from the "1 minute" case to the "5 minute" case automatically if the iteration count exceeds 5. Like I said before, these iterations will not be consecutive unless the program is run consecutively manually.
As far as the relationship between the case labels and these time intervals, they were provided to me within the project description.
I hope this helps clear any confusion. I also took your advice and only kept the wait function inside each case, with the rest of the original code outside of it.
12-05-2019 07:12 PM
Sorry, posting by phone, cannot see vi.
What you need is a simple state machine that track attempts and such. Look at the design templates that ship with LabVIEW and also search the forum for ideas.