measure time between rising edges


VreesR01

Recommended Posts

Hello,

I am working with labjack U12 with DAQ factory Express release 5.40

I want to measure time between the rising ege of digital input IO0 and IO1

Channel IO0 is called start and Channel IO1 is called stop

On both channels I create a channel event like this

If (start[0] && ! start [1])
global starttime = systime
endif

Lateron ik wil substract the values to get the time between the edges

This is the problem:

When I startup the program I receive error C.1086 "one of the parameters was empty line 1".

When I give a rising edge on channel start ,the systime is copied into global starttime ; and the error message C.1086 is gone , the copying in the channel event works only once.

I like to do several measurements

What am I doing wrong??

Link to comment
Share on other sites

A number of things I'm afraid. Your syntax and logic is a bit off:

1) this one doesn't completely matter except aesthetics: too many random spaces in the first line:

If (start[0] && ! start [1])

should be

if (start[0] && !start[1])

2) systime is a function, not a variable, so its systime()

3) you assign systime() to a global, but you have this event in two different channels and if they are the same code, you need to have two different globals. Also, you'd need to change start to match the channel

That's actually it. It should work then. You get the initial error message because start[1] doesn't exist when the first data point comes in. Only start[0] exists. The next iteration it does, so its nothing to worry about.

Link to comment
Share on other sites

What release of DAQFactory are you running? (go to help-about) You may need to upgrade to the latest by either going to www.azeotech.com or www.daqexpress.com if you are using Express. If you are already running a recent release, I'll need to see your .ctl doc to see what you have done.

Link to comment
Share on other sites

Archived

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