# Set to 0 to move the tower into working state and to 1 to move into changer position record(longout, "$(INSTR)$(M):ChangeState") { field(DTYP, "asynInt32") field(OUT, "@asyn($(CONTROLLER),$(AXIS),1) CHANGE_STATE") field(PINI, "NO") field(DRVH, "1") field(DRVL, "0") } # Read the position state of the axis: # 0 = not ready # 1 = ready (in working position) # 2 = Moving from working to changer position or in changer position # 3 = Moving from changer to working state record(longin, "$(INSTR)$(M):PositionStateRBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(CONTROLLER),$(AXIS)) POSITION_STATE_RBV") field(SCAN, "I/O Intr") field(PINI, "NO") } # This PV combines the position state and the movement readback value from the # motor record: # - 0, if the tower is in working state or transitioning to change position # - 1, If the tower is in change position or transitioning to working state record(calc, "$(INSTR)$(M):ChangingStateRBV") { field(INPA, "$(INSTR)$(M).MOVN CP") field(INPB, "$(INSTR)$(M):PositionStateRBV CP") field(CALC, "(B == 1 || (B == 2 && A == 1)) ? 0 : 1") } # Convert the double value from the calc record to an integer value record(longout, "$(INSTR)$(M):ChangingStateRBV_int") { field(DOL, "$(INSTR)$(M):ChangingStateRBV CP") field(OMSL, "closed_loop") }