File MIES_PressureControl.ipf

P Supports use of analog pressure regulators controlled via a ITC device for automated pressure control during approach, seal, break in, and clearing of pipette.


TPbackground can crash while operating pressure regulators if called in the middle of a TP. Need to call P_Pressure control from TP functions that occur between TPs to prevent this from happening

Constants used by pressure control

static const string PRESSURE_CONTROLS_BUTTON_LIST = "button_DataAcq_Approach;button_DataAcq_Seal;button_DataAcq_BreakIn;button_DataAcq_Clear;button_DataAcq_SSSetPressureMan"
static const string PRESSURE_CONTROL_TITLE_LIST = "Approach;Seal;Break In;Clear;Apply"
static const string PRESSURE_CONTROL_CHECKBOX_LIST = "check_DatAcq_ApproachAll;check_DatAcq_SealAll;check_DatAcq_BreakInAll;check_DatAcq_ClearEnable;check_DataAcq_ManPressureAll"
static const string PRESSURE_CONTROL_PRESSURE_DISP = "valdisp_DataAcq_P_0;valdisp_DataAcq_P_1;valdisp_DataAcq_P_2;valdisp_DataAcq_P_3;valdisp_DataAcq_P_4;valdisp_DataAcq_P_5;valdisp_DataAcq_P_6;valdisp_DataAcq_P_7"
static const string PRESSURE_CONTROL_LED_MODE_USER = "valdisp_DataAcq_P_LED_Approach;valdisp_DataAcq_P_LED_Seal;valdisp_DataAcq_P_LED_BreakIn;valdisp_DataAcq_P_LED_Clear"
static const string PRESSURE_CONTROL_USER_CHECBOXES = "check_Settings_UserP_Approach;check_Settings_UserP_Seal;check_Settings_UserP_BreakIn;check_Settings_UserP_Clear"
static const string LOW_COLOR_HILITE = "0;0;0"
static const string ZERO_COLOR_HILITE = "0;0;65535"
static const string HIGH_COLOR_HILITE = "65278;0;0"
static const string LOW_COLOR = "65535;65535;65535"
static const string ZERO_COLOR = "49151;53155;65535"
static const string HIGH_COLOR = "65535;49000;49000"
static const double NEG_PRESSURE_PULSE_INCREMENT = 0.2
static const double POS_PRESSURE_PULSE_INCREMENT = 0.1
static const double PRESSURE_PULSE_ENDpt = 70000
static const double PRESSURE_TTL_HIGH_START = 20000
static const double GIGA_SEAL = 1000
static const double PRESSURE_OFFSET = 5
static const double MIN_NEG_PRESSURE_PULSE = -2
static const double MAX_POS_PRESSURE_PULSE = 0.1
static const double ATMOSPHERIC_PRESSURE = 0
static const double PRESSURE_CHANGE = 1
static const double P_NEGATIVE_PULSE = 0x0
static const double P_POSITIVE_PULSE = 0x1
static const double P_MANUAL_PULSE = 0x2
static const double SEAL_POTENTIAL = -70
static const double SEAL_RESISTANCE_THRESHOLD = 100
static const double ACCESS_ATM = 0
static const double ACCESS_REGULATOR = 1
static const double ACCESS_USER = 2


variable P_PressureControl(string device)

Applies pressure methods based on data in PressureDataWv.

This function gets called by TP_RecordTP. It also gets called when the approach button is pushed. A key point is that data acquisition used to run pressure pulses cannot be active if the TP is inactive.

static variable P_RecordUserPressure(string device)
static variable P_UpdateTPStorage(string device, variable headStage)

Record pressure in TPStorage wave.

static variable P_FindLastSetEntry(wave wv, variable row, variable col, string name)

Return the last non-NaN entry from the wave’s column col and layer name starting from the row row going to 0.

static variable P_AddSealedEntryToTPStorage(string device, variable headstage)
static variable P_MethodAtmospheric(string device, variable headstage)

Sets the pressure to atmospheric.

static variable P_MethodApproach(string device, variable headStage)

Applies approach pressures.

static variable P_MethodSeal(string device, variable headStage)

Applies seal methods.

static variable P_MethodBreakIn(string device, variable headStage)

Applies break-in method.

static variable P_MethodClear(string device, variable headStage)

Applies pipette clearing method.

static variable P_ApplyNegV(string device, variable headStage)

Applies updates the command voltage to the SEAL_POTENTIAL when SEAL_RESISTANCE_THRESHOLD is crossed.

static variable P_UpdateVcom(string device, variable vCom, variable headStage)

Updates the command voltage.

static variable P_CloseDevice(string device)

Determines which devices to close. Ensures all DA_Ephys panels using a particular device for pressure regulation are updated correctly.

static variable P_OpenDevice(string mainDevice, string pressureDevice)

Open device used for pressure regulation.

static variable P_PrepareITCWaves(string mainDevice, string pressureDevice, variable deviceID)

Adapt the ITC DAQ waves for hardware specialities.

static variable P_CloseDeviceLowLevel(string device, string deviceToClose, variable refHeadstage)

Used to close the device used for pressure regulation.

static string P_HeadstageUsingDevice(string device, string pressureDevice)

Returns a list of rows that contain a particular string.

static string P_GetListOfPressureCtrlDevices(string device)

Returns a list of ITC/NI devices to open.

Pulls a non repeating list of ITC/NI devices to open from the device specific pressure data wave.

variable P_SetAndGetPressure(string device, variable headStage, variable psi)

Sets the pressure on a headStage.

variable P_GetUserAccess(string device, variable headStage, variable pressureMode)

Returns pressure access defined in PRESSURE_CONSTANTS of the headstage.

  • device – The DAQ device for which user access is being queried

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES]

  • pressureMode – One of the pressure modes defined in PRESSURE_CONSTANTS

variable P_SetPressureValves(string device, variable headStage, variable Access)

Maps the access (defined in PRESSURE_CONSTANTS) to the TTL settings.

variable P_UpdateTTLstate(string device, variable headStage, variable ONorOFFA, variable ONorOFFB)

Updates the TTL channel associated with headStage while maintaining existing channel states.

When setting TTLs, all channels are set at once. To keep existing TTL state on some channels, active state must be known. This function queries the hardware to determine the active state.

ITC hardware: This requires the TTL out to be looped back to the TTL in on the ITC DAC.

NI hardware: There are no dedicated input or output channels for DIO. The last written value is read according to documentation.

static variable P_UpdateSSRSlopeAndSSR(string device)

Updates resistance slope and the resistance in PressureDataWv from TPStorageWave param.

variable P_UpdatePressureDataStorageWv(string device)

Updates the pressure state (approach, seal, break in, or clear) from DA_Ephys panel to the pressureData wave.

variable P_UpdatePressureControls(string device, variable headStageNo)

Retrieves the parameters stored in the PressureData wave and passes them to the GUI controls.

static variable P_UpdatePopupDevices(string device, variable headStageNo)

Updates the popupmenu popup_Settings_Pressure_dev.

static variable P_ManPressurePulse(string device, variable headStage)

Initiates a pressure pulse who’s settings are are controlled in the manual tab of the pressure regulation controls.

static variable P_NegPressurePulse(string device, variable headStage)

Sends a negative pressure pulse to the pressure regulator. Gates the TTLs apropriately to maintain the exisiting TTL state while opening the TTL on the channel with the pressure pulse.

static variable P_PosPressurePulse(string device, variable headStage)

Initiates a positive pressure pulse to the pressure regulator. Gates the TTLs apropriately to maintain the exisiting TTL state while opening the TTL on the channel with the pressure pulse.

static variable P_ITC_SetChannels(string device, variable headstage)
variable P_DeviceIsUsedForPressureCtrl(string device, string pressureDevice)

Check wether the given device is used as pressure device already.

static variable P_DataAcq(string device, variable headStage)

Perform an acquisition cycle on the pressure device for pressure control.

variable P_ITC_FIFOMonitorProc(WMBackgroundStruct *s)

Monitor the device FIFO and terminates acquisition when sufficient data has been collected.

variable P_NI_StopDAQ(string device, variable headStage)
static variable P_FindDeviceExecutingPP(string *device, variable *deviceID, variable *headStage)

Returns the device of the device associated with device conducting a pressure pulse.

static variable P_GetPressureForDA(string device, variable headStage, variable pressureMode, P_PressureDA *p)

Fill the passed structure with pressure details for the DA wave.

static wave P_NI_GetDAWave(string device, variable headStage)
static wave P_NI_GetADWave(string device, variable headStage)
static variable P_FillDAQWaves(string device, variable headStage, P_PressureDA *p)
static variable P_DAforNegPpulse(string device, variable headStage)

Updates the DA data used for ITC controlled pressure devices for a negative pressure pulse.

static variable P_GetPulseAmp(string device, variable headStage)

Returns the negative pressure pulse amplitude.

static variable P_LastPulseCount(variable pulseAmp)

Returns the pulse count.

static variable P_DAforPosPpulse(string device, variable headstage)

Updates the DA data used for ITC controlled pressure devices for a positive pressure pulse.

static variable P_DAforManPpulse(string device, variable Headstage)

Updates the DA data used for ITC controlled pressure devices for a manual pressure pulse.

static variable P_TTLforPpulse(string device, variable headStage)

Updates the rack 0 and rack 1 TTL waves used for ITC controlled pressure devices.

static variable P_UpdateTTLdecimal(string pressureDevice, variable dec, variable ttlBit, variable ONorOFF)

returns the new TTL state based on the starting TTL state.

variable P_UpdatePressureMode(string device, variable pressureMode, string pressureControlName, variable checkALL)

Updates the pressure mode button state in the DA_Ephys Data Acq tab.

static variable P_ResetPressureData(string device, variable headStageNo = defaultValue)

Resets pressure data to base state.

static variable P_CheckAll(string device, variable pressureMode, variable SavedPressureMode)

Applies pressure mode to all headstages with valid pressure settings.

variable P_SetPressureOffset(string device, variable headstage, variable userOffset)
variable P_InitBeforeTP(string device)
variable P_LoadPressureButtonState(string device)

Colors and changes the title of the pressure buttons based on the saved pressure mode.

static variable SetPressureButtonsToBaseState(string device)

Sets the pressure toggle buttons to disabled, default color, default title.

static variable P_EnableButtonsIfValid(string device, variable headStageNo)

Checks if the Approach button can be enabled or all pressure mode buttons can be enabled. Enables buttons that pass checks.

variable P_UpdatePressureModeTabs(string device, variable headStage)

updates the tablabels for the pressure tabControl according to the pressure mode

variable P_ValidatePressureSetHeadstage(string device, variable headStageNo)

Checks if all the pressure settings for a headStage are valid.


1 if all settings are valid, 0 otherwise

static variable P_DACIsCollectingData(string device, variable headStage)

Determines if device is active (i.e. collecting data)

used to determine if pressure pulse has completed.

static variable P_PressureMethodPossible(string device, variable headstage)

Return true if pressure methods can be used on that headstage now.

Does not check if the headstage has valid settings, see P_ValidatePressureSetHeadstage(), or that no pressure pulse is currently ongoing, see P_DACIsCollectingData().

static variable P_IsHSActiveAndInVClamp(string device, variable headStage)

Determines headStage is on and in V-Clamp mode.

static variable P_ResetAll_P_ButtonsToBaseState(string device)

Returns the four pressure buttons to the base state (gray color; removes “Stop” string from button title)

variable P_PressureDisplayHighlite(string device, variable hilite)
static std::tuple<variable, string> P_CheckDeviceAndChannelSelection(string device)
static variable P_Enable()

Enables devices for all locked DA_Ephys panels. Sets the correct pressure button state for all locked DA_Ephys panels.

variable P_Disable()

Disables devices for all locked DA_Ephys panels. Sets the correct pressure button state for all locked DA_Ephys panels.

static wave P_DecToBinary(variable dec)

Decimal to binary in 8bit wave.

Wave is always 4 rows long so that each TTL channel on the front of the ITC DAC gets “encoded”

static variable P_ManSetPressure(string device, variable headStage, variable manPressureAll)

Manual pressure control.

variable P_SaveUserSelectedHeadstage(string device, variable headStage)

Saves user seleted headstage in pressureData wave.

variable P_SetAllHStoAtmospheric(string device)

Sets all headstage to atmospheric pressure.

variable P_GetPressureMode(string device, variable headStage)

Gets the pressure mode for a headstage.

variable P_SetPressureMode(string device, variable headStage, variable pressureMode, variable pressure = defaultValue)

Sets the pressure mode.

Intended for use by other processes

  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES]

  • pressureMode – One of the pressure modes defined in PressureModeConstants

  • pressure – [optional, ignored by default. Sets pressure of manual mode]

variable ButtonProc_Approach(WMButtonAction *ba)

Approach button.

variable P_SetApproach(string device, string cntrlName)

Sets approach state.

Handles the TP depency of the approach pressure application

variable ButtonProc_Seal(WMButtonAction *ba)

Seal button.

variable ButtonProc_BreakIn(WMButtonAction *ba)

Break in button.

variable ButtonProc_Clear(WMButtonAction *ba)

Clear button.

static variable P_SetManual(string device, string cntrlName)

Handles the TP depency of the Manual pressure application.

variable CheckProc_ClearEnable(WMCheckboxAction *cba)

Clear all check box.

variable ButtonProc_Hrdwr_P_UpdtDAClist(WMButtonAction *ba)

Update DAC list button.

variable P_ButtonProc_Enable(WMButtonAction *ba)

Pressure control device Enable button in Hardware tab of DA_Ephys panel.

variable P_ButtonProc_Disable(WMButtonAction *ba)

Pressure control device Disable button in Hardware tab of DA_Ephys panel.

variable ButtonProc_DataAcq_ManPressSet(WMButtonAction *ba)

Set pressure button.

variable ButtonProc_ManPP(WMButtonAction *ba)

Manual pressure pulse button.

variable P_Check_ApproachNear(WMCheckboxAction *cba)
variable P_Check_SealAtm(WMCheckboxAction *cba)
variable P_ButtonProc_UserPressure(WMButtonAction *ba)
variable P_RunP_ControlIfTPOFF(string device)

Runs P_PressureControl if the TP is OFF.

variable P_GetAutoUserOff(string device)

If auto-user-OFF is checked, then user access is turned off this function is run by the active headstage slider control.

static variable P_SetLEDValueAssoc(string device)

Sets the value of the headstage LED valDisplays to the correct cell in pressureType wave.

variable P_UpdatePressureType(string device)

Encodes the pressure type for each headstage.

See also PressureTypeConstants

string P_PressureMethodToString(variable method)
struct P_PressureDA

Filled by P_GetPressureForDA()

Public Members

variable calPressure
variable calPressureOffset

preconditioned for the DAC hardware

variable pressure


variable first
variable last