diff --git a/dsmApp/src/MD90Driver.cpp b/dsmApp/src/MD90Driver.cpp index 7240165..a0e5976 100644 --- a/dsmApp/src/MD90Driver.cpp +++ b/dsmApp/src/MD90Driver.cpp @@ -174,10 +174,12 @@ asynStatus MD90Axis::move(double position, int relative, double minVelocity, dou status = sendAccelAndVelocity(acceleration, maxVelocity); + // Position specified in encoder steps (10 nm), but motor move commands are in nanometers + position = position * 10; if (relative) { - sprintf(pC_->outString_, "#%02dI%+d", axisNo_, NINT(position)); + sprintf(pC_->outString_, "CRM %d", NINT(position)); } else { - sprintf(pC_->outString_, "#%02dG%+d", axisNo_, NINT(position)); + sprintf(pC_->outString_, "CLM %d", NINT(position)); } status = pC_->writeReadController(); return status; @@ -190,11 +192,7 @@ asynStatus MD90Axis::home(double minVelocity, double maxVelocity, double acceler status = sendAccelAndVelocity(acceleration, maxVelocity); - if (forwards) { - sprintf(pC_->outString_, "#%02dH+", axisNo_); - } else { - sprintf(pC_->outString_, "#%02dH-", axisNo_); - } + sprintf(pC_->outString_, "HOM"); status = pC_->writeReadController(); return status; } @@ -271,7 +269,7 @@ asynStatus MD90Axis::poll(bool *moving) // TODO: Will need to add some more error handling for the motor return codes. - // Read the current motor position + // Read the current motor position in encoder steps (10 nm) sprintf(pC_->outString_, "GEC"); comStatus = pC_->writeReadController(); if (comStatus) goto skip; diff --git a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 index 90a5a28..40e4e4a 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 @@ -1,6 +1,26 @@ file "$(MOTOR)/db/basic_asyn_motor.db" { pattern -{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} -{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "Bottom", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""} +{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, VMAX, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} +{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 0.5, 0.025, 0.625, 0, 0, 0.03, 0, .00001, 2, 20, -20, ""} } + +# P IOC prefix +# N Port number +# M Record name pattern +# DTYP Datatype +# PORT Port +# ADDR Address +# DESC Description +# EGU Engineering units +# DIR Direction +# VELO Velocity (EGU / s) +# VBAS Minimum velocity (EGU / s) +# VMAX Maximum velocity (EGU / s) (not getting set here with basic_asyn_motor.db) +# ACCL Acceleration (time in seconds until VELO) +# BDST Backlash distance +# MRES Motor step size (EGU) +# PREC Display precision number of decimal places +# DHLM Dial high travel limit (EGU) +# DLLM Dial low travel limit (EGU) +# INIT Initialization string (seems to be unused/broken) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 index 68f6a8e..28be557 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 @@ -5,7 +5,7 @@ dbLoadDatabase("../../dbd/dsm.dbd") dsm_registerRecordDeviceDriver(pdbbase) -# Port 2 on a Moxa +# Network device #!drvAsynIPPortConfigure("serial0", "192.168.1.16:4002",0,0,0) # Local serial port #!drvAsynSerialPortConfigure("serial0", "/dev/ttyS0", 0, 0, 0) @@ -24,6 +24,12 @@ asynOctetSetOutputEos("serial0", 0, "\r") asynSetTraceIOMask("serial0", 0, 2) #asynSetTraceMask("serial0", 0, 255) +# Turn on the power supply and set the deadband +asynOctetConnect("initConnection", "serial0", 0) +asynOctetWrite("initConnection", "EPS") +asynOctetWrite("initConnection", "SDB 10") +asynOctetDisconnect('initConnection') + MD90CreateController("MD900", "serial0", 1, 100, 5000) ### Motors @@ -36,3 +42,4 @@ iocInit # This IOC does not use save/restore, so set values of some PVs dbpf("DSM:m0.RTRY", "0") dbpf("DSM:m0.TWV", "0.1") +dbpf("DSM:m0.VMAX", "0.625")