Pulse Signal On Dac Channel


Recommended Posts

Depends on how fast the pulse. The most reliable way is to actually use the PWM feature of LabJack timers. The DAQFactory - LabJack application guide shows how to do that. Alternatively, if timing isn't critical and the period is long, you can do a sequence:


while(1)
out = 1
delay(0.1)
out = 0
delay(0.1)
endwhile

[/CODE]

Link to comment
Share on other sites

  • 11 months later...

I want set dac channel low pulse with 10ms tolerance 1ms at UE-9, but delay() has jitter 10..20ms.

dac0=0

delay(0.01)

dac0=5

How can i set the DAC-Channel with PWM feature? (imho DAQFactory Labjack Application Guide wants to set a digital timer output)

Link to comment
Share on other sites

You can't do it in software for two reasons:

 

1) windows is not a true preemptive multitasking environment.  This means that at any time, the OS can decide it needs the processor for something else.  There are some tricks you can do to get jitter down, but I generally say that you can not reliably do anything with under 20ms jitter.  This is amplified by item #2:

2) if you are connecting over USB, there is something like a 4-5ms communications delay / jitter in the LabJack driver itself.  If you are over Ethernet I don't know what the jitter would be, it would depend on whether you were going through the LabJack driver or direct over Modbus.

 

As I said, there are ways of getting the OS jitter way down, but not much you can do about the USB / comms jitter.  Really, you need to do this in hardware using a LabJack timer mode.  I'm not sure why you wouldn't want to do that.

Link to comment
Share on other sites

Thank you for clarification, and I think the answer to the question: "How can i set the DAC-Channel with PWM feature?" is none.

 

Maybe it is more related to UE9-forum.

My next try is to set the stream dac for the low pulse (analog channel is required), but i dont find an example how to manage in DAQFactory.

Stream 100Hz -> 10ms fo r1 position (repetive all 160ms if no stop)

 

AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chSTREAM_SCAN_FREQUENCY, 100, 0, 0) // set rate to 100Hz

AddRequest(ID, LJ_ioCLEAR_STREAM_CHANNELS, 0, 0, 0, 0)

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 0, 0, 0, 0) // stream channel dummy adc0

GoOne(ID) // do initialization requests

eGet(ID,LJ_ioSTART_STREAM, 0, @scanrate, 0) // start streaming

ePut(ID, LJ_ioADD_STREAM_DAC, 0, 16, {-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,-1}) //? it hangs

Link to comment
Share on other sites

Here is a general app note about waveform generation:

 

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

 

Using a timer to create your pulse would be great for a 3.3V pulse.  Do you need a variable voltage or a constant voltage besides 3.3V?  Is that why you want to use a DAC output?  Perhaps you can use a timer output pulse to control a gate/switch on the DAC output?

 

 

Stream-DAC is a UE9 feature documented here:

 

http://labjack.com/support/ue9/users-guide/4.3.7.1

 

 

I don't see that we have a Stream-DAC example for DAQFactory.  I just found C++ and LabVIEW.  I suggest you start with a DF stream example such as "StreamOneChannel_UD.ctl":

 

http://labjack.com/support/ud/examples/daqfactory

 

Confirm that works without any changes, then try to add the stream-dac.  I believe eGet() is the only function you can use to pass arrays in DF, so you will likely do an eGet(ID, LJ_ioADD_STREAM_DAC, ....) before you start the stream.

Link to comment
Share on other sites

Oh, an example would be fine :-)

 

My application is a testbench for prototypes, their power supply is controlled by the dac.

I want this feature to see the influence (all other UE9-pins used) of defined higher/lower/failure pulses.

 

Maybe DAQFactory Express dislikes access without link to declaration in the (limited) channel list.

 

I tried it ones more with the fine working stream examples: eGet(.. and ePut(.. results in a hang here,

if the parameter numUpdates is more than zero.

Link to comment
Share on other sites

Archived

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