PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to operate PXI6739 in continuous aquisition mode in python nidaqmx api but in NIMAX it works.

import nidaqmx
from nidaqmx.constants import AcquisitionType, VoltageUnits, TerminalConfiguration

in_channels = 1
out_channels = 1
# Define your input and output channels
input_channels = ["PXI1Slot2/ai{_i}".format(_i=i) for i in range(in_channels)]
output_channels = ["PXI1Slot4/ao{_i}".format(_i=i) for i in range(out_channels)]

# Create tasks
with nidaqmx.Task() as input_task, nidaqmx.Task() as output_task:
    # Configure the input task for hardware-timed voltage measurement
    input_task.ai_channels.add_ai_voltage_chan(",".join(input_channels))
    # input_task.timing.cfg_samp_clk_timing(
    #     rate=1000,  # Set your desired sampling rate (samples per second)
    #     sample_mode=AcquisitionType.FINITE,
    #     samps_per_chan=10,  # Set the total number of samples to read
    # )

    # Configure the output task for hardware-timed voltage generation
    output_task.ao_channels.add_ao_voltage_chan(",".join(output_channels))
    output_task.timing.cfg_samp_clk_timing(
        rate=10000,  # Set your desired sampling rate (samples per second)
        sample_mode=AcquisitionType.CONTINUOUS,
        samps_per_chan=1000,  # Set the total number of samples to read
    )

    # Start the tasks
    # input_task.start()
    # output_task.start()

    step = 0
    try:
        while True:
            # Read data from the input task
            input_data = input_task.read()

            # Modify the output based on your logic
            if step % 2 == 0:
                output_task.write(5)
            else:
                output_task.write(0)

            step += 1

    except KeyboardInterrupt:
        # Handle user interruption (e.g., Ctrl+C) by stopping and closing tasks
        input_task.stop()
        output_task.stop()
 
DaqWriteError: Non-buffered hardware-timed operations are not supported for this device and Channel Type. Set the Buffer Size to greater than 0, do not configure Sample Clock timing, or set Sample Timing Type to On Demand. Task Name: _unnamedTask<5> Status Code: -201025
0 Kudos
Message 1 of 3
(590 Views)

Are you sure the error is coming from 6739? 
PXI-6739 is an Analog Output module and does not support AI. What is the hardware in slot2? What if you comment out all the code on AI?

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 2 of 3
(567 Views)

The device in slot 2 is PXI-4481. 

I am trying to operate both PXI-4481 and 6739 in hardware timed mode. It does not raise error when I am simulating the hardware. But I am not able to set the 6739 in hardware timed mode. I am however able to set the 4481 in hardware timed mode.

0 Kudos
Message 3 of 3
(537 Views)