PW Modulated DAC output | LabJack
 

PW Modulated DAC output

7 posts / 0 new
Last post
Rachel
Rachelie's picture
PW Modulated DAC output

I'm having trouble creating a square-wave DAC output. I'm using the U6 pro. 

I've set a timer with the desired duty-cycle to FIO0 and would like to do the same for DAC0, however it doesn't seem like a timer can be set to a DAC channel. I need FIO0 and DAC0 to be synchronized, so a 'wait' technique as suggested in the 'Wave form generation' app note doesn't seem to be relevant. 

I'm using MATLAB.

How can I synchronize DAC0 to match the timer? 

LabJack Support
LabJack Support's picture
I think the best solution

I think the best solution will be to use an op-amp to amplify the PWM from FIO0 to the desired voltage level.

There is no internal mechanism to allow a PWM to be output to a DAC. T-series devices could do this with a Lua-Script, but there would be a few microseconds of phase lag.

 

Rachel
Rachelie's picture
Hi, 

Hi, 

Thank you for the quick answer. Unfortunately, for the intended purpose of this project, I have to create a squae wave on the DAC that will be synchronized with the same square wave on a digital hannel. 

 

Is there any way to do so using the u6?

Rachel
Rachelie's picture
Follow - up question:

Follow - up question:

I'd like to take input measurements only when the output square-wave signal is 'on'. Is there a way to synchronize the acquisition with the output timing? Also - How can I store such measurements?

 

an example for clarity:

output signal is 'on' -> start acquiring data -> output signal is 'off' -> stop aquiring data and store the measurements->repeat. 

LabJack Support
LabJack Support's picture
How fast are all these things

How fast are all these things happening?  Frequency of outputs?  Sampling rate of input?  How many channels of output and input?

Why are you a making a square wave with DAC0 rather than just using 2 timers?

Rachel
Rachelie's picture
output frequency - 256 hz,

output frequency - 256 hz, with 0.51% duty cycle (about 20 us 'on' and 3.98 ms 'off').

one input channel, with sampling rate of 1khz (can be changed).

DAC - because i've been requested to do so, otherwise I would have used two timers.

LabJack Support
LabJack Support's picture
It sounds like you have seen

It sounds like you have seen the waveform generation app note:

https://labjack.com/support/app-notes/waveform-generation

The only solution that I see possibly working for you is stream-out on the T7.

With AIN0, DAC0, and FIO_STATE, you have 3 channels so your max scan rate is 100k/3 = 33.3 kscans/second.  That means your timing resolution is 30 us.

With AIN0 and FIO_STATE, you have 2 channels so your max scan rate is 100k/2 = 50 kscans/second.  That means your timing resolution is 20 us.  FIO_STATE lets you update up to all 8 FIO with a single channel so could get 2 rectangular outputs using this single channel.