U12, How To Increase The D-A Resolution To 12 Bits


benndorf

Recommended Posts

I use a ramp of 0 -5 V of my LabJack U12 to control a spectrometer. For survey spectra the 10 bit resolution (5mV steps) is sufficient. For detailed analysis, however, I needed to increase the resolution to 12 bit (1 mV steps).

This I achived using simultaneously both D-A outputs of the U12 and a differential opamp amplifier used as a "summer". The first outputs from the U12 was used in fixed steps of 0, 1, 2, ... 4 V. And added to this (by the "summer") a ramp with steps of 5mV, which were divided by 5 by the "summer" in order to achieve the desired steps of 1 mV. This gives for the whole range of 0 - 5 V a resulution of 1mV. It works!

I attached a fig. of the simple circuit for the "summer" with the differential amplifier (I used a LF 356); total cost of the parts about 10 -15 US$. Power supply (+12V, -12V) were obtained from the PC AT power supply.

For me, there is still an open problem in the programming, which I have not yet solved.

?Is it possible to use in the DAQFactory script nestled loops of the following form:

while ...//steps of 0, 1, 2,...4

while ....//steps of 0.005 up to 1

.....

.....

endwhile

endwhile

I tried to write a script in this way. But it did not do what I exspected. The ramp stoped after the first run of the nestled loop.

Is there another way of programming? I am allways very pleased with the help from this forum.

Carsten Benndorf, from Lima, Peru

post-8873-0-12906400-1361552223_thumb.jp

Link to comment
Share on other sites

Thanks for posting the circuit. You may also want to post it to the forum on the LabJack.com site.

You can certainly do nested loops. DAQFactory supports all the standard programming structures. I'd have to see your actual script to identify what may be wrong.

Link to comment
Share on other sites

Dear DAQFactory forum,

Dear Mr. Guru,

concerning the nested loops I am looking forward for your advice. Here is the script, which I tried to use:

// Spectrometer Control
private low=2
private high =5
private step = 0.01
private t = 0.5
Output0= low
Output1=0
//output0 is the coarse voltage setting (0, 1, ....4)
//output1 is the ramp which increases in steps of 100 mV (finally 5 mV)
while(Output0 < high)
while(Output1<1)
Output1 = Output1 + step
read(Input)
delay(t)
endwhile
Output0=Output0 +1
endwhile[/CODE]

When I start this script, the ramp with "Output1" increases from 0 to 1 in the step width 0.01. When it reaches 1 I find that "Output0" is set from 2 to 3.

But then the program stops. What I want is that the "Output1" starts again (from 0 to 1 in steps 0.01) and then the "Output0" is going to 4

and finally stops when the "Output1" ramp has finished.

What is wrong with my script?

Saludos cordiales

Carsten

Link to comment
Share on other sites

First, watch your indentation. You should indent with every while() and outdent with the endwhile. Same goes for if(), for(), etc. I've corrected it for you.

I'd recommend creating a function to set the output to any particular voltage, and then doing a simple ramp. The function would be something like:

function setOutput(voltage)

output0 = floor(voltage)

output1 = (voltage & 1) * 5

Just create a sequence called setOutput and put that code in there. Voltage & 1 simply returns the decimal part of voltage, and from what I read from your post, you want to output 5x that part.

Then to do the ramp, just do:


private low = 2
private high = 5
private cur = low
private step = 0.01
private interval = 0.5
while (cur < high)
setOutput(cur)
cur += step
delay(interval)
endwhile

[/CODE]

The nice part about this way is you can call setOutput() from just about any script and have it output the right amount on both outputs. Also, if you change the scaling factor on Output 2, you only have to change one place.

Link to comment
Share on other sites

Agree that moving the nuts and bolts to a function is a much better approach. However, if I were going to encapsulate it into a general use function (which suggests it's availability for future use), I think i'd do it in such a way as not to throw away most of the resolution of the MS channel. I'd use a minimum of 256-512 steps on the "outer" channel, so you'd get 18 or 19 bits worth total. It'd mean tweaking the op-amp circuit slightly, but it would give you far more available resolution with no downside that I can see.

Link to comment
Share on other sites

Archived

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