Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Waveforms from two analog output module channels

I have a 4-channel Analog Output Module. 
I would like to send one waveform to Ch1 and another to Ch2 simultaneously. 

I did the following to load two waveforms:

W.loadWaveform(1, waveform1);
W.loadWaveform(2, waveform2);
LoadSerialMessages('WavePlayer1', {['P',1,0], ['P',2,1]});

However, I am not sure how to trigger both waveforms simultaneously in the AddState command.

If I do 'OutputActions', {'WavePlayer1',1}  or 'OutputActions', {'WavePlayer1',2}, they individually work as expected.
So, the loading of the waveforms seem to be working.  Would you mind letting me know how to trigger both waveforms?
I tried 'OutputActions', {'WavePlayer1',3}, similar to what I would do for BNCState or WireState, but it did not work for WavePlayer1.

Hello Hiroyuki,

You'll need to enable Trigger Profile mode as per this:

W.TriggerProfileEnable = 'On';

Then set a trigger profile to indicate Ch1-->Waveform1, Ch2-->Waveform2
W.TriggerProfiles(1,:) = [1 2 0 0]; % Set trigger profile 1 (of 64 possible)

Finally, since the device is in trigger profile mode, you can trigger the waveform using a two-byte message as per this:
{'WavePlayer1', ['P' 0]}

'P' is the command to play, and 0 is the trigger profile (zero-indexed because it's an exchange between Arduino boards running compiled c++)

I hope this helps!

Hi Josh,
Thanks!  it worked.
Let me just make sure.  This TriggerProfiles method is necessary only when we want to trigger multiple waveforms in the same state, right?
We can use multiple states (or Global Timer) to trigger waves from multiple channels without TriggerProfiles.  Is this correct?

Hello Hiroyuki,

Correct. Each state takes 100 microseconds to pass through, so you'd have playback of two waveforms out of phase by that amount of time if you triggered each channel in a separate state.

I got it.  Thanks!


Forum Jump: