Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implement synchronous digital outputs for AWG #40

Open
crnbaker opened this issue Jan 11, 2024 · 0 comments
Open

Implement synchronous digital outputs for AWG #40

crnbaker opened this issue Jan 11, 2024 · 0 comments
Assignees

Comments

@crnbaker
Copy link
Collaborator

from the M2p-65xx AWG manual: "This mode allows the user to replay up to four additional digital channels that are synchronous and phase stable along with the analog data."

The digital waveform must be encoded in the analog samples like this:

def write_digital_waveform_to_bit_15_of_analog(

    digital_waveform: NDArray[bool_], analog_waveform: NDArray[int16]

) -> NDArray[int16]:

    if analog_waveform.shape != digital_waveform.shape:

        raise ValueError("Analog and digital waveforms must have the same shape.")

    analog_waveform &= ~1  # Clear the least significant bit

    analog_waveform |= digital_waveform.astype(int16)  # Set the least significant bit using bitwise OR

    return analog_waveform

and then the mode enabled something like this:

analog_waveform = write_digital_waveform_to_bit_15_of_analog(digital_wfm, analog_wfm)
card.io_lines[0].set_mode(IOLineMode.SPCM_XMODE_DIGOUT)

card.io_lines[0].set_dig_out_settings(
    
DigOutIOLineModeSettings(

        source_channel=DigOutSourceChannel.SPCM_XMODE_DIGOUTSRC_CH0,
        source_bit=DigOutSourceBit.SPCM_XMODE_DIGOUTSRC_BIT15,

     )
)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant