05-06-2015 09:49 PM
hey, I am a beginner of labveiw, recently my professor give me a some project as below
I can only figure out the “duration” as following image , anyone who could help me for the rest of two, thanks so much
Solved! Go to Solution.
05-07-2015 12:21 AM - edited 05-07-2015 12:27 AM
OK, let's take it by the numbers:
Requirement 1 tells you that an event structure will be needed.
Requirement 2 tells you that you will need time functions, and the ability to manipulate time values.
Requirements 3 - 5 tell you that you will need more than one shift register. You will also need the analysis routines to do the statistics.
Take those hints and see what you come up with. Start with a subset of the problem. Write a vi that takes the current time and displays it whenever the button is pressed. Start with just that, we can build from there.
Want to know a secret? Your professor isn't really interested in teaching you how to create a timer. It's far more important that you learn how to think.
Mike...
05-07-2015 08:53 AM
thanks so much mike, just another question, how to make the system know I press the button and let the system record the time I pressed ?
05-07-2015 08:57 AM
@zqz51911 wrote:
thanks so much mike, just another question, how to make the system know I press the button and let the system record the time I pressed ?
Event Structure. You can make an event case for the button's value changing.
05-07-2015 09:01 AM
yep, I uesed event structure. and it works for the duration calculation , however, how to wire to make the system to record the time between the firt time I pressed the button and the second time I pressed the button ?
05-07-2015 09:07 AM
@zqz51911 wrote:
yep, I uesed event structure. and it works for the duration calculation , however, how to wire to make the system to record the time between the firt time I pressed the button and the second time I pressed the button ?
As in save it to a file? There is a whole suite of functions in the File I/O palette that you can use.
05-07-2015 09:11 AM
not save in a file , finally all the three values(frequency duration and break) sholud have indicator to showing on the front panel.
05-07-2015 09:18 AM
@zqz51911 wrote:
not save in a file , finally all the three values(frequency duration and break) sholud have indicator to showing on the front panel.
Then just calculate the values and dispaly them with indicators.
05-07-2015 09:19 AM
the question is I have no idea how to coding the calcaulation.......
05-07-2015 09:30 AM
You are already keeping a shift register for the time. I would change this to be 2 shift registers: one for when the button was turned on and a second for when the button was turned off. When the button is turned off, you just subtract to get the duration. When the button is turned on, you subtract the current time and the time is was previously turned on to get the frequency. The break is just the difference between the current time and the time when the button was turned off.
A case structure in your event case will be needed here.