Scripting -Ramped Output With Simultaneuos Input


benndorf

Recommended Posts

I am a new user of Labjack U12 and Daqfactory Express.

For my measurement I need I ramped output, 0 to 5 Volts in steps of 0.05 V with a deleay (channel AO0, "Output").

For each steps I want to measure an input voltage (channel AI0, "MyChannel").

I used a script from the LJGuideSamples/RampsSample.ctl

and made my own modification:

using("device.labjack")

include(c:\daqfactory\labjackud.h")

private err

private val

Output=o

while(Output<5)

Output = Output +0.05

err=eGet(0,LJ_ioGet_AIN,0,@val,0)

MyChannel-AddValue(val)

endwhile

When I startet the sequence, it works fine, but...

I get the ramp, I can see the incoming values from "MyChannel".

But when the ramp is finished, "MyChannel" is still reading data.

What I need is the following:

Each time the sequence set a new step in the ramp, I want to read a value from "MyChannel". If the ramp has finished, I want also to finish the reading of "My Channel".

How can this be done?

I am looking forward for usefull help.

Carsten, from Lima, Peru

Link to comment
Share on other sites

I'm assuming the typos in the script are from you retyping it? For example Output = o, I think you meant = 0 (zero, not the letter O), likewise, its myChannel.addValue() not myChannel-addvalue.

I'm guessing that myChannel has a non-zero timing, thus the reason it keeps reading. Just set the timing to 0. Also, you can avoid using eGet() by making myChannel the appropriate LabJack channel, timing = 0, then use:

read(myChannel)

instead of the err= and addvalue() lines.

Link to comment
Share on other sites

Dear Mr. Guru,

thank you very much for your prompt reply.

Yes, by retyping I made the two errors you mentioned.

I changed the timing for " MyChannel" to timing = 0.00

Instead of err= and addvalues I used read().

However, after the output ramp has finished, the input channel "MyChannel" is still reading data. What the hell I am doing wrong?

Again, thank you for your help.

Carsten

Link to comment
Share on other sites

Again, thank you very much for your help. I solved the problem. But...

I wrote a new script, also based on the LJGuideSamples and made my own modifications. Now it works fine.

But I really dont know, what was wrong with my first scipt. Anywhow, I am now quite satisfied.

Best ragards

Carsten

Link to comment
Share on other sites

Archived

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