File MIES_DAC-Hardware.ipf¶
HW Low level hardware configuration and querying functions
Naming scheme of the functions is HW_$TYPE_$Suffix
where $TYPE
is one of ITC
or NI
.
Error codes for the ITC XOP2
Generic check for NIDAQmx XOP
In case newer functions are required which might not be present in all NIDAQmx XOP versions, check for their existance directly
-
static const double OLD_IGOR = 10001¶
-
static const double UNHANDLED_CPP_EXCEPTION = 10002¶
-
static const double SLOT_LOCKED_TO_OTHER_THREAD = 10003¶
-
static const double SLOT_EMPTY = 10004¶
-
static const double COULDNT_FIND_EMPTY_SLOT = 10005¶
-
static const double ITC_DLL_ERROR = 10006¶
-
static const double INVALID_DEVICETYPE_NUMERIC = 10007¶
-
static const double INVALID_DEVICETYPE_STRING = 10008¶
-
static const double DTN_DTS_DISAGREE = 10009¶
-
static const double INVALID_CHANNELTYPE_NUMERIC = 10010¶
-
static const double INVALID_CHANNELTYPE_STRING = 10011¶
-
static const double CHN_CHS_DISAGREE = 10012¶
-
static const double MUST_SPECIFY_CHN_OR_CHS = 10013¶
-
static const double ITCCONFIGCHANNEL2_BAD_S = 10014¶
-
static const double ITCCONFIGCHANNEL2_BAD_M = 10015¶
-
static const double ITCCONFIGCHANNEL2_BAD_A = 10016¶
-
static const double ITCCONFIGCHANNEL2_BAD_O = 10017¶
-
static const double ITCCONFIGCHANNEL2_BAD_U = 10018¶
-
static const double NEED_MIN_ROWS = 10019¶
-
static const double F_FLAG_REQ_ITC18_18USB_1600 = 10020¶
-
static const double D_FLAG_REQUIRES_ITC1600 = 10021¶
-
static const double H_FLAG_REQUIRES_ITC1600 = 10022¶
-
static const double R_FLAG_REQUIRES_ITC1600 = 10023¶
-
static const double THREAD_DEVICE_ID_NOT_SET = 10024¶
Wrapper functions redirecting to the correct internal implementations depending on #HARDWARE_DAC_TYPES
-
variable HW_PrepareAcq(variable hardwareType, variable deviceID, variable mode, WaveOrNull data = defaultValue, HW_WAVE_GETTER_PROTOTYPE dataFunc = defaultValue, WaveOrNull config = defaultValue, HW_WAVE_GETTER_PROTOTYPE configFunc = defaultValue, variable flags = defaultValue, variable offset = defaultValue)¶
Prepare for data acquisition.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
mode – one of DATA_ACQUISITION_MODE or TEST_PULSE_MODE
data – hardware data wave
dataFunc – [optional, defaults to GetDAQDataWave()] override wave getter for the ITC data wave
config – ITC config wave
configFunc – [optional, defaults to GetDAQConfigWave()] override wave getter for the ITC config wave
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
offset – [optional, defaults to zero] offset into the data wave in points
-
variable HW_SelectDevice(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Select a device.
Only used in special cases for ITC hardware as all ITC operations use the
/DEV
flag nowadays.- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – identifier of the device
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
- Returns:
0 if sucessfull, 1 on error
-
variable HW_OpenDevice(string deviceToOpen, variable *hardwareType, variable *flags = defaultValue)¶
Open a device.
- Parameters:
deviceToOpen – device
hardwareType – One of HardwareDACTypeConstants
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
- Returns:
device identifier
-
variable HW_CloseDevice(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Close a device.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_WriteDAC(variable hardwareType, variable deviceID, variable channel, variable value, variable flags = defaultValue)¶
Write a value to a DA/AO channel.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
channel – hardware channel number
value – value to write in volts
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_ReadADC(variable hardwareType, variable deviceID, variable channel, variable flags = defaultValue)¶
Read a value from an AD/AI channel.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
channel – hardware channel number
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
- Returns:
value in volts
-
variable HW_ReadDigital(variable hardwareType, variable deviceID, variable channel, variable line = defaultValue, variable flags = defaultValue)¶
Read from a digital channel.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
channel – The hardware documentation terms this as port(NI). For the ITC we call that ttlBit. Takes care of special rack handling for the ITC 1600. Range depends on hardware and hardware type.
line – bit of TTL line, (only for hardware types which support single TTL writes/read)
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
- Returns:
bitmask denoting the state of the channel/line
-
variable HW_WriteDigital(variable hardwareType, variable deviceID, variable channel, variable value, variable line = defaultValue, variable flags = defaultValue)¶
Write to a digital channel.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
channel – The hardware documentation terms this as port(NI). For the ITC we call that ttlBit. Takes care of special rack handling for the ITC 1600. Range depends on hardware and hardware type.
value – bitmask to write
line – bit of TTL line, (only for hardware types which support single TTL writes/read)
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_EnableYoking(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Enable yoking.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_DisableYoking(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Enable yoking.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_StopAcq(variable hardwareType, variable deviceID, variable prepareForDAQ = defaultValue, variable zeroDAC = defaultValue, variable flags = defaultValue)¶
Stop data acquisition.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
prepareForDAQ – immediately prepare for the next data acquisition after stopping it
zeroDAC – set all used DA channels to zero
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_IsRunning(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Determine if data acquisition is currently active.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
- Returns:
one if running, zero otherwise
-
wave HW_GetDeviceInfo(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Return hardware specific information from the device.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
- Returns:
free numeric/text wave with information and dimension labels
-
wave HW_GetDeviceInfoUnregistered(variable hardwareType, string device, variable flags = defaultValue)¶
Return hardware specific information from the device.
This function does not require the device to be registered compared to HW_GetDeviceInfo().
- Parameters:
hardwareType – One of HardwareDACTypeConstants
device – name of the device
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_WriteDeviceInfo(variable hardwareType, string device, wave deviceInfo)¶
Fill the device info wave.
-
variable HW_StartAcq(variable hardwareType, variable deviceID, variable triggerMode = defaultValue, variable flags = defaultValue, variable repeat = defaultValue)¶
Start data acquisition.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
triggerMode – [optional, defaults to HARDWARE_DAC_DEFAULT_TRIGGER] one of TriggerModeStartAcq
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
repeat – [optional, default 0] for NI devices, repeats the scan after it ends
-
variable HW_ResetDevice(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Reset the device.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_AssertOnInvalid(variable hardwareType, variable deviceID)¶
Assert on using an invalid value of
hardwareType
ordeviceID
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
-
static variable HW_IsValidHardwareType(variable hardwareType)¶
Check if the given hardware type is valid.
Invalid here means that the value is out-of-range.
-
static variable HW_IsValidDeviceID(variable deviceID)¶
Check if the given device ID is valid.
Invalid here means that the value is out-of-range.
-
variable HW_RegisterDevice(string mainDevice, variable hardwareType, variable deviceID, string pressureDevice = defaultValue)¶
Register an opened device in our device map.
- Parameters:
mainDevice – Name of the DA_EPhys device
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
pressureDevice – required for registering pressure control devices
-
variable HW_DeRegisterDevice(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Deregister an opened device in our device map.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
deviceID – device identifier
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
string HW_GetMainDeviceName(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Return the name of the main device given the
deviceID
and thehardwareType
Use this function if you want to derive a storage location from the device name.
- Parameters:
deviceID – device identifier
hardwareType – One of HardwareDACTypeConstants
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
string HW_GetDeviceName(variable hardwareType, variable deviceID, variable flags = defaultValue)¶
Return the name of the device given the
deviceID
and thehardwareType
Prefers the pressure device name if set.
- Parameters:
deviceID – device identifier
hardwareType – One of HardwareDACTypeConstants
flags – [optional, default none] One or multiple flags from HardwareInteractionFlags
-
variable HW_GetEffectiveADCWaveLength(string device, variable dataAcqOrTP)¶
Generic function to retrieve the wave length of ADC channel(s). For ITC this is defined through stopCollectionPoint, for other devices like NI the acquisition wave had the correct size and the value can be retrieved directly from that wave.
See also
DataAcqModes
- Parameters:
device – device name
dataAcqOrTP – data acquisition or tp mode
- Returns:
effective size of ADC channel wave (for ITC the actual size is bigger)
-
variable HW_GetEffectiveDACWaveLength(string device, variable dataAcqOrTP)¶
-
variable HW_GetDAFifoPosition(string device, variable dataAcqOrTP)¶
-
std::tuple<variable, variable> HW_GetVoltageRange(variable hardwareType, variable channelType, variable isAssociated)¶
Return the minimum/maximum voltage ranges for the given hardware and channel type.
- Parameters:
hardwareType – One of HardwareDACTypeConstants
channelType – One of XopChannelConstants
isAssociated – For Sutter hardware the voltage range differs for associated channels or unassociated ones
ITC
-
string HW_ITC_BuildDeviceString(string deviceType, string deviceNumber)¶
Build the device string for ITC devices.
There is no corresponding function for other hardware types like NI devices because those do not have a two part device name
-
string HW_ITC_ListOfOpenDevices()¶
-
string HW_ITC_ListDevices()¶
-
variable HW_ITC_HandleReturnValues(variable flags, variable ITCError, variable ITCXOPError)¶
-
static string HW_ITC_GetXOPErrorMessage(variable errCode)¶
-
variable HW_ITC_OpenDevice(variable deviceType, variable deviceNumber, variable flags = defaultValue)¶
-
variable HW_ITC_CloseAllDevices(variable flags = defaultValue)¶
-
variable HW_ITC_CloseDevice(variable deviceID, variable flags = defaultValue)¶
-
variable HW_ITC_SelectDevice(variable deviceID, variable flags = defaultValue)¶
-
wave HW_ITC_GetDeviceInfo(variable deviceID, variable flags = defaultValue)¶
-
variable HW_ITC_EnableYoking(variable deviceID, variable flags = defaultValue)¶
-
variable HW_ITC_DisableYoking(variable deviceID, variable flags = defaultValue)¶
-
variable HW_ITC_StopAcq_TS(variable deviceID, variable prepareForDAQ = defaultValue, variable flags = defaultValue)¶
-
variable HW_ITC_StopAcq(variable deviceID, WaveOrNull config = defaultValue, HW_WAVE_GETTER_PROTOTYPE configFunc = defaultValue, variable prepareForDAQ = defaultValue, variable zeroDAC = defaultValue, variable flags = defaultValue)¶
-
variable HW_ITC_GetCurrentDevice(variable flags = defaultValue)¶
-
static wave HW_ITC_GetFifoPosFromConfig(wave config_t)¶
-
variable HW_ITC_ResetFifo_TS(variable deviceID, wave config, variable flags = defaultValue)¶
-
variable HW_ITC_ResetFifo(variable deviceID, WaveOrNull config = defaultValue, HW_WAVE_GETTER_PROTOTYPE configFunc = defaultValue, variable flags = defaultValue)¶
-
variable HW_ITC_StartAcq_TS(variable deviceID, variable triggerMode, variable flags = defaultValue)¶
-
variable HW_ITC_StartAcq(variable deviceID, variable triggerMode, variable flags = defaultValue)¶
-
variable HW_ITC_IsRunning(variable deviceID, variable flags = defaultValue)¶
-
wave HW_ITC_GetState(variable deviceID, variable flags = defaultValue)¶
-
variable HW_ITC_ReadADC(variable deviceID, variable channel, variable flags = defaultValue)¶
-
variable HW_ITC_WriteDAC(variable deviceID, variable channel, variable value, variable flags = defaultValue)¶
-
variable HW_ITC_ReadDigital(variable deviceID, variable xopChannel, variable flags = defaultValue)¶
-
variable HW_ITC_WriteDigital(variable deviceID, variable xopChannel, variable value, variable flags = defaultValue)¶
-
variable HW_ITC_DebugMode_TS(variable state, variable flags = defaultValue)¶
-
variable HW_ITC_DebugMode(variable state, variable flags = defaultValue)¶
-
variable HW_ITC_PrepareAcq(variable deviceID, variable mode, WaveOrNull data = defaultValue, HW_WAVE_GETTER_PROTOTYPE dataFunc = defaultValue, WaveOrNull config = defaultValue, HW_WAVE_GETTER_PROTOTYPE configFunc = defaultValue, variable flags = defaultValue, variable offset = defaultValue)¶
-
variable HW_ITC_MoreData_TS(variable deviceID, variable ADChannelToMonitor, variable stopCollectionPoint, wave config, variable *fifoPos = defaultValue, variable flags = defaultValue)¶
-
variable HW_ITC_MoreData(variable deviceID, variable ADChannelToMonitor = defaultValue, variable stopCollectionPoint = defaultValue, WaveOrNull config = defaultValue, HW_WAVE_GETTER_PROTOTYPE configFunc = defaultValue, variable *fifoPos = defaultValue, variable flags = defaultValue)¶
-
wave HW_ITC_GetVersionInfo(variable flags = defaultValue)¶
-
variable HW_ITC_SetLoggingTemplate(string template, variable flags = defaultValue)¶
-
wave HW_WAVE_GETTER_PROTOTYPE(string str)¶
-
wave HW_ITC_Transpose(wave wv)¶
-
wave HW_ITC_TransposeAndToInt(wave wv)¶
Utility functions not interacting with hardware
-
variable HW_ITC_CalculateDevChannelOff(string device)¶
Returns the device channel offset for the given device.
- Returns:
16 for ITC1600 and 0 for all other types
-
variable HW_ITC_GetRackRange(variable rack, variable *first, variable *last)¶
Return the
first
andlast
TTL bits/channels for the givenrack
-
variable HW_ITC_ClipTTLBit(string device, variable ttlBit)¶
Clip the ttlBit to adapt for differences in notation.
The DA_Ephys panel e.g. labels the first ttlBit of RACK_ONE as 4, but the ITC XOP treats that as 0.
-
variable HW_ITC_GetRackForTTLBit(string device, variable ttlBit)¶
Return the rack number for the given ttlBit (the ttlBit is called
TTL channel
in the DA Ephys panel)
-
variable HW_ITC_GetITCXOPChannelForRack(string device, variable rack)¶
Return the ITC XOP channel for the given rack.
Only the ITC1600 has two racks. The channel numbers differ for the different ITC device types.
-
variable HW_ITC_GetNumberOfRacks(string device)¶
Get the number of racks for the given device.
ITC1600 can have 1 or 2 racks
other device types have 1
-
variable HW_ITC_AssertOnInvalid(string deviceName)¶
Assert on using an invalid ITC device name.
- Parameters:
deviceName – ITC device name
-
variable HW_ITC_IsValidDeviceName(string deviceName)¶
Check wether the given ITC device name is valid.
Currently a device name is valid if it is not empty.
NI
-
variable HW_NI_AssertOnInvalid(string deviceName)¶
Assert on using an invalid NI device name.
- Parameters:
deviceName – NI device name
-
variable HW_NI_IsValidDeviceName(string deviceName)¶
Check wether the given NI device name is valid.
Currently a device name is valid if it is not empty.
-
string HW_NI_AnalogInputToString(variable config)¶
Return the analog input configuration bits as string.
- Parameters:
config – Bit combination of NIAnalogInputConfigs
-
variable HW_NI_StartAcq(variable deviceID, variable triggerMode, variable flags = defaultValue, variable repeat = defaultValue)¶
-
variable HW_NI_PrepareAcq(variable deviceID, variable mode, WaveOrNull data = defaultValue, HW_WAVE_GETTER_PROTOTYPE dataFunc = defaultValue, WaveOrNull config = defaultValue, HW_WAVE_GETTER_PROTOTYPE configFunc = defaultValue, variable flags = defaultValue, variable offset = defaultValue)¶
-
string HW_NI_GetPropertyListOfDevices(string device)¶
-
variable HW_NI_PrintPropertiesOfDevices()¶
-
variable HW_NI_ReadDigital(string device, variable DIOPort = defaultValue, variable DIOLine = defaultValue, variable flags = defaultValue)¶
-
variable HW_NI_WriteDigital(string device, variable value, variable DIOPort = defaultValue, variable DIOLine = defaultValue, variable flags = defaultValue)¶
-
variable HW_NI_WriteAnalogSingleAndSlow(string device, variable channel, variable value, variable flags = defaultValue)¶
-
variable HW_NI_ReadAnalogSingleAndSlow(string device, variable channel, variable flags = defaultValue)¶
-
variable HW_NI_GetAnalogInputConfig(string device, variable channel, variable flags = defaultValue)¶
-
string HW_NI_ListDevices(variable flags = defaultValue)¶
-
variable HW_NI_StopAcq(variable deviceID, variable zeroDAC = defaultValue, variable flags = defaultValue)¶
-
variable HW_NI_StopDAC(variable deviceID, variable flags = defaultValue)¶
-
variable HW_NI_StopADC(variable deviceID, variable flags = defaultValue)¶
-
variable HW_NI_StopTTL(variable deviceID, variable flags = defaultValue)¶
-
variable HW_NI_ZeroDAC(variable deviceID, variable flags = defaultValue)¶
-
static variable HW_NI_ResetDevice(string device, variable flags = defaultValue)¶
-
static variable HW_NI_CalibrateDevice(string device, variable force = defaultValue, variable flags = defaultValue)¶
-
variable HW_NI_IsRunning(string device, variable flags = defaultValue)¶
-
variable HW_NI_OpenDevice(string device, variable flags = defaultValue)¶
-
variable HW_NI_CloseDevice(variable deviceID, variable flags = defaultValue)¶
-
wave HW_NI_GetDeviceInfo(string device, variable flags = defaultValue)¶
-
variable HW_NI_ResetTaskIDs(string device)¶
-
variable HW_SU_OpenDevice(variable flags = defaultValue)¶
-
string HW_SU_ListDevices(variable flags = defaultValue)¶
-
variable HW_SU_CloseDevice(variable deviceId, variable flags = defaultValue)¶
-
static variable HW_SU_ResetDevice(variable flags = defaultValue)¶
-
static variable HW_SU_IsRunning(string device)¶
-
variable HW_SU_StopAcq(variable deviceId, variable zeroDAC = defaultValue, variable flags = defaultValue)¶
-
variable HW_SU_PrepareAcq(variable deviceId, variable mode, WaveOrNull data = defaultValue, HW_WAVE_GETTER_PROTOTYPE dataFunc = defaultValue, WaveOrNull config = defaultValue, HW_WAVE_GETTER_PROTOTYPE configFunc = defaultValue, variable flags = defaultValue, variable offset = defaultValue)¶
-
variable HW_SU_StartAcq(variable deviceId, variable flags = defaultValue)¶
-
variable HW_SU_GetADCSamplePosition()¶
-
variable HW_SU_ZeroDAC(variable deviceID, variable flags = defaultValue)¶
-
variable HW_SU_ReadADC(variable deviceID, variable channel, variable flags = defaultValue)¶
-
variable HW_SU_WriteDAC(variable deviceID, variable channel, variable value, variable flags = defaultValue)¶
Variables
-
static const double HW_ITC_RUNNING_STATE = 0x10¶
-
static const double HW_ITC_MAX_TIMEOUT = 10¶
-
static const double HW_ITC_DSP_TIMEOUT = 0x80303001¶
-
static const double SUTTER_CHANNELOFFSET_TTL = 3¶
-
static const double SUTTER_ACQUISITION_FOREGROUND = 1¶
-
static const double SUTTER_ACQUISITION_BACKGROUND = 2¶