# Init sequence record. Initialized by pressing :MOTR_INIT button. # The init_seq, # a) turns off and then turns on the motor within 0.5s # c) pushes 0 to home_check disable field and then homes the motor after 0.5s record(bo, "$(P)MOTR_INIT") { field(DESC, "Init or Re Init") field(ZNAM, "Standby") field(ONAM, "Initialize ") } record(bo, "$(P)MOTR_INIT_DBG") { field(DTYP, "Raw Soft Channel") field(DESC, "Init debug flag") field(VAL, "0") field(ZNAM, "Debug Off") field(ONAM, "Debug On") } # Error acknowledge command initiates acknowledge sequence # For linmot, disbale and then enable the motor to clear the error. record(bo, "$(P)MOTR_ERR_ACK_CMD") { field(DESC, "Error Ack CMD") field(FLNK, "$(P)ACK_ERR_SEQ") field(ZNAM, "NO ACK") field(ONAM, "ACK") } record(seq, "$(P)ACK_ERR_SEQ") { field(DESC, "Acknowledge error") field(DLY1, "2") field(DOL1, "0") field(LNK1, "$(P)$(M).CNEN") field(DOL2, "1") field(LNK2, "$(P)$(M).CNEN") field(ASG, "Internal") } # Motor switch on command # Motor can be turned on by # a) MOTR.CNEN and MOTR_SWITCH_ON_CMD # To ensure that both the commands work and not counter one another, calc records used # and both the PV`s should be updated if one does. #record(bo, "$(P)MOTR_SWITCH_ON_CMD") { # field(DESC, "Motor switch on CMD") # field(ZNAM, "OFF") # field(ONAM, "ON") #} # #record(calcout, "$(P)CALC_ENABLE") { # field(DESC, "Check ON cmd is pressed") # field(CALC, "(A#B)?1:0") # field(INPA, "$(P)MOTR_SWITCH_ON_CMD CP") # field(INPB, "$(P)$(M).CNEN") # field(OUT, "$(P)ENABLE_BO.PROC") # field(OOPT, "When Non-zero") # field(ASG, "Internal") #} # #record(bo, "$(P)ENABLE_BO") { # field(DESC, "copies switch on to cnen") # field(DOL, "$(P)MOTR_SWITCH_ON_CMD") # field(OUT, "$(P)$(M).CNEN PP") # field(OMSL, "closed_loop") # field(ASG, "Internal") #} # #record(calcout, "$(P)CALC_CNEN") { # field(DESC, "Check CNEN is pressed") # field(CALC, "(A#B)?1:0") # field(INPA, "$(P)$(M).CNEN CP") # field(INPB, "$(P)MOTR_SWITCH_ON_CMD") # field(OUT, "$(P)CNEN_BO.PROC") # field(OOPT, "When Non-zero") # field(ASG, "Internal") #} # #record(bo, "$(P)CNEN_BO") { # field(DESC, "copies switch on to bo") # field(DOL, "$(P)$(M).CNEN") # field(OUT, "$(P)MOTR_SWITCH_ON_CMD PP") # field(OMSL, "closed_loop") # field(ASG, "Internal") #} # ## Motor home command ## Motor can be homed by ## a) MOTR.HOMR , HOML and MOTR_HOME_CMD ## To ensure that both the commands work and not counter one another, calc records used ## and both the PV`s should be updated if one does. # #record(bo, "$(P)MOTR_HOME_CMD") { # field(DESC, "MOtor Home CMD") # field(ZNAM, "OFF") # field(ONAM, "HOME") #} # #record(calcout, "$(P)CALC_HCMD") { # field(DESC, "Check HOME cmd is pressed") # field(CALC, "(A#B)?1:0") # field(INPA, "$(P)MOTR_HOME_CMD CP") # field(INPB, "$(P)$(M).HOMR") # field(OUT, "$(P)HCMD_BO.PROC") # field(OOPT, "When Non-zero") # field(ASG, "Internal") #} # #record(bo, "$(P)HCMD_BO") { # field(DESC, "copies home cmd to homr_bo") # field(DOL, "$(P)MOTR_HOME_CMD") # field(OUT, "$(P)$(M).HOMR PP") # field(OMSL, "closed_loop") # field(ASG, "Internal") #} # #record(calcout, "$(P)CALC_HOMR") { # field(DESC, "Check HOMR is pressed") # field(CALC, "(A#B)?1:0") # field(INPA, "$(P)$(M).HOMR CP") # field(INPB, "$(P)MOTR_HOME_CMD") # field(OUT, "$(P)HOMR_BO.PROC") # field(OOPT, "When Non-zero") # field(ASG, "Internal") #} # #record(bo, "$(P)HOMR_BO") { # field(DESC, "copies HOMR to HCMD_bo") # field(DOL, "$(P)$(M).HOMR") # field(OUT, "$(P)MOTR_HOME_CMD PP") # field(OMSL, "closed_loop") # field(ASG, "Internal") #} # Retract pv inititates the retract sequence # Retract equence homes and disables the motor record(bo, "$(P)MOTR_RETRACT") { field(DESC, "Motor Home and Disable") # field(FLNK, "$(P)RETRACT_SEQ") field(ZNAM, "Standby") field(ONAM, "Retract") } # Update link1 to channel access for processing # Remove delay for link 1 #record(seq, "$(P)RETRACT_SEQ") { # field(DESC, "Motor home and disable") # field(DOL1, "1") # field(LNK1, "$(P)$(M).HOMR CA") # field(DOL2, "0") # field(LNK2, "$(P)$(M).CNEN") # field(DLY2, "1") # field(DLY1, "0") # field(ASG, "Internal") #} # For Aerotech if timeout seq doesn`t work for retract #record(seq, "$(P)RETRACT_SEQ") { # field(DESC, "Motor initialize and disable") # field(DOL1, "1") # field(LNK1, "$(P)$(M).CNEN") # # field(DOL2, "1") # field(DLY2, "0.5") # field(LNK2, "$(P)AEROTECH_ACKALL") # # field(DLY3, "0.5") # field(DOL3, "0") # field(LNK3, "$(P)HOME_CHECK.DISA") # # field(DOL4, "1") # field(LNK4, "$(P)$(M).HOMR") # field(DLY4, "1") # # field(DLY5, "1") # field(DOL5, "0") # field(LNK5, "$(P)$(M).CNEN") #} # As counter is incremental, reset counter sequence is used. # This sequence check`s if motor is homed and then resets the counter value. # To check if motor is homed, motion active status should transition to zero. # Check if motion active is the best check to determnine if the drive is homed. record(calcout, "$(P)HOME_CHECK") { field(DESC, "check if motor is homed") field(CALC, "A") field(INPA, "$(P)MOTR_MOTION_ACT_STS CP") field(OUT, "$(P)COUNTER_RESET.PROC") field(OOPT, "Transition To Zero") # DOPT to chose output value between CALC and OCAL field(DOPT, "Use OCAL") field(OCAL, "1") field(ASG, "Internal") } record(seq, "$(P)COUNTER_RESET") { # Used while debugging field(TPRO, "1") field(DOL1, "1") field(LNK1, "$(P)HOME_CHECK.DISA") field(DOL2, "1") field(LNK2, "$(P)Reset") field(DLY2, "1") } # If motor record readback and external encoder readback are different # Initiates a sequence which updates teh motor readback to match encoder # Also make sure the retract position is higher than lower limit # Ensure the links are passive process. # No need for passive process for POSN. It updates as I/O interrupt record(bo, "$(P)CORRECT"){ field(DESC, "Update POSN value into MOTR value") field(FLNK, "$(P)CORRECT_SEQ") field(ZNAM, "No Update") field(ONAM, "Updating") } record(calcout, "$(P)CORRECT_CALC") { field(DESC, "Diff btw POSN and MOTR.VAL") field(CALC, "A-B+C") field(INPA, "$(P)POSN") field(INPB, "$(P)MOTR.RBV PP") field(INPC, "$(P)MOTR.OFF PP") field(ASG, "Internal") } record(seq, "$(P)CORRECT_SEQ") { field(DESC, "Update POSN value into MOTR value") field(DOL1, "1") field(LNK1, "$(P)MOTR.SET PP") field(DOL2, "$(P)CORRECT_CALC.VAL PP") field(LNK2, "$(P)MOTR.OFF") field(DLY2, "1") field(DOL3, "0") field(LNK3, "$(P)MOTR.SET PP") field(DLY3, "1") field(DLY4, "1") field(DOL4, "$(P)MOTR_RETRACT_POS_CALC PP") field(LNK4, "$(P)MOTR_RETRACT_POS.VAL PP") field(DLY5, "1") field(DOL5, "1") field(LNK5, "$(P)CORRECT_STS PP") field(ASG, "Internal") } record(calcout, "$(P)MOTR_RETRACT_POS_CALC") { field(DESC, "Diff btw lower limit and retract pos") field(CALC, "A+100") field(INPA, "$(P)MOTR.LLM PP") field(ASG, "Internal") } record(bi, "$(P)CORRECT_STS") { field(DESC, "readback correct status") field(ZNAM, "No Update") field(ONAM, "Readback corrected") }