03-09-2012 09:32 AM
Hi all
I created a wavefrom chart that starts from a relative time of 00:00:00 when the vi starts and display the waveform versus the time elapsed since the vi started.
I did this using an example that i found in ni forums by subtracting the current relative time from the relative time of the waveform as seen in the block diagram attached
when i stop the vi and start it again normally it starts again from zero and so on .
the problem that i want the chart to start from zero every fixed amount of time (ex: 50 seconds ) and not require to stop the vi and start it again in order to start back again from zero !!
I've been thinking about how to do this for a lot and i tried a lot of things but i couldn't ,does any one have an idea on how to do this ?
i have a feeling that the solution will be simple to a lot of people ,but please forgive me coz i'm new to labview and its my first project using it
Thanks in advance,
Regards
Shady
Solved! Go to Solution.
03-09-2012 09:42 AM - edited 03-09-2012 09:43 AM
Replace the tunnel that feeds the start time with a shift register and use that value for the start time. You could then reaplce the value in the SR using a case structure or a select node when a button is clicked.
Please note that if you pass the waveform chart a new value with a time stamp that is "backwards in time" from what alrady pltted, the cahrt will reset itself claering the prvious data.
Ben
03-09-2012 01:38 PM
Ben
First of all thanks a lot of your reply.
I just want you to clarify how can i replace this tunnel with a shift register ,where will this sr take the data from ,coz the "Get current date and time" is actually placed outside the loop ,also how can i replace this value with a case structure ,shall i put the "get date and time" in a loop or in a case structure ? coz i actually tried ways that looks like that but it didn't work .
I will appreciate that a lot if you showed me what you mean by a diagram. or on the actuall vi that i attached to the post.
Thanks in advance
Regards
Shady
03-09-2012 01:47 PM
@shadyman wrote:
Ben
First of all thanks a lot of your reply.
I just want you to clarify how can i replace this tunnel with a shift register ,where will this sr take the data from ,coz the "Get current date and time" is actually placed outside the loop ,also how can i replace this value with a case structure ,shall i put the "get date and time" in a loop or in a case structure ? coz i actually tried ways that looks like that but it didn't work .
I will appreciate that a lot if you showed me what you mean by a diagram. or on the actuall vi that i attached to the post.
Thanks in advance
Regards
Shady
I reserve that type of service to my paying customers.
Let me turn it around and welcome YOU to post an image of what you have tried and let us comment based on your efforts.
I'll get you started with two suugestions and a question.
1) You can right-click the input tunnel and select "replace with Shift Register".
2) If you watch your code in execution highlighting mode, you can see were the data comes from and goes to when.
Now for your question!
After watching the code run where would there have to be another "Get time" node have to be located to get a new value WHILE the loop is running?
Like I said post images of what you are attempting to do and let us offer advise based on that.
Ben
03-09-2012 05:19 PM
Ben
Thanks to your suggestions I think I managed to do it
I did it using the shift registers and a case structure that switch the time input to the current time from inside the loop when executed.
you actually made it clear when you asked the question at the end of the post thanks again.
I may sound greedy but now i want it to reset automatically every amount "x" of seconds ,what do you think I should do .
Regards
Shady
03-09-2012 10:06 PM
Read the new time inside the loop and not in the case structure. Subtract the time in the shift register from the newly read time. If the difference is greater than or equal to X, OR the reset button is set, put the new time in the shift register, otherwise wire the data from the shift register back through to the shift register.
03-10-2012 03:47 AM - edited 03-10-2012 03:52 AM
Ravens fan
Thanks a lot 🙂 ,I don't know what to say ,This solved the problem and the vi now runs exactly like i wanted it to be.
That is how it looks like right now ,Thanks to you Guys.
I also attached the VI if any one here in the forum wants to use it in the future 🙂
Thanks Ravens Fan ,and Thanks Ben
Shady