Jump to content

trent r

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by trent r

  1. Oh interesting! We should be calling ul.ignore_instacal() before setting up the DAQ (which I forgot to include in my stub code - my bad on that! The full code is located below). Changing Ch23's rate to 3750 in InstaCal did resolve it, despite the call to ul.ignore_instacal(). Thanks for the help! from __future__ import absolute_import, division, print_function from _ctypes import POINTER, addressof, sizeof from ctypes import c_double, cast import math import time import numpy as np import matplotlib.pyplot as plt import scipy.signal as signal from builtins import * # @UnusedWildImport from mcculw import ul from mcculw.enums import ULRange, InfoType, BoardInfo, AiChanType, AnalogInputMode, ScanOptions, FunctionType, InterfaceType, Status, DigitalPortType from examples.console import util from examples.props.ao import AnalogOutputProps from examples.props.ai import AnalogInputProps from mcculw.ul import ULError try: ul.ignore_instacal() device = ul.get_daq_device_inventory(InterfaceType.ANY)[0] board_num = 0 ul.create_daq_device(board_num, device) dout_low_chan = 0 dout_high_chan = 0 dout_total_count = 10240 dout_rate = 1000 dout_ao_range = ULRange.BIP10VOLTS dout_memhandle = ul.win_buf_alloc(10240) dout_scan_options = (ScanOptions.BACKGROUND | ScanOptions.CONTINUOUS) low_chan = 0 high_chan = 1 ul_buffer_count = 3300 rate = 550 ai_range = ULRange.BIP10VOLTS memhandle = ul.scaled_win_buf_alloc(3300) scan_options = (ScanOptions.BLOCKIO | ScanOptions.BACKGROUND | ScanOptions.CONTINUOUS | ScanOptions.SCALEDATA) chan_array = [0,23] gain_array = [ULRange.BIP10VOLTS,ULRange.BIP10VOLTS] ul.a_out_scan(board_num, dout_low_chan, dout_high_chan, dout_total_count, dout_rate, dout_ao_range, dout_memhandle, dout_scan_options) ul.a_load_queue(board_num, chan_array, gain_array, len(chan_array)) ul.a_in_scan(board_num, low_chan, high_chan, ul_buffer_count, rate, ai_range, memhandle, scan_options) finally: ul.stop_background(board_num, FunctionType.AOFUNCTION) ul.stop_background(board_num, FunctionType.AIFUNCTION) ul.win_buf_free(dout_memhandle) ul.win_buf_free(memhandle)
  2. I am using a USB-2416-4AO with AI-EXP32 expansion board and am getting an Error 24: Invalid Sampling Rate. This code works properly using on other DAQ / PC pairs so there must be something wrong with my setup. The DAQ is using the latest firmware (2.03). A colleague recalls seeing something similar when the DAQ came back from calibration and was still in some "calibration" configuration rather than its normal state but does not recall the details - could this be the cause here? Any other suggestions? board_num = 0 dout_low_chan = 0 dout_high_chan = 0 dout_total_count = 10240 dout_rate = 1000 dout_ao_range = ULRange.BIP10VOLTS dout_memhandle = ul.win_buf_alloc(10240) dout_scan_options = (ScanOptions.BACKGROUND | ScanOptions.CONTINUOUS) low_chan = 0 high_chan = 1 ul_buffer_count = 3300 rate = 550 ai_range = ULRange.BIP10VOLTS memhandle = ul.scaled_win_buf_alloc(3300) scan_options = (ScanOptions.BLOCKIO | ScanOptions.BACKGROUND | ScanOptions.CONTINUOUS | ScanOptions.SCALEDATA) chan_array = [0,23] gain_array = [ULRange.BIP10VOLTS,ULRange.BIP10VOLTS] ul.a_out_scan(board_num, dout_low_chan, dout_high_chan, dout_total_count, dout_rate, dout_ao_range, dout_memhandle, dout_scan_options) ul.a_load_queue(board_num, chan_array, gain_array, len(chan_array)) ul.a_in_scan(board_num, low_chan, high_chan, ul_buffer_count, rate, ai_range, memhandle, scan_options) # Running this line results in Error 24
×
×
  • Create New...