[SLAC Controls Software Group [SLAC Controls Department] [SLAC Home Page]

Go to bottom of page

7.1 HARDWARE DESCRIPTION . . . . . . . . . . . . . . . 7-1

7.2 DATABASE STRUCTURE . . . . . . . . . . . . . . . . 7-2

7.3 CONTROL FUNCTIONS IN THE MICRO . . . . . . . . . . 7-3

7.3.1 Calibration . . . . . . . . . . . . . . . . . . 7-3

7.3.2 Check And Trim . . . . . . . . . . . . . . . . . 7-4

7.3.3 Perturb . . . . . . . . . . . . . . . . . . . . 7-4

7.3.4 Home . . . . . . . . . . . . . . . . . . . . . . 7-4

7.3.5 Reset . . . . . . . . . . . . . . . . . . . . . 7-5


7.4.1 Control Functions . . . . . . . . . . . . . . . 7-5

7.4.2 Adjust Knobs . . . . . . . . . . . . . . . . . . 7-5

7.4.3 Checkout Knobs . . . . . . . . . . . . . . . . . 7-6

7.4.4 Displays . . . . . . . . . . . . . . . . . . . . 7-6

7.5 SOFTWARE DETAILS IN THE MICRO . . . . . . . . . . 7-6

7.5.1 DACSET(Unit,Dac_value,Ptrbflag) . . . . . . . . 7-7

7.5.2 READADC(Type,Waitflag) . . . . . . . . . . . . . 7-8

7.5.3 SAMRESET() . . . . . . . . . . . . . . . . . . . 7-8

7.5.4 DACZERO() . . . . . . . . . . . . . . . . . . . 7-8

7.5.5 CALIBALL(Type) . . . . . . . . . . . . . . . . . 7-9 CHAPTER 7 STEPPING MOTOR CONTROL

7.1 HARDWARE DESCRIPTION Individual stepping motors for the SLC are controlled by the Joerger Enterprises Stepping Motor Controller and Driver Model SMC-24. This is a single width CAMAC module with a 24 bit 2's complement count register to specify the number of steps to be moved, a 16 bit control register to select speeds and an 8 bit status register. External logic signals inhibit the driver if a limit is reached. All modules should contain the Programmable Speed option to guarantee interchangeability and correct setting of the speed after maintenance or replacement. Where 24 bit range is not required, the 16 bit Model SMC-LP modules already in use may be controlled by the same software. For more information, refer to the Joerger Enterprises specification. Where control of many motors is required, as in the collider arcs, the 16 channel SLAC module xxx is used. This is a single width CAMAC module with a 16 bit 2's complement count register for each channel. There is no speed control and no external limit switches are implemented. The function F27 Ax is used to determine the status of a specific channel, x.

STEPPING MOTOR CONTROL Page 7-2 It is the responsibility of the system engineer to mechanically design the motor such that the gear ratio and screw pitch provide the required displacement resolution and to choose the stepping motor with adequate torque for the application. The limit switches protect the hardware in that whenever they are reached the motor cannot be stepped further in that direction. The device position is read back by means of a linear or rotary motion transducer (potentiometer). The requirements on the stability of the potentiometer polarizing supply and on the temperature are relaxed by the fact that both the cursor voltage and the total voltage are read and their ratio computed to determine the actual cursor position. The voltages are read on two channels of a Smart Analog Monitor (SAM) where the pointer to the Cursor channel is found in the database secondary, ADCP, and the pointer to the Total or reference channel is in ADCR.

7.2 DATABASE STRUCTURE The stepping motor controller is entered in the database as a new primary STEP (hereafter referred to as STEP). It includes the same set of secondary names as a standard magnet-like device, e.g. PHAS, and has all the standard magnet control functions except standardization. In addition, three new secondaries are required: :ADCR: 32,1,1Z2; !Pointer to ADC location in buffer ! of reference channel :SPED: 33,1,1Z2; !Speed and acceleration time (Hex) !Low byte selects speed (0 = minimum) !High byte selects acceleration/deceleration

STEPPING MOTOR CONTROL Page 7-3 ! time (0 = longest time) :CSTA: 39,3,1Z2; !Status register readout The following discussions assume that all magnet secondary names that refer to B for field and I for current will be changed for all magnet-like devices to V for value and A for ADC reading respectively. This includes the following list: :BCON: -> :VCON: !Value from configuration :BMAX: -> :VMAX: !Maximum value allowed :BDES: -> :VDES: !Value desired :BACT: -> :VACT: !Value at last check :IVBU: -> :AVSV: !ADC volts = Function(Value) :IEXP: -> :ADES: !ADC volts calulated from VDES :INOW: -> :AACT: !ADC volts at last check :IPRV: -> :APRV: !Last recorded ADC volts in tolerance :IMMO: -> :AMMO: !Min, Max ADC volts for operating conditions :IMMS: -> :AMMS: !Min, Max, Set point for Calibrate :DVI : -> :DVA : !DAC counts = Function(ADC volts) trial polynomial :DVIC: -> :DVAC: !DAC counts = Function(ADC volts) calibrated For stepping motors, the secondaries referring to ADC volts always refer to the transducer cursor position, ie. the ratio of the two ADC channels used to read the cursor and total voltages.


7.3.1 Calibration The calibration function calculates a linear polynomial for Counts (Steps) versus potentiometer position, DVAC. It checks out the motor and its database entries using the standard magnet procedure. First the device is moved to the maximum excursion specified in the database, AMMS(2), using the test polynomial DVA to determine the number of steps required to go from the current position AACT. When

STEPPING MOTOR CONTROL Page 7-4 motion stops, AACT at MAX is calculated. Then the device is moved to the minimum excursion AMMS(1) and AACT at MIN is calculated. The calibrated polynomial DVAC can be derived from the number of steps taken and the measured AACT values and compared with the test DVA using the tolerances ATOL. The device is then moved to the set point AMMS(3).

7.3.2 Check And Trim The check function compares the current value of the device VACT with the desired value VDES using the tolerances specified in TOLS and reports status. If the device is out of tolerance and a trim is requested, then the DVAC polynomial is used to calculate the appropriate number of steps to go from AACT to ADES and the device is moved. When motion stops, the new position is read and checked against the tolerances. The procedure can be iterated if necessary.

7.3.3 Perturb The perturb function is an open loop setting procedure used for knob applications. The previous value of VDES is subtracted from the new value of VDES and the difference used to calculate the needed number of steps to move the device. No attempt is made to wait for the device to actually complete the motion and no check is performed.

7.3.4 Home The home function is the stepping motor equivalent of the Dac Zero

STEPPING MOTOR CONTROL Page 7-5 function for magnets. The current value of the position AACT is read and the DVAC polynomial used to calculate the number of steps needed to move the device to its database set point AMMS(3).

7.3.5 Reset The reset function is used to initialize devices after a crate is powered on. For stepping motors it must write SPED, the speed and acceleration time, to the controller if speed is programmable. In addition, the appropriate SAM's are reset to IEEE mode as for magnets, and all previously trimmed devices are re-trimmed.


7.4.1 Control Functions The VAX magnet control routine sends standard Calibrate, Check, Trim and Zero(=Home) commands for a stepping motor to the micro. It also allows entering of values for VDES and VCON. Necessary revisions are minor.

7.4.2 Adjust Knobs The magnet adjust knob handling routine uses the perturb function to allow the VDES of a stepping motor to be changed with a knob. Only minor revisions are required to handle the alternate secondary names.


7.4.3 Checkout Knobs The magnet checkout knob routine when used for stepping motors reads the two SAM channels assigned to the STEP and uses the DVA or DVAC polynomial to calculate the current 'absolute' DAC setting. This is used as the starting point for the knob. Knob turns are treated as increments and written directly to the STEP's DAC register. The display is an expansion of the normal magnet checkout display and includes the DAC increment, equivalent 'absolute' DAC setting, status register, both SAM channels and ripple measured on each, calculated cursor position and status. Messages are generated as usual when limits or errors are detected.

7.4.4 Displays The magnet display routines also display stepping motors in all the standard magnet display formats, where the appropriate secondaries VCON, VDES, and VACT are substituted for the magnet B field values. An additional field on the All unit display is used to specify appropriate units for the values.

7.5 SOFTWARE DETAILS IN THE MICRO Since all Camac reading and writing for magnet control use two routines, DACSET and READADC, most of the important modifications to the micro software are in these routines.


7.5.1 DACSET(Unit,Dac_value,Ptrbflag) The DACSET routine must calculate the value to be written to the DAC differently for STEPs. For normal magnets, if they are not being perturbed, Dac_value is masked, checked for limits and written to the DAC. If perturbed, the current DAC setting is read and the argument Dac_value is treated as an increment. For STEPs this logic is reversed as all values written are increments and not absolute. If a STEP is perturbed, Dac_value can be written directly to the DAC (after appropriate checks). If a STEP is not perturbed, an absolute DAC value corresponding to the current AACT is calculated and subtracted from Dac_value to give the incremental value to be written to the DAC. There are three other important differences in setting stepping motors: 1. The software must require that the count register is at zero and that the motor has stopped moving before writing a new value to the controller. This is a problem only on Perturb functions where the software does not wait for motion to complete before accepting a new command. This certainly affects the response time of stepping motor knobs. 2. To support 24 bit controllers, the value written must be 4 bytes and the CAMAC operation must use Pack 24. 3. As soon as the value is written to the count register, the stepping motor begins to move and to decrement the count register. This implies that the DAC readback check normally performed is meaningless and must be bypassed for STEPs.

STEPPING MOTOR CONTROL Page 7-8 These differences should be transparent to the control routines, except for the additional delay on Perturb functions.

7.5.2 READADC(Type,Waitflag) The READADC routine treats SAM's and PSC's separately. The SAM channels used by STEPs are read at the same time as the other SAM channels and are treated similarly. However, if STEPs are present and READADC is called with Waitflag set so that it waits for data to be valid before reading, then it must read the STEP status registers and wait for motion to finish before reading the SAM's. In addition, after the SAM's are read it must loop over the STEPs and calculate the cursor position by dividing the first STEP channel by the second. These differences are transparent to the control routines.

7.5.3 SAMRESET() This routine must write the SPED value to the STEP as well as sending the reset commands to the SAMs. In order to provide support for modules not equipped with the programmable speed option, the software must not require correct X and Q response if the value of SPED is zero.

7.5.4 DACZERO() This routine must set the STEP to the database set point value AMMS(3) instead of to 0.0 for PSCs or to 32768.0 for the offset binary Transiac channels.


7.5.5 CALIBALL(Type) This routine must call READADC to calculate current STEP values before calibrating STEPs.

Go to top of page
Contact (until Aug. 15, 1996): Jeffrey Miller
Owner: Bob Sass

Converted from VAX Runoff output using doc2webset.pl