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

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.

Thanks,
Hiroyuki
Reply
#2
Hello Hiroyuki,

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

Code:
W.TriggerProfileEnable = 'On';

Then set a trigger profile to indicate Ch1-->Waveform1, Ch2-->Waveform2
Code:
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:
Code:
{'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!

-Josh
Reply
#3
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?

Hiroyuki
Reply
#4
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.

-Josh
Reply
#5
I got it.  Thanks!

Hiroyuki
Reply


Forum Jump: