03-30-2010 08:54 PM
Hi Everyone,
I'm trying to add excel worksheet for every minute passed, so i used the "get date/time in seconds" function and extract the minute (%M), and use event structure (value change) but nothing happened, the event structure doesn't respond to change in minutes. any bright ideas? here is the vi (LV8.5) of my problem.
note: this is just an initial part of my program to acquire data (history records) from devices. i want to separate the data by its date in microsoft excel (but i am trying first to acquire data by minutes to see if my program works).
thanks in advanced..!
Solved! Go to Solution.
03-30-2010 09:22 PM - edited 03-30-2010 09:24 PM
Several problems.
One, you have an event for the value change of minute. However the event never gets fired because the only way minute gets changed is by writing to the indicator's terminal. That does not fire an event. Either the user has to write to the control (which they can't because it is an indicator and not a control), or you write to the value(signalling) property node of that control. Note that although the event is called "value changed" the value itself would not have to actually change from its previous value in order for the event to fire. You would have to compare the new value to the old value from within the event structure and made a decision in the code on what to do.
Second, if the that part of the code did work, your while loop would end and your case structure would execute. But once that happens your program would end. You would never be able to do it for the next minute.
03-30-2010 09:39 PM
Thanks for response, i try what you've suggested "value signalling property node", and put while loop to entire program to prevent termination. what happens is that the event structure changed eventhough the value of 'minutes" hasn't changed yet... please see program below and correct me if i'm wrong.
this program still doesn't succeed.
03-30-2010 09:46 PM
anyway, how to compare old and new value in my program to be used to trigger the event structure? im not good in manipulating strings and not good also in using event structure..please show me some LV program sketch of yours so i may put this up in my program..
Thanks a million!...
03-30-2010 10:29 PM - edited 03-30-2010 10:30 PM
if you could post the VI people could help you better, but instead of a event structure use a case structure
also you only need one while loop
03-30-2010 10:42 PM
hi harold,
my original VI is in the 1st message (LV8.5)... using case structure seems an easier way as you've suggested but i dont know how to used it in relation to old vs new value of my "minute" indicator to create different cases. what functions can i used to detect the changing of string values? anyway, here is the attached vi. i hope you can sketch your suggested idea (since i'm not really good in manipulating strings) or just be specific if no time for creating program.
thanks in advance...
03-30-2010 10:46 PM
03-30-2010 10:47 PM
I had said in my post that Value Signalling causes the event to fire even if the value hasn't actually changed. So you shouldn't be surprised that it happened that way.
In the nodes that are on the inside border of the case structure, you can select Old Value and New Value and compare them.
03-30-2010 11:33 PM
to ravens fan,
Oh i see, sorry for not figuring out your answer in your 1st reply. you mean "old val & new val" nodes inside border of event structure (not in case structure). yes it working now. i did'nt figure it out before coz' im not often using this event strucure in my previous programs. anyway thanks!
03-30-2010 11:34 PM
to ravens fan,
Oh i see, sorry for not figuring out your answer in your 1st reply. you mean "old val & new val" nodes inside border of event structure (not in case structure). yes it working now. i did'nt figure it out before coz' im not often using this event strucure in my previous programs. anyway thanks!