From aa6e620202c90bf7e33aa1c9e4dc342a10283102 Mon Sep 17 00:00:00 2001 From: divall_e Date: Mon, 1 Dec 2025 09:40:30 +0100 Subject: [PATCH] Upload files to "ThorLabs_ELL_motors/IOC" --- ThorLabs_ELL_motors/IOC/ELL_MOTOR.template | 520 ++++++++++++++++++ ThorLabs_ELL_motors/IOC/ELL_cmd | 112 ++++ .../IOC/SLAAT-CPCL-LELL01_ELL.subs | 43 ++ ThorLabs_ELL_motors/IOC/startup.script | 11 + .../IOC/startup.script_SLAAT-CPCL-LELL01 | 21 + 5 files changed, 707 insertions(+) create mode 100644 ThorLabs_ELL_motors/IOC/ELL_MOTOR.template create mode 100644 ThorLabs_ELL_motors/IOC/ELL_cmd create mode 100644 ThorLabs_ELL_motors/IOC/SLAAT-CPCL-LELL01_ELL.subs create mode 100644 ThorLabs_ELL_motors/IOC/startup.script create mode 100644 ThorLabs_ELL_motors/IOC/startup.script_SLAAT-CPCL-LELL01 diff --git a/ThorLabs_ELL_motors/IOC/ELL_MOTOR.template b/ThorLabs_ELL_motors/IOC/ELL_MOTOR.template new file mode 100644 index 0000000..aaea9ae --- /dev/null +++ b/ThorLabs_ELL_motors/IOC/ELL_MOTOR.template @@ -0,0 +1,520 @@ + + +#-------- G E T T H E V E R S I O N / I D N / D E S C --------------- + +record(stringin, "$(SYSTEM):NAME") { + field(DESC, "$(DESC)") + field(VAL, "$(DESC)") +} + +record(stringin, "$(SYSTEM):UNIT") { + field(DESC, "$(DESC)") + field(VAL, "$(UNIT)") +} +# read the IDN from the device +record(stringin, "$(SYSTEM):GET_IDN") { + field(DESC, "$(DESC)") + field(DTYP, "stream") + field(INP, "@$(SDNC) GET_ID($(UNIT),$(SYSTEM)) $(IP)") + field(PINI, "YES") +} + +# model number +record(ai, "$(SYSTEM):ID_MODEL") { + field(DESC, "Model number") +} +# serial number +record(stringin, "$(SYSTEM):ID_SN") { + field(DESC, "Serial number") +} +# year and fw +record(stringin, "$(SYSTEM):ID_YEARFW") { + field(DESC, "Year and FW in one") +} +# year and fw +record(ai, "$(SYSTEM):ID_TRAVEL") { + field(DESC, "Travel range") +} +# pulses per +record(ai, "$(SYSTEM):ID_PULSEPP") { + field(DESC, "pulse per position") +} + + +#---- S T A T U S +record(ai, "$(SYSTEM):GET_STATUS") { + field(SCAN, "Passive") + field(INP, "@$(SDNC) GET_STATUS($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(mbbi, "$(SYSTEM):STATUS"){ # + field(DESC, "scan range") + field(SCAN, "Passive") + field(NOBT, "14") + field(ZRVL, "0") + field(ONVL, "1") + field(TWVL, "2") + field(THVL, "3") + field(FRVL, "4") + field(FVVL, "5") + field(SXVL, "6") + field(SVVL, "7") + field(EIVL, "8") + field(NIVL, "9") + field(TEVL, "10") + field(ELVL, "11") + field(TVVL, "12") + field(TTVL, "13") + + field(ZRST, "OK - No Error") + field(ONST, "Comms time out") + field(TWST, "Mechanical time out") + field(THST, "Command error") + field(FRST, "Value out of range") + field(FVST, "Module isolated") + field(SXST, "Module out of isolation") + field(SVST, "Init error") + + field(EIST, "Thermal error") + field(NIST, "Busy") + field(TEST, "Sensor error") + field(ELST, "Motor error") + field(TVST, "Out of range") + field(TTST, "Over current error") + +} + +#---- C H A N G E A D D R E S S +record(ai, "$(SYSTEM):NEW_ADDRESS") { #hold here so that isn't set automatically + field(DESC, "address to set") +} + +record(ai, "$(SYSTEM):CHANGE_ADDRESS") { + field(DESC, "change unit address") + field(INP, "@$(SDNC) CHANGE_ADDR($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + + +#---- M O T O R I N F O --- M O T O R 1 +record(ai, "$(SYSTEM):M1_GET_INFO") { + field(SCAN, "Passive") + field(INP, "@$(SDNC) GET_INFO_M1($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ai, "$(SYSTEM):M1_LOOP_ON") { + field(DESC, "Loop ON") +} +record(ai, "$(SYSTEM):M1_WORKING") { + field(DESC, "Motor working") +} +record(ai, "$(SYSTEM):M1_CURRENT") { + field(DESC, "Motor current") +} +record(ai, "$(SYSTEM):M1_RAMP_UP") { + field(DESC, "ramp up") +} +record(ai, "$(SYSTEM):M1_RAMP_DOWN") { + field(DESC, "ramp down") +} +record(ai, "$(SYSTEM):M1_FWD_PERIOD") { + field(DESC, "forward period") +} +record(ai, "$(SYSTEM):M1_BWD_PERIOD") { + field(DESC, "backward period") +} + +record(ao, "$(SYSTEM):M1_SET_FWD_PERIOD") { + field(DESC, "set forward period") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SET_FWD_PER_M1($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):M1_SET_BWD_PERIOD") { + field(DESC, "set backward period") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SET_BWD_PER_M1($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):M1_SEARCH_FREQ") { + field(DESC, "search freq") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SEARCH_FREQ_M1($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):M1_SCAN_CURRENT") { + field(DESC, "scan current curve") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SCAN_CURR_M1($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + + + +#---- M O T O R I N F O --- M O T O R 2 +record(ai, "$(SYSTEM):M2_GET_INFO") { + field(SCAN, "Passive") + field(INP, "@$(SDNC) GET_INFO_M2($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ai, "$(SYSTEM):M2_LOOP_ON") { + field(DESC, "Loop ON") +} +record(ai, "$(SYSTEM):M2_WORKING") { + field(DESC, "Motor working") +} +record(ai, "$(SYSTEM):M2_CURRENT") { + field(DESC, "Motor current") +} +record(ai, "$(SYSTEM):M2_RAMP_UP") { + field(DESC, "ramp up") +} +record(ai, "$(SYSTEM):M2_RAMP_DOWN") { + field(DESC, "ramp down") +} +record(ai, "$(SYSTEM):M2_FWD_PERIOD") { + field(DESC, "forward period") +} +record(ai, "$(SYSTEM):M2_BWD_PERIOD") { + field(DESC, "backward period") +} + +record(ao, "$(SYSTEM):M2_SET_FWD_PERIOD") { + field(DESC, "set forward period") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SET_FWD_PER_M2($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):M2_SET_BWD_PERIOD") { + field(DESC, "set backward period") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SET_BWD_PER_M2($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):M2_SEARCH_FREQ") { + field(DESC, "search freq") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SEARCH_FREQ_M2($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):M2_SCAN_CURRENT") { + field(DESC, "scan current curve") + field(SCAN, "Passive") + field(OUT, "@$(SDNC) SCAN_CURR_M2($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + + + + + + +#---- H O M I N G - try and use same names as smaract +record(ao, "$(SYSTEM):FRM_BACK") { + field(DESC, "Home backwards") + field(OUT, "@$(SDNC) HOME_BWD($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):FRM_FORW") { + field(DESC, "Home forwards") + field(OUT, "@$(SDNC) HOME_FWD($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + + +record(ao, "$(SYSTEM):AUTO_HOME_ON") { + field(DESC, "Home on startup") + field(OUT, "@$(SDNC) AUTO_HOME_ON($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):AUTO_HOME_OFF") { + field(DESC, "Home on startup") + field(OUT, "@$(SDNC) AUTO_HOME_OFF($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +#---- M O V I N G + +#---- D R I V E - A B S + + +record(ao, "$(SYSTEM):DRIVE") { + field(DESC, "move absolute") + field(FLNK, "$(SYSTEM):DRIVE_LIM_CALC") + field(PREC, "2") + #field(FLNK, "$(SYSTEM):POS_2_COMP") +} + +record(ao, "$(SYSTEM):HLM") { + field(DESC, "High limit") + field(VAL, "$(HLM=0)") + field(PREC, "2") +} + +record(ao, "$(SYSTEM):LLM") { + field(DESC, "low limit") + field(VAL, "$(LLM=0)") + field(PREC, "2") +} + + +record(calcout, "$(SYSTEM):DRIVE_LIM_CALC"){ #4byte hex = + field(DESC, "check limits") + field(INPA, "$(SYSTEM):DRIVE") #-m...+m + field(INPB, "$(SYSTEM):LLM") #half range + field(INPC, "$(SYSTEM):HLM") #2^32 = 4294967296 + field(INPD, "$(SYSTEM):MRES") #deg to steps conv + field(CALC, "B=C?A/D:A>C?C/D:A=0?A:C+A") + field(OUT, "$(SYSTEM):ABS_POS_OUT PP") +} + +record(ao, "$(SYSTEM):ABS_POS_OUT") { + field(DESC, "send out abs pos") + field(OUT, "@$(SDNC) MOVE_ABS($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +#---- D R I V E - T W E A K /// J O G + +record(ai, "$(SYSTEM):TWV") { + field(DESC, "tweak distance") + field(FLNK, "$(SYSTEM):TWV_2_COMP") + field(PREC, "2") + field(VAL, "1") +} + +record(calcout, "$(SYSTEM):TWV_2_COMP"){ #4byte hex = + field(DESC, "position to 2s compliment") + field(INPA, "$(SYSTEM):TWV") #-m...+m + field(INPB, "2147483648") #half range + field(INPC, "4294967296") #2^32 = 4294967296 + field(INPD, "$(MRES)") #deg to steps conv + field(CALC, "A>=0?A/D:0") #limit to pos... else field(CALC, "A>=0?A:C+A") + field(OUT, "$(SYSTEM):TWV_POS_OUT PP") +} + +record(ao, "$(SYSTEM):TWV_POS_OUT") { + field(DESC, "send out tweak pos") + field(OUT, "@$(SDNC) SET_JOG($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):GET_JOG") { + field(DESC, "tweak forward") + field(OUT, "@$(SDNC) GET_JOG($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") + field(PINI, "YES") +} + +record(ao, "$(SYSTEM):TWV_RB") { + field(DESC, "readback of tweak value") + field(PREC, "2") +} + +#--- T W E A K F W D +record(calcout, "$(SYSTEM):TWF"){ #4byte hex = + field(DESC, "tweak forward") + field(INPA, "$(SYSTEM):MOTRBV") #-m...+m + field(INPD, "$(SYSTEM):TWV") + field(OOPT, "When Non-zero") + field(CALC, "A+D") #limit to pos... else field(CALC, "A>=0?A:C+A") + field(OUT, "$(SYSTEM):DRIVE PP") + field(PREC, "2") +} + +record(calcout, "$(SYSTEM):TWR"){ #4byte hex = + field(DESC, "tweak forward") + field(INPA, "$(SYSTEM):MOTRBV") #-m...+m + field(INPD, "$(SYSTEM):TWV") + field(OOPT, "When Non-zero") + field(CALC, "A-D") #limit to pos... else field(CALC, "A>=0?A:C+A") + field(OUT, "$(SYSTEM):DRIVE PP") + field(PREC, "2") +} + +#the prober jog cannot cope with going negative... therefore will use abs move instead +#record(calcout, "$(SYSTEM):TWF"){ #4byte hex = +# field(DESC, "tweak forward") +# field(INPA, "$(SYSTEM):MOTRBV") #-m...+m +# field(INPB, "$(SYSTEM):LLM") #half range +# field(INPC, "$(SYSTEM):HLM") #2^32 = 4294967296 +# field(INPD, "$(SYSTEM):TWV_RB") +# field(OOPT, "When Non-zero") +# field(CALC, "B=C?1:(A+D)>C?0:1") #limit to pos... else field(CALC, "A>=0?A:C+A") +# field(OUT, "$(SYSTEM):TWF_GO.PROC PP") +#} + +#record(ao, "$(SYSTEM):TWF_GO") { +# field(DESC, "tweak forward") +# field(OUT, "@$(SDNC) JOG_FWD($(UNIT),$(SYSTEM)) $(IP)") +# field(DTYP, "stream") +#} + +#--- T W E A K B W D +#record(calcout, "$(SYSTEM):TWR"){ #4byte hex = +# field(DESC, "tweak forward") +# field(INPA, "$(SYSTEM):MOTRBV") #-m...+m +# field(INPB, "$(SYSTEM):LLM") #half range +# field(INPC, "$(SYSTEM):HLM") #2^32 = 4294967296 +# field(INPD, "$(SYSTEM):TWV_RB") +# field(OOPT, "When Non-zero") +# field(CALC, "B=C?1:(A-D)=0?A:C+A") +# field(OUT, "$(SYSTEM):TWR_GO.PROC PP") +#} + +#record(ao, "$(SYSTEM):TWR_GO") { +# field(DESC, "tweak forward") +# field(OUT, "@$(SDNC) JOG_BWD($(UNIT),$(SYSTEM)) $(IP)") +# field(DTYP, "stream") +#} + +#---- V E L O C I T Y + +record(ao, "$(SYSTEM):SET_VEL") { + field(DESC, "set velocity") + field(OUT, "@$(SDNC) SET_VEL($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") + field(FLNK, "$(SYSTEM):VEL_RB") +} + +record(ao, "$(SYSTEM):VEL_RB") { + field(DESC, "readback of velocity value") + field(OUT, "@$(SDNC) GET_VEL($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +#---- S T O P + +record(ao, "$(SYSTEM):STOP") { + field(DESC, "Stop movement") + field(OUT, "@$(SDNC) STOP($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + + + + + + + + + + + + + +record(ao, "$(SYSTEM):GET_POS") { + field(DESC, "Read current Pos") + field(SCAN, "5 second") + field(OUT, "@$(SDNC) GET_POS($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") + field(FLNK, "$(SYSTEM):GET_STATUS") +} + +record(ai, "$(SYSTEM):POS") { #Raw pos + field(DESC, "raw pos - convert with 2s compliment") +} + + +record(ao, "$(SYSTEM):OPTIMIZE") { + field(DESC, "optimize motors") + field(OUT, "@$(SDNC) OPTIMIZE($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + +record(ao, "$(SYSTEM):CLEAN") { + field(DESC, "run cleaning seq") + field(OUT, "@$(SDNC) CLEAN_MOTOR($(UNIT),$(SYSTEM)) $(IP)") + field(DTYP, "stream") +} + + + + +record(ao, "$(SYSTEM):MRES") { + field(DESC, "calibration") + field(VAL, "$(MRES=0.002511161)") +} + + + + + +record(calcout, "$(SYSTEM):MOTRBV"){ #4byte hex = + field(DESC, "2s compliment to pos") + field(INPA, "$(SYSTEM):POS CP") # + field(INPB, "2147483648") #half range + field(INPC, "4294967296") #2^32 = 4294967296 + field(INPD, "$(SYSTEM):MRES") #deg to steps conv + field(CALC, "A MRES=143360/360 => 0.002511161 + +#SDNC Command file to use +#IP IP address to use NB. one IP address can have upto 16 motors [0..F] +#UNIT Unit address for this stage [0..F] +#SYSTEM PV base name +#Desc Description to show on Panel +#EGU Units +#MRES Calipration steps to EGU +#LLM HLM Limits (0,0 to ignore, but rotator has built in -360 to 360 deg range) + +file ELL_MOTOR.template { + { SDNC = "ELL_cmd", + IP = "ELL1", + UNIT = "1", + SYSTEM = "SLAAT-LMOT-ELL1", + DESC = "ThorLabs WavePlate", + EGU = "Deg", + MRES = 0.002511161 + LLM = -360 + HLM = 360 + } +} + + + +#file ELL_MOTOR.template { +# { SDNC = "ELL_cmd", +# IP = "ELL1", +# UNIT = "1", +# SYSTEM = "SLAAR21-LMOT-ELL2", +# DESC = "ThorLabs Rot Plate", +# EGU = "Deg", +# MRES = 0.002511161 +# LLM = -360 +# HLM = 360 +# } +#} diff --git a/ThorLabs_ELL_motors/IOC/startup.script b/ThorLabs_ELL_motors/IOC/startup.script new file mode 100644 index 0000000..f1c13ce --- /dev/null +++ b/ThorLabs_ELL_motors/IOC/startup.script @@ -0,0 +1,11 @@ +# The following lines were generated by "ioc install" +# Generated at: 2024-03-05 16:48:36.821777 + +epicsEnvSet IOC SLAAT-CPCL-LELL01 +epicsEnvSet ENGINEER divall_e +< /ioc/startup/startup.script_linux + +# ---- ioc/system specific startup script(s) +< startup.script_SLAAT-CPCL-LELL01 + +iocInit diff --git a/ThorLabs_ELL_motors/IOC/startup.script_SLAAT-CPCL-LELL01 b/ThorLabs_ELL_motors/IOC/startup.script_SLAAT-CPCL-LELL01 new file mode 100644 index 0000000..9f6d521 --- /dev/null +++ b/ThorLabs_ELL_motors/IOC/startup.script_SLAAT-CPCL-LELL01 @@ -0,0 +1,21 @@ +require "stream" +require "array" + +epicsEnvSet STREAM_PROTOCOL_PATH :protocols:./cfg + +addScan 60 + + +var streamError 1 + +#first system - Xt-nano user:admin pw:XT or xt? +#drvAsynIPPortConfigure ("ELL1", "FINSS-L-SHT21A:1002") +drvAsynIPPortConfigure ("ELL1", "172.26.114.232:1002") + + + +# The following lines were generated by "ioc install" +# Generated at: 2024-03-05 16:48:36.816675 + +cd "/ioc/SLAAT-CPCL-LELL01" +dbLoadTemplate("SLAAT-CPCL-LELL01_ELL.subs")