RRM 3-14 Stepper Motor
steppermotor - Stepper Motor
The stepper motor record controls and monitors stepper motors. The stepper motor can be controlled in either position mode or velocity mode. Position mode moves a device to a position. Velocity mode causes the motor to revolve continuously.
The record is set up assuming that the same stepper motor will not be used in both velocity and position mode. The fields for the stepper motor record fall into the following categories:
- scan parameters
- setup parameters
- desired output parameters
- output and readback parameters
- operator display parameters
- alarm parameters
- monitor parameters
run-time parameters.
Scan Parameters
The stepper motor record has the standard fields for specifying under what circumstances the record will be processed. A motor record that is scanned periodically or on event will compare its actual position to the desired position and will attempt to achieve its position. It will only make a certain number of attempts; the number of attempts is specified in the retry (RTRY) field. A passive motor will not go through the retry logic.
These fields are listed in Scan Fields. In addition, Scanning Specification explains how these fields are used. Note that I/O event scanning is only supported for those card types that interrupt.
Setup Parameters
The set-up parameters determine how the stepper motor is initialized and how it operates at run-time.
The MODE field has two choices: Velocity
or Position
.
The VELO field determines the velocity that the stepper motor will run at when in the velocity mode. In position mode, it determines the pulses per second to move when it moves to a new position.
The ACCL field determines the acceleration of the motor by specifying a number of seconds. In velocity mode, the stepper motor will accelerate at the rate needed to reach the operating velocity in the number of seconds specified in ACCL. In positional mode, ACCL determines the seconds the stepper motor will take to reach the specified velocity, and the number of seconds it will take to come to a stop at the new position.
The MRES field specifies the number of pulses per revolution for the stepper motor, while ERES specifies the encoder pulses per revolution.
The DIST field's value determines the distance which the stepper motor moves for each pulse in engineering units.
The RTRY field specifies the number of attempts the record will make to reach the desired position each time it's processed, and the RDBD field specifies a deadband for this processing. Thus, when the motor is moving in a positive direction, no retries will be attempted unless the readback value is greater than VAL added to the value in the RDBD field. If the motor is moving in the negative direction, no retries will be attempted unless the readback value is less than VAL added to the value in the RDBD field:
- if direction positive and RBV > (VAL + RDBD)
- attempt to correct position RTRY times
- if direction negative and RBV < (VAL + RDBD)
- attempt to correct position RTRY times
The initialization algorithm (IALG) field has three algorithms to choose from: No Initialization
, Move to the Positive Limit
,
and Move to the Negative Limit
. The IVAL field determines the value of VAL at initialization; i.e., VAL is initialized to the value in IVAL when IALG is either Move to Positive or Move to Negative.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
ACCL | Seconds to Reach Velocity | FLOAT | Yes | 0 | Yes | Yes | No | No |
VELO | Velocity in Pulses per Second | FLOAT | Yes | 0 | Yes | Yes | No | No |
DIST | Distance in Engineering Units of 1 Pulse | FLOAT | Yes | 0 | Yes | Yes | No | No |
IVAL | Initial Value | FLOAT | Yes | 0 | Yes | Yes | No | No |
MODE | Mode--Position/Velocity | RECCHOICE | Yes | 0 | Yes | Yes | No | No |
IALG | Initialization Algorithm | RECCHOICE | Yes | 0 | Yes | Yes | No | No |
RTRY | Number Of Retries Before Failure | SHORT | Yes | 0 | Yes | Yes | No | No |
RDBD | Retry Deadband | FLOAT | Yes | 0 | Yes | Yes | No | No |
MRES | Motor Pulses per Revolution | USHORT | Yes | 0 | Yes | Yes | No | No |
ERES | Encoder Pulses per Revolution | USHORT | Yes | 0 | Yes | Yes | No | No |
Desired Output Parameters
The stepper motor record specifies where the desired output originates in the DOL field. The desired output needs to be in engineering units. If the output is controlled by the operator or a sequence program, nothing should be entered in the DOL field.
The desired output link (DOL) and operation mode select (OMSL) fields work as they do for output records. If OMSL is closed_loop
, the desired output (VAL) is fetched from the DOL link, which can be a database or channel access link. If supervisory
, VAL can be changed via dbPuts. DOL can be a constant, in which case VAL is initialized to the constant. If DOL is a constant, OMSL cannot specify closed_loop
. See Address Specification for information on specifying links.
VAL indicates the position of the stepper motor in position mode; in velocity mode, it indicates the current velocity. When the desired output is retrieved and placed in VAL, it is forced to be within the drive limits configured in the DRVH and DRVL fields. The DRVH and DRVL fields must be given values by the user. Note: If nothing is entered in the DRVH and DRVL fields, the motor will not move. The get_control_double()
record support routine returns the values in these fields when it is called.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
VAL | Value | FLOAT | No | 0 | Yes | Yes | Yes | Yes |
DOL | Desired Output Location (Input Link) | INLINK | Yes | 0 | No | No | N/A | No |
OMSL | Output Mode Select | GBLCHOICE | Yes | 0 | Yes | Yes | No | No |
Output and Readback Parameters
In the OUT output link field, the user must enter the address of the I/O card of the device, and in the DTYP field, the user must enter the name of the appropriate stepper motor device support module. Be aware that the address format differs according to the I/O bus used. See Address Specification for information on hardware addresses. The user can see a list of the device support modules currently supported at the user's local site by using the dbst
utility in R3.13.
The RDBL field can contain the address of an encoder or an external device, such as an LDVT, or it can specify the motor position field (MPOS) or the encoder position field (EPOS) in the same record. In the case of an external readback, the value would be read through an analog input record and linked to this record through this field. The value retrieved from this field is placed into the RBV field.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
OUT | Output Link | OUTLINK | Yes | 0 | No | No | N/A | No |
DTYP | Device Type | DEVCHOICE | Yes | 0 | Yes | No | No | |
RDBL | Read Back Location (an input link) | INLINK | Yes | 0 | No | No | N/A | No |
RBV | Read Back Value | FLOAT | No | 0 | Yes | Yes | Yes | No |
Operator Display Parameters
These parameters are used to present meaningful data to the operator. These fields are used to display the value and other parameters of the stepper motor either textually or graphically.
EGU is a string of up to 16 characters describing the engineering units of VAL. It is retrieved by the get_units
record support routine.
The HOPR and LOPR fields set the upper and lower display limits for the VAL, HIHI, HIGH, LOW, LOLO, MPOS, EPOS, RBV, and LVAL fields. Only the get_graphic_double
record support routine retrieves these fields. If these values are defined, they must be in the range: DRVL<=LOPR<=HOPR<=DRVH.
The PREC field determines the floating point precision with which to display the VAL and LVAL fields. It is used whenever the get_precision
record support routine is called.
See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
EGU | Engineering Units | STRING [16] | Yes | null | Yes | Yes | No | No |
HOPR | High Operating Range | FLOAT | Yes | 0 | Yes | Yes | No | No |
LOPR | Low Operating Range | FLOAT | Yes | 0 | Yes | Yes | No | No |
PREC | Display Precision | SHORT | Yes | 0 | Yes | Yes | No | No |
NAME | Record Name | STRING [29] | Yes | 0 | Yes | No | No | |
DESC | Description | STRING [29] | Yes | Null | Yes | Yes | No | No |
Alarm Parameters
The possible alarm conditions for stepper motor records are the SCAN, READ, and limit alarms. The SCAN and READ alarms are called by the record or device support routines and are always of MAJOR severity.
The limit alarms are configured by the user in the HIHI, LOLO, HIGH, and LOW fields using numerical values. The conditions apply to the VAL and RBV fields of the stepper motor record. For each of these fields, there is a corresponding severity field which can specify either NO ALARM, MINOR, or MAJOR. The user can specify a deadband around these limits in the HYST or hysteresis field. See Alarm Specification for a complete explanation of analog alarms and these fields. Alarm Fields lists other fields related to a alarms that are common to all record types.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
HIHI | Hihi Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
HIGH | High Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
LOW | Low Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
LOLO | Lolo Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
HHSV | Hihi Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
HSV | High Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
LSV | Low Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
LLSV | Lolo Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
HYST | Alarm Deadband | DOUBLE | Yes | 0 | Yes | Yes | No | No |
Monitor Parameters
These parameters are used to determine when to send monitors placed on the VAL field. The monitors are sent when the value field exceeds the last monitored field by the appropriate delta. If these fields have a value of zero, everytime the value changes, a monitor will be triggered; if they have a value of -1, everytime the record is processed, monitors are triggered. The ADEL field is used by archive monitors and the MDEL field for all other types of monitors. See Monitor Specification for a complete explanation of monitors.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
ADEL | Archive Deadband | DOUBLE | Yes | 0 | Yes | Yes | No | No |
MDEL | Monitor, i.e. value change, Deadband | DOUBLE | Yes | 0 | Yes | Yes | No | No |
Run-time Parameters
These fields are not configurable by the user before run-time, but most of them can be modified after initialization.
The STHM field will set the current position of the motor to its home or zero position when this field is set to 1 via a dbPut. Its value is automatically reset to 0 after the command is accepted.
Setting the STOP field to 1 will cause the motor to stop moving. Its value is also reset to 0 after the command is accepted.
The DMOV field is a flag which indicates if the motor is done moving and all retries are complete. It is significant only while the record is in POSITION mode. It will be 1 if TRUE and 0 if FALSE.
The RVAL field contains the value which is actually written to output after it is forced in the drive limits.
The RBV and RRBV fields contain the value retrieved from the readback location link (RDBL).
The MOVN field indicates whether the motor is currently moving. It will contain a 1 if moving or a 0 if not moving. The DIR field indicates which direction the record is moving--a 0 means clockwise and a 1 means counter clockwise.
The CW and CCW fields contain the values for the clockwise and counterclockwise limit switches, respectively. The MCW and MCCW fields will be 1 if the limit has been reached or 0 if not.
The CVEL field indicates whether the motor is at constant velocity. If so, the value of this field is 1.
The RCNT field will indicate the current number of retries that have been attempted.
The POSM field will contain a 1 if the motor is moving in a positive direction and a 0 if otherwise.
The MISS field holds the error after the first attempt has been made to change the stepper motor's position, the error being the difference between VAL and RBV, the readback value. If monitors are present, the value is posted.
The EPOS field holds the value obtained from encoder readback. The MPOS holds the readback value of the motor positions.
The MLST and ALST fields are used to implement monitors on the VAL field. If the difference between one of these fields and the VAL field exceeds the appropriate deadband (MDEL, for instance) monitors are triggered.
The LVEL, LACC, and LVAL fields contain the last values set for the VELO, ACCL, and VAL fields respectively. They are used to determine when the velocity and acceleration should be recalculated.
The CMOD or current mode fields indicates which mode, position or velocity, the record is using.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
STHM | Set Home | SHORT | No | 0 | Yes | Yes | No | Yes |
STOP | Stop | SHORT | No | 0 | Yes | Yes | No | Yes |
DMOV | Done Moving to Value | SHORT | No | 0 | Yes | Yes | No | No |
RVAL | Raw Data Value | LONG | No | 0 | Yes | Yes | Yes | Yes |
RRBV | Raw Read Back Value | LONG | No | 0 | Yes | Yes | Yes | No |
INIT | Initialize | SHORT | No | 0 | Yes | Yes | No | Yes |
MOVN | Moving Status | SHORT | No | 0 | Yes | Yes | No | No |
DIR | Current Direction | SHORT | No | 0 | Yes | Yes | No | Yes |
MCW | Motor Clockwise Limit Switch Value | SHORT | No | 0 | Yes | Yes | No | Yes |
MCCW | Motor Counter Clockwise Limit Switch Value | SHORT | No | 0 | Yes | Yes | No | Yes |
CW | Clockwise Limit | SHORT | No | 0 | Yes | Yes | No | Yes |
CCW | Counter Clockwise Limit | SHORT | No | 0 | Yes | Yes | No | Yes |
CVEL | Constant Velocity | SHORT | No | 0 | Yes | Yes | No | No |
RCNT | Current Retry Count | SHORT | No | 0 | Yes | Yes | Yes | No |
POSM | Positive Motion | FLOAT | No | 0 | Yes | No | Yes | No |
MISS | First Attempt Error | FLOAT | No | 0 | Yes | Yes | Yes | No |
EPOS | Encoder Read Back Position | FLOAT | No | 0 | Yes | Yes | No | No |
MPOS | Motor Position | FLOAT | No | 0 | Yes | Yes | No | No |
ALST | Archive Last Value | FLOAT | No | 0 | Yes | No | No | No |
MLST | Monitor Last Value | FLOAT | No | 0 | Yes | No | No | No |
LVEL | Last Velocity Set | FLOAT | No | 0 | Yes | Yes | No | No |
LACC | Last Acceleration Set | FLOAT | No | 0 | Yes | Yes | No | No |
LVAL | Last Value | SHORT | No | 0 | Yes | Yes | No | No |
CMOD | Current Mode | RECCHOICE | Yes | 0 | Yes | Yes | No | No |
Record Support
Record Support Routines
init_record
This routine checks to see that device support is available. The routine next checks to see if the device support sm_command
routine is defined. If either device support or the device support write routine does not exist, an error message is issued and processing is terminated.
If device support includes init_record
, it is called.
If DOL is a constant, then VAL is initialized with its value and UDF is set to FALSE. If DOL is a PV_LINK then a channel access link is created.
init_sm is then called.
init_sm
The init_sm routine initializes the stepper motor according to its configuration.
process
See next section.
get_value
Fills in the values of struct valueDes so that they refer to VAL.
get_units
Retrieves EGU.
get_precision
Retrieves PREC.
get_graphic_double
Sets the upper display and lower display limits for a field. If the field is VAL, LVAL, MPOS, RBV, EPOS, HIHI, HIGH, LOW, or LOLO, the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.
get_control_double
Sets the upper control and the lower control limits for a field. If the field is VAL, LVAL, MPOS, RBV, EPOS, HIHI, HIGH, LOW, or LOLO, the limits are set to DRVH and DRVL. Else if the field has upper and lower limits defined they will be used; else the upper and lower maximum values for the field type will be used.
get_alarm_double
Sets the following values:
upper_alarm_limit = HIHI upper_warning_limit = HIGH lower_warning_limit = LOW lower_alarm_limit = LOLO
Record Processing
Description not available.
Device Support
At the present time, device support is intimately connected to record support. The compumotor 1830 and the OMS 6 axis controllers are supported.
EPICS Record Reference Manual - 19 MAY 1998