capture event time

Recommended Posts

Hi, Guys,

I am new to DAQFactory and currently using the trial version to understand the capability.

I have create a project where there is Com1 having data stream of ASCII "0", "1", "2", "3" OR "4"

I have setup the OnReceive to capture the data into GetCom[0], which will StrToDouble(DataIn), into [0]

I also setup Descriptive Text tool with 5 thresholds, other then "0", the other 4 have unique text to describe their status.

What I need now is,

(1) If "1", "2", "3" or "4" comes, I need to capture the event time and show it. If "0" comes, this event_time display should be clear/blank/hide.


(2) I need to also show a timer_count to show the duration "1", "2", "3" or "4" was ON, once "0", this will also be blank/cleared/hide.


GetCom[0] = "1"

Event_1 29/01/2011 12:22AM 00:00:10 (incr in sec)

Been banging my head for few hours :( ..... need caffeine and guides :blink: .... applicate the help :P .


Link to comment
Share on other sites

You need a global variable to store the time of the last data:

global eventTime = 0

Put that in an auto-start sequence. Then, when you see a value on the comm port, do either:

eventTime = systime()

or, if the value is "0":

eventTime = 0

Then you can display the time only when its not 0 by doing inside a variable value control using something like:

iif(eventTime == 0, "", formatDateTime("%c",eventTime))

For elapsed time, just subtract eventTime from systime:

iif(eventTime == 0, "", formatDateTime("%H%M%S",systime() - eventTime))

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.