01-05-2006 02:42 PM
01-05-2006 03:52 PM
HI,
I had a similar situation a little while ago. I was monitoring temp over 40 hour tests. The spec called for data logging only if the temp went into the "event" zone. When that happened I streamed the data as long as the temp was in the "event" zone. As the project matured, we realized that we wanted the current temp value once per hour if we didn't go into the "event" zone during that hour.
To implement this, you will want to use a programming architecture like a state machine (anything other than a massive side scrolling window, or (shudder...) nested sequence structures).
Starting in the middle of the state diagram (acquisition)..., you will acquire a value. Compare that value to the "event" value. If "event" then log. If not an event, check current time vs start time (**). If current time is one hour since start time (or whatever your time base is) then log the current data, and reset the "hourly log" flag bit (**). Then acquire another data point and repeat.
Looking at the beginning (I used ** to show these items) you will want the: start time, an "hourly log" boolean, and for the file to already be opened before you start.
I should flow pretty natuarally once you try it.
Let me know if you have any questions.
J
Using this you should be able to