TOC PREV NEXT INDEX

Put your logo here!


3 REFERENCE MANUAL

This chapter provides a detailed description of the mot API procedures and tools and motci ACI commands provided by these two modules.

The API functions and tools are described in UNIX man-page format and are organized in alphabetical order.

The ACI commands are described in the Command Definition Table of the process motServer (file motServer.cdt).

Necessary include files are also listed.

3.1 Aplication Programmatic Interface

3.1.1 motAttach(3)
NAME
motAttach - attach a motor


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motAttach (
IN dbSYMADDRESS dbPath,
IN motACCESS_MODE mode,
OUT motHANDLE *handle,
OUT ccsERROR *error
)


DESCRIPTION
This routine attaches a motor to the user's application.
The motor is specified by its pathname <dbPath>, which is the absolute
path to the motor or its alias in the local database.
The parameter <mode> specifies the access rights to motor.
The returned <handle> identifies the channel to the motor and
is required for any further motor library function call.

Possible access modes are:
- motREAD_ONLY : only read actions are possible
- motEXCLUSIVE : all functions provided by the motor library
are allowed; a motor can be attached only
once in this mode
- motEMERGENCY : for emergency case only

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if motor attached successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36

3.1.2 motCheckBrake(3)
NAME
motCheckBrake - check the brake status of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motCheckBrake (
IN motHANDLE handle[],
IN vltINT32 *status,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motCheckBrake() checks the status of the
brake for the set of motors, specified in the <handle> list.
It returns the values in the <status> array. The <status> array need
not provide space for a terminator entry.

This routine needs READ_ONLY access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine processes
all motors of the <handle> list, and does not stop execution when an
error occurs.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.3 motCheckInterlock(3)
NAME
motCheckInterlock - check interlock line status of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motCheckInterlock (
IN motHANDLE handle[],
IN vltINT32 *status,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motCheckInterlock() checks the status of the
interlock line for the set of motors, specified in the <handle> list.
It returns the values in the <status> array. The <status> array need
not provide space for a terminator entry.

This routine needs READ_ONLY access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine processes
all motors of the <handle> list, and does not stop execution when an
error occurs.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.4 motCheckMove(3)
NAME
motCheckMove - check validity of requested motion for a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motCheckMove (
IN motHANDLE handle[],
IN motMOTION *motionReq,
OUT ccsERROR *error
)


DESCRIPTION
This routine check the validity of the requested motions for all
motors specified by the <handle> list.
The <motionReq> array must at first contain the motions for the first
motor in the <handle> list, with the 'lastStep' flag set in the last
motion for this motor. Then the motion entries for the second motor
in the <handle> list in the same way, and so on.
The motion mode for each motor must have been defined by a
previous motSetMotionMode() call.
Each movement represents one entry in <motionReq> array,
and is defined as follows :

<motionReq>->posType - the position types are :
motABSOLUTE, motRELATIVE,
motLOWER_LIMIT, motUPPER_LIMIT,
motREFERENCE_SWITCH, motINDEX_PULSE,
motHOME_POSITION, motBY_SPEED,
motTWO_STEP_ABS, motTWO_STEP_REL
motHALF_TURN_ABS, motHALF_TURN_REL

<motionReq>->speed - moving speed

For the motion mode motPOSITION_MODE & motTRACKING_MODE, the target
position must be provided, except for the position type motBY_SPEED.

<motionReq>->pos - the target position

<motionReq>->lastStep - flag to indicate the last step of a sequence
for a motor (TRUE/FALSE)

The minimum access right is READ_ONLY. The validity of the motion
sequences is checked if the motor(s) is(are) not moving, but their
validity may change if a motion is performed after this call.
In order to avoid any dependency, it is recommended to start the
sequence from a known position.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs or when a motion is illegal, and does
not process the remaining motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none


SEE ALSO
motMove




- - - - - -
Last change: 30/09/98-10:36


3.1.5 motClampBrake(3)
NAME
motClampBrake - clamps the brakes of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motClampBrake (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motClampBrake() clamps the brakes
of the set of motors, specified in the <handle> list.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description is returned in the <error> variable. The routine does not
break execution when an error occurs, but tries to process the
remaining motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if routine terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.6 motConnect(3)
NAME
motConnect - enable electrical connection of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motConnect (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motConnect() enables the electrical connection
of the set of motors, specified in the <handle> list.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine stops
execution when an error occurs, nad does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.7 motDetach(3)
NAME
motDetach - release the access to a set of motors



SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motDetach (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
This routine releases the access to the motors, specified in the
<handle> list. If a motor is still moving, it is not detached and
an error is returned.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The processing is
stopped when the first error occurs.


FILES
None


ENVIRONMENT
None


RETURN VALUES
SUCCESS, if function terminated successfully
FAILURE, if any error occurred




- - - - - -
Last change: 30/09/98-10:36


3.1.8 motDigToCurrent(3)
NAME
motDigToCurrent - convert digital value to user defined current unit


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motDigToCurrent (
IN motHANDLE handle,
IN vltINT32 currDig,
INOUT motMETRIC *currUser,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motDigToCurrent() converts a motor current
from the digital value <currDig> to the value <currUser> in user units.
The required unit has to be specified in <currUser>->unit
(for example "mA"), the value evaluated is returned by
<currUser>->value (double). The unit specified must be defined
in the local database.

The conversion is specified for the motor defined by <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.9 motDisable(3)
NAME
motDisable - disable motion control loop for a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motDisable (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motDisable() disables the motion control loop
for a set of motors, specified by the <handle> list. This function
is supported by motion controller boards only. If no controller is
configured an error is returned.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none


SEE ALSO
Technical Description of Motion Controller




- - - - - -
Last change: 30/09/98-10:36


3.1.10 motDisconnect(3)
NAME
motDisconnect - disable electrical connection of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motDisconnect (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motDisconnect() disables the electrical
connection of the set of motors, specified in the <handle> list.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none





- - - - - -
Last change: 30/09/98-10:36


3.1.11 motEnable(3)
NAME
motEnable - enable motion control loop for a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motEnable (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motEnable enables the motion control loop for
the set of motors, specified by the <handle> list.
This function is supported by motion controller boards only.
If no controller is configured an error is returned.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none


SEE ALSO
Technical Description of corresponding motion controller




- - - - - -
Last change: 30/09/98-10:36


3.1.12 motEncToName(3), motEncToIndex(3)
NAME
motEncToName - convert encoder ticks to named position


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motEncToName (
IN motHANDLE handle,
IN vltINT32 posEnc,
INOUT motSECTION *section,
OUT vltBYTES32 name,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motEncToName() tries to convert a position
<posEnc>, given in encoder ticks to a <name>, which corresponds to
a named position.
By <section> the type of position requested is specified.
Possible values are:
- motOBSERVATION
- motMAINTENACE
- motUSER_DEFINED
- motALL_SECTION

In case of motALL_SECTION, the associated named position is searched
in all sections, starting with OBSERVATION. The first matching named
position is returned. The name and section are set to the matching
values.
If no matching name is found,
<name> is set to empty string "",
<section> is set to motNO_SECTION.

The database section SERVER_CONF:POSITIONS is queried for the named
positions.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.13 motEncToPos(3)
NAME
motEncToPos - convert encoder values to position in user units


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motEncToPos (
IN motHANDLE handle,
IN vltINT32 posEnc,
INOUT motMETRIC *posUser,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motEncToPos converts the position from encoder
ticks <posEnc> to user units defined by <posUser>->unit
(for example "deg").
The value evaluated is returned by <posUser>->value (double).
The user unit specified must be defined in the local database.
The conversion is specific for the motor, defined by <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
The position must be absolute




- - - - - -
Last change: 30/09/98-10:36


3.1.14 motEncToVel(3)
NAME
motEncToVel - convert encoder speed values to velocity in user units


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motEncToVel (
IN motHANDLE handle,
IN vltDOUBLE velEnc,
INOUT motMETRIC *velUser,
OUT ccsERROR *error
)


DESCRIPTION
This routine motEncToVel() converts the velocity from encoder ticks
per time unit <velEnc> to user units specified by <velUser>->unit
(for example "deg/sec"). The value evaluated is returned by
<velUser>->value (double). The user unit specified must be defined
in the local database.
The conversion is specific for the motor, defined by <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.15 motGetOpMode(3)
NAME
motGetOpMode - get operational mode of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motGetOpMode (
IN motHANDLE handle[],
OUT motOPMODE mode[],
OUT ccsERROR *error
)


DESCRIPTION
This routine returns the operational modes of all motors in the
specified <handle> list in the array <mode>.
Possible modes are:
- motNOT_AVAILABLE
- motFIXED_POSITION
- motSIMULATION
- motNORMAL
- motHANDSET

Note: the <mode> array is not terminated by a special entry.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
The <mode> array must be large enough to contain all the modes of the
requested motors.




- - - - - -
Last change: 30/09/98-10:36


3.1.16 motGetHandle(3), motGetSemIEV(3)
NAME
motGetSemIEV - Returns the semaphore for IEV Isr


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motGetSemIEV (
IN motHANDLE handle,
OUT SEM_ID *semIEV,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motGetSemIEV() retrieves the semaphore given
by the Interrupt Service Routine handling the external encoder value.
It returns FAILURE if the pointer to the semaphore is NULL.
The function waits forever until the semaphore has been created
by motInitSw().

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description is returned in the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if routine terminated successfully
FAILURE if anything went wrong


CAUTIONS
none


SEE ALSO
motWriteEncoderValue(3), motGetHandle(3)




- - - - - -
Last change: 30/09/98-10:36


3.1.17 motGetStatus(3)
NAME
motGetStatus - get status information of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motGetStatus (
IN motHANDLE handle[],
INOUT motSTATUS status[],
OUT ccsERROR *error
)


DESCRIPTION
This routine returns status information for the specified set of motors
in the <status> array with an entry for each motor specified by the
<handle> list. Additionally the MOTOR_STATUS section of each motor
database-point is updated accordingly.

The <status> data structure is build up in the following way:

parameter | meaning | possible values
--------------+------------------------+-------------------------------
opMode | operational mode | motNOT_AVAILABLE/motHANDSET
| | motFIXED_POSITION/motNORMAL
| | motSIMULATION
motionMode | actual motion mode | motDIRECT_MODE/motSPEED_MODE
| | motTRACKING_MODE
| | motPOSITION_MODE
motionStatus | motion status | motSTANDING/motMOVING
| | motTIMEOUT/motABORTED
motionStep | number of motion |
initStatus | initialization status | motNOT_INT/motSW_INIT
| | motHW_INIT_RUN
| | motINIT_DONE
initStep | step of init sequence |
brakeClamped | brake status | (I/O signal)
axisEnabled | axis enabled flag | TRUE/FALSE
eventMask | bit mask to encode | motMOTION_END/motDRIVE_FAULT
| abnormal events | motEMERGENCY_STOP
| | motOVER_TEMPERATURE
| | motOVER_CURRENT/motON_LIMIT
| | motPOSITIONING_ERROR
| | motNORMAL_STOP
amplStatus | amplifier status | motNOT_AVAILABLE/OK/ERROR
powerStatus | electrical connection | motBOTH/motNEGATIVE
| | motPOSITIVE/motDISCONNECTED
mconStatus | controller status | motNOT_AVAILABLE/OK/ERROR
inPos | in position flag | TRUE/FALSE
amplOnLimit | amplifier limit flag | motNOT_ON_LIMIT/motHW_UPPER
| | motHW_LOWER
mconOnLimit | controller limit flag | motNOT_ON_LIMIT
| | motSW_LOWER/motSW_UPPER
| | motHW_LOWER/motHW_UPPER
| | motHW_BOTH
interlock | interlock line status | (I/O signal)
speed | actual speed |
speedUnit | speed unit | for example "deg/sec"
| | (type motUNIT)
current | actual motor current |
currentUnit | motor current unit | for example "mA"
| | (type motUNIT)
posEnc | actual position in |
| encoder ticks |
posUser | actual position in |
| user units |
posUnit | position user unit | for example "deg"
| | (type motUNIT)
posName | name of actual position| NULL, if none available
posSection | position section | motOBSERVATION/motMAINTENANCE
| | motUSER_DEFINED/motNO_SECTION
nextPosEnc | next position in |
| encoder ticks |
nextPosUser | actual position in |
| user units (posUnit) |
nextPosName | name of next position | NULL, if none available
nextPosSection| next position section | motOBSERVATION/motMAINTENANCE
| | motUSER_DEFINED/motNO_SECTION
followingErr | actual following error |
| in user units (posUnit)|
startTime | start time of movement |
| in UTC |
endTime | end time of movement |
| in UTC |

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.18 motInitHw(3)
NAME
motInitHw - initialize board hardware for specified motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motInitHw (
IN motHANDLE handle[],
IN vltLOGICAL mandatory,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motInitHw initializes the board hardware of
the boards controlling the motors specified in the <handle> list.
The <mandatory> flag specifies whether the initialization has to be
performed in any case (TRUE) or only, if not done before (FALSE).

If any user functions are used for HW initialization, pointers
to user defined data structures to be passed to the functions are
located in the Database :SERVER:INIT:INIT:action[].userParList.
The following parameters will be passed to the user function:
- pointer to user defined data structure
- error structure address

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.19 motInitSampling(3)
NAME
motInitSampling - initialize status sampling for a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motInitSampling (
IN motHANDLE handle[],
IN vltINT32 period,
IN motSECTION section,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motInitSampling starts the status sampling
for the motors, specified in the <handle> list. The sample data is
stored in intervals of <period> in the local database general status
section. For each motor one sampling task is spawned.
The named positions are searched for in the given <section>.
Depending on the <period>, the effective sampling period is:
range [-100 ; -2] : the period is 1/|<period>| in seconds
value -1 : as fast as possible
value 0 : set to the DB value SERVER:CONF.motor(0,timemon).
range [+1 -> ) : the period is <period> in seconds
The minimum <period> is -100, any setting below is forced to 100Hz.

Since the time to retrieve the boards' status is approx. 10ms, and

This routine needs READ_ONLY access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.20 motInitSw(3)
NAME
motInitSw - initialize board software for specified motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motInitSw (
IN motHANDLE *handle,
IN vltLOGICAL mandatory,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motInitSw initializes the board software of
the boards controlling the motors, specified in the <handle> list.
The <mandatory> flag specifies whether the initialisation has to be
performed in any case (TRUE) or only, if not done before (FALSE).

If anything goes wrong FAILURE is returned and the error reason and
description are returned in the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.21 motLoadPar(3)
NAME
motLoadPar - load parameters to a board, controlling a motor


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motLoadPar (
IN motHANDLE handle,
IN motBOARD_TYPE board,
INOUT vltUINT32 *number,
IN motPARAMETER *parBuf,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motLoadPar() loads board specific parameters
for the motor, specified through its <handle> to the <board> of the
specified type.
Possible board types are motAMPLIFIER/motCONTROLLER.
The number of parameters to be loaded is passed by <number>,
parameter names and values are defined by the <parBuf> array
(<parBuf>->parName/<parBuf>->parValue).
After termination of this function <number> contains the number of
parameters successfully loaded.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
parameters.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
This routine is for ONE motor only, not for a set of motors. It is
intended to be used for maintenance purposes only.




- - - - - -
Last change: 30/09/98-10:36


3.1.22 motMotors(3)
NAME
motMotors - Returns the number and list of installed motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motMotors ( int *num, vltBYTES20 list[] )


DESCRIPTION
This function returns in the string pointed to by <list> the list of
the installed motors using the DB aliases.


FILES
none


ENVIRONMENT
none


CAUTIONS
If the list is to be returned in the string <list>, enough space MUST
have been allocated (up to 20 bytes per motor).




- - - - - -
Last change: 30/09/98-10:36


3.1.23 motMove(3)
NAME
motMove - start movement of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motMove (
IN motHANDLE handle[],
IN motMOTION *motionReq,
OUT ccsERROR *error
)


DESCRIPTION
This routine initiates motions for all motors specified by the
<handle> list.
For each motor a sequence of motions can be defined by <motionReq>.
For each movement one entry in <motionReq> must contain:

<motSeq>->posType - the position type
(motABSOLUTE/motRELATIVE/motLOWER_LIMIT/
motUPPER_LIMIT/motREFERENCE_SWITCH/motINDEX_PULSE/
motHOME_POSITION/motBY_SPEED/
motTWO_STEP_ABS/motTWO_STEP_REL/
motHALF_TURN_ABS/motHALF_TURN_REL)
<motSeq>->speed - moving speed
<motSeq>->pos - the position to move to (motABSOLUTE/motRELATIVE)
<motSeq>->lastStep - flag to indicate the last step of a sequence
for a motor (TRUE/FALSE)

The <motionReq> array must at first contain the motions for the first
motor in the <handle> list, with the 'lastStep' flag set in the last
motion for this motor. Then the motion entries for the second motor
in the <handle> list in the same way, and so on.
The motion mode for each motor must have been defined by a previous
motSetMotionMode() call.

If the motor is electrically disconnected, it will be automatically
connected.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.24 motNameToEnc(3)
NAME
motNameToEnc - convert named position to encoder ticks


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motNameToEnc (
IN motHANDLE handle,
IN vltBYTES32 name,
IN motSECTION section,
OUT vltINT32 *posEnc,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motNameToEnc() converts a named position,
specified by its <name> and <section> to the corresponding encoder
ticks and returns its value by <posEnc>.
Possible values for <section> are: - motOBSERVATION
- motMAINTENANCE
- motUSER_DEFINED

The routine works specific for the motor <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.25 motNameToVel(3)
NAME
motNameToEnc - convert named position to encoder ticks


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motNameToEnc (
IN motHANDLE handle,
IN vltBYTES32 name,
IN motSECTION section,
OUT vltINT32 *posEnc,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motNameToEnc() converts a named position,
specified by its <name> and <section> to the corresponding encoder
ticks and returns its value by <posEnc>.
Possible values for <section> are: - motOBSERVATION
- motMAINTENANCE
- motUSER_DEFINED

The routine works specific for the motor <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.26 motPosToEnc(3)
NAME
motPosToEnc - convert position to encoder values


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motPosToEnc (
IN motHANDLE handle,
IN motMETRIC *posUser,
OUT vltINT32 *posEnc,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motPosToEnc() converts the position in user
units <posUser> (for example "deg") to an encoder specific value
and returns it by <posEnc>. The user unit specified must be defined
in the local database.
The conversion is specific for the motor defined by <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
The position must be absolute




- - - - - -
Last change: 30/09/98-10:36


3.1.27 motRefToVel(3)
NAME
motRefToVel - convert ampl velocity reference to velocity in user units


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motRefToVel (
IN motHANDLE handle,
IN vltINT32 velRef,
OUT motMETRIC *velUser,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motRefToVel() converts the velocity from
amplifier velocity reference <velRef> to user units <velUser>
(for example "deg/sec").
The user unit specified must be defined in the local database.
The conversion is specific for the motor, defined by <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.28 motResetAxis(3)

See motResetSw(3).



- - - - - -
Last change: 30/09/98-10:36

3.1.29 motResetBoards(3)

See motResetHw(3).



- - - - - -
Last change: 30/09/98-10:36

3.1.30 motRetrievePar(3)
NAME
motRetrievePar - retrieve parameters from a board, controlling a motor


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motRetrievePar (
IN motHANDLE handle,
IN motBOARD_TYPE board,
INOUT vltUINT32 *number,
INOUT motPARAMETER *parBuf,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motRetrievePar retrieves board specific
parameters of the motor, specified by <handle> from the <board> of the
specified type.
Possible board types are motCONTROLLER and motAMPLIFIER.
The number of parameters to be retrieved is specified by <number>.
Each parameter is specified by its name in the corresponding <parBuf>
entry (<parBuf->parName), whereby the parameter value will be returned
by <parBuf>->parValue.
After termination of this function <number> contains the number of
parameters successfully read.

This routine needs EXCLUSIVE access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
parameters.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
This routine is for ONE motor only, not for a set of motors. It is
intended to be used for maintenance purposes only.




- - - - - -
Last change: 30/09/98-10:36

3.1.31 motSetDefaultUnits(3)
NAME
motSetDefaultUnits - set default user units for a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motSetDefaultUnits (
IN motHANDLE *handle,
IN motDEFAULT_UNITS *units,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motSetDefaultUnits() defines the default <units>
for position, speed and electric current for the set of motors
specified in the <handle> list. The default units are stored in the
local database and are used in the motor status, where parameters are
noted in user units.

This routine needs READ_ONLY access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.32 motSetMotionMode(3)
NAME
motSetMotionMode - set motion mode for a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motSetMotionMode (
IN motHANDLE handle[],
IN motMOTIONMODE mode[],
OUT ccsERROR *error
)


DESCRIPTION
This routine sets the motion mode of each motor specified by the
handle list <handle>. The mode array need not be terminated.
Supported motion modes are:
- DIRECT : control through amplifier only
- POSITION : move to absolute or relative position
- TRACKING : follow a sequence of positions
- SPEED : drive with a constant speed, no target position

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the list.


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.33 motSetOpMode(3)
NAME
motSetOpMode - select the operational mode of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motSetOpMode (
IN const motHANDLE handle[],
IN const motOPMODE opMode[],
OUT ccsERROR *error
)


DESCRIPTION
This routine sets all motors in the specified <handle> list to the
operational mode as specified in the corresponding entry of the
<opMode> array.
Possible operational modes are: - motNOT_AVAILABLE
- motFIXED_POSITION
- motSIMULATION
- motNORMAL
- motHANDSET

If a required mode is equal to the current mode, no error is returned.
The <opMode> array need not have a terminating entry, unlike the
<handle> array.

If the operational mode is set to NORMAL or HANDSET the motor is
automatically electrically connected; in any other case the motor
is disconnected.

If a motion controller is available the control loop will be
automatically disabled.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine stops
execution when an error occurs, and does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
This routine needs EXCLUSIVE access right to the motors.




- - - - - -
Last change: 30/09/98-10:36


3.1.34 motGetParListAddress(3), motSetParListAddress(3)
NAME
motSetParListAddress, motGetParListAddress - Write / read the address
of the user data structure to the Database


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motSetParListAddress (
IN motHANDLE handle,
IN motUSER_FCT fctType,
IN vltINT32 fctOccurence,
IN vltBYTES32 fctName,
IN vltUINT32 parList,
OUT ccsERROR *error
)

ccsCOMPL_STAT motGetParListAddress (
IN motHANDLE handle,
IN motUSER_FCT fctType,
IN vltINT32 fctOccurence,
IN vltBYTES32 fctName,
IN vltUINT32 *parList,
OUT ccsERROR *error
)


DESCRIPTION
The two routines motSetParListAddress() & motGetParListAddress()
writes / reads in the Database the address <parList> of the data
structure to be used by the specified user function <fctName>
for the given motor <handle>.

According to the function type <fctType>, the routine will determine
where to access the <parList> value in the Database.
- motUSER_INIT : :SERVER:INIT:INIT.action[].userParList
- motUSER_CONV : :SERVER:UNITS:UNITS.unitConversion[].userParList

The parameter <fctOccurence> defines the accessing mode of the address:
- 0 : all occurences of the function in the table are updated
(only for motSetParListAddress())
- 1 : the first occurence only
- 2 : the second occurence only
- etc ...

This routine needs EXCLUSIVE access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.35 motSetSwLimits(3)
NAME
motSetSwLimits - set SW limits of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motSetSwLimits (
IN const motHANDLE handle[],
IN motPOSITION *positions,
IN motPOS_TYPE *posTypes,
IN motLIMITS *limitFlags,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motSetSwLimits() sets the software limits
of the set of motors, specified in the <handle> list.

This routine needs EXCLUSIVE access right to the motors.

For each motor, an entry in the array <limitFlags> has to be provided
specifying the limits to be set.
The possible values are : motSW_UPPER / motSW_LOWER / motSW_BOTH.
Dependent on this flag, the limits have to be defined in the array
<positions>. If both limits have to be set, the lower limit has to be
defined first in the array <position>.

The <posTypes> array must built as <positions> and defines the setting
type of the limit, i.e.:
- motABSOLUTE : limit is given as an absolute position
- motRELATIVE : limit is given relative to actual position
- motLOWER_LIMIT : limit is given relative to lower HW limit
- motUPPER_LIMIT : limit is given relative to upper HW limit
- motREFERENCE_SWITCH : limit is given relative to the ref switch
- motINDEX_PULSE : limit is given relative to the index pulse
- motHOME_POSITION : limit is given relative to the home position

If anything goes wrong FAILURE is returned and the error reason and
description is returned by the <error> variable. The routine stops
execution when an error occurs, nad does not process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.36 motStop(3)
NAME
motStop - stop the motion of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motStop (
IN motHANDLE *handle,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motStop() stops all motors specified in the
<handle> list. The Motion Monitor is informed to stop monitoring these
motors. If a motor has already stopped no error is returned.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine does not
stop execution when an error occurs, and processes the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.37 motStopSampling(3)
NAME
motStopSampling - stop status sampling for a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motStopSampling (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motStopSampling() stops the status sampling
for all motors specified by the <handle> list.

Note: This routine stops when an error occurs, and does not process
the remaining motors.

This routine needs READ_ONLY access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.38 motUnclampBrake(3)
NAME
motUnclampBrake - unclamps the brakes of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motUnclampBrake (
IN motHANDLE handle[],
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motUnclampBrake() unclamps the brakes
of all motors specified by the <handle> list.

This routine needs EXCLUSIVE access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable. The routine does not
stop execution when an error occurs, but tries to process the remaining
motors of the set.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.39 motVelToEnc(3)
NAME
motVelToEnc - convert velocity in user units to encoder ticks


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motVelToEnc (
IN motHANDLE handle,
IN motMETRIC *velUser,
OUT vltDOUBLE *velEnc,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motVelToEnc() converts the velocity in user
units <velUser> (for example "deg/sec") to an encoder specific value
and returns it by <velEnc>. The user unit specified must be defined
in the local database.
The conversion is specific for the motor defined by <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.40 motVelToRef(3)
NAME
motVelToRef - convert velocity in user units to ampl velocity reference


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motVelToRef (
IN motHANDLE handle,
IN motMETRIC *velUser,
OUT vltINT32 *velRef,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motVelToRef() converts the velocity in user
units <velUser> (for example "deg/sec") to an amplifier velocity
reference value and returns it by <velRef>. The user unit specified
must be defined in the local database.

The conversion is specific for the motor defined by <handle>.

This routine needs READ_ONLY access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description are returned by the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.1.41 motWaitInit(3)
NAME
motWaitInit - wait for HW initialization completion of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motWaitInit (
IN motHANDLE handle[],
IN vltINT32 timeout,
IN motSTATUS *statusBuffer,
OUT ccsERROR *error
)


DESCRIPTION
The routine motWaitInit is used to wait for the initialization
completion of all motors specified by the <handle> list.
The routine waits until all initializations have been completed
within <timeout> milliseconds, passed this time it returns FAILURE.
The routine returns FAILURE as soon an initialization failed,
the remaining motors of the list are ignored.
The current status of all motors is returned in the
<statusBuffer> array, one entry per motor in the same order as the
handle list, but without a termination entry.

Multiple use of this function by several applications for the same
motor is not possible.

This routine needs READ_ONLY access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned in the <error> stack. The routine stops
execution when an error occurs, and does not process the remaining
motors of the list.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if a time-out occurred
an initialization failed
an other task is already waiting for one motor
an internal error occurred while initiating the wait
or reading the motor status.


CAUTIONS
none


SEE ALSO
motGetStatus(), motWaitMove()




- - - - - -
Last change: 30/09/98-10:36


3.1.42 motWaitMove(3)
NAME
motWaitMove - wait for motion completion of a set of motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motWaitMove (
IN motHANDLE handle[],
IN vltINT32 timeout,
IN motSTATUS *motStatus,
OUT ccsERROR *error
)


DESCRIPTION
The routine motWaitMove is used to wait for the motion
completion of all motors specified by the <handle> list.
The routine waits until all motion sequences have been completed
within <timeout> milliseconds, passed this time it returns FAILURE.
The routine returns FAILURE as soon a motion failed, the remaining
motors of the list are ignored.
The current status of all motors is returned in the
<motStatus> array, one entry per motor in the same order as the
handle list, but without a termination entry.

Multiple use of this function by several applications for the same
motor is not possible.

This routine needs READ_ONLY access right to the motors.

If anything goes wrong FAILURE is returned and the error reason and
description are returned in the <error> stack. The routine stops
execution when an error occurs, and does not process the remaining
motors of the list.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if a time-out occurred
a motion failed
an other task is already waiting for one motor
an internal error occurred while initiating the wait
or reading the motor status.


CAUTIONS
none


SEE ALSO
motGetStatus(), motWaitInit()




- - - - - -
Last change: 30/09/98-10:36


3.1.43 motWriteEncoderValue(3)
NAME
motWriteEncoderValue - Write encoder value to motion controller


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motWriteEncoderValue (
IN const motHANDLE handle,
IN vltINT32 encoderValue,
OUT ccsERROR *error
)


DESCRIPTION
The mot Server routine motWriteEncoderValue() writes the
<encoderValue> to the Motion Controller board.

This routine needs EXCLUSIVE access right to the motor.

If anything goes wrong FAILURE is returned and the error reason and
description is returned in the <error> variable.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if routine terminated successfully
FAILURE if anything went wrong


CAUTIONS
none


SEE ALSO
motGetSemIEV(3), motGetHandle(3)




- - - - - -
Last change: 30/09/98-10:36


3.2 Application Command Interface

Considered the size of the command definition table, the reader is invited to refer directly to the file $VLTROOT/CDT/motServer.cdt.

All the parameters and returned values are either character strings or binary formatted numbers.

Help texts, command and parameter description are available on-line using lccei.

===========================================================================

PUBLIC_COMMANDS

===========================================================================

Commands to create, modify and delete motor sets

===========================================================================

CREASET ADDMOT REMMOT DELSET GMOTSET

===========================================================================

Commands to get/release access to a motor or a set of motors

===========================================================================

INSTALL MOTORS DEINST

ATTACH DETACH CLEAR

===========================================================================

Control Commands

===========================================================================

CHKLOCK CHKBRAK CLAMP CONNECT DISABLE

DISCON ENABLE GENSTAT GETOPMO HWSTAT

INITDB INITHW INITSAM INITSW LOADPAR

MOTMODE MOTPAR RESETAX RESETBO RETRPAR

SETADDR SETLIM SETOPMO STATUS STOPSAM

UNCLAMP WAITMOV WAITINI

===========================================================================

Commands to define/modify motion sequences

===========================================================================

DEFSPD DEFSTEP REMSTEP DELSEQ

===========================================================================

Commands to start/stop motions

===========================================================================

MOVEABS MOVEREL MOVEUHW MOVELHW MOVEREF

MOVEIND MOVEHOM MOVESPD MOVESEQ STOPMOT

===========================================================================

Commands for unit conversion

===========================================================================

DEFUNIT DIG2CUR ENC2NAM ENC2POS ENC2VEL

NAM2ENC POS2ENC REF2VEL VEL2ENC VEL2REF

VEL2NAM SECTION

===========================================================================

general ...

===========================================================================

VERSION

===========================================================================

lcc standard commands

===========================================================================

INIT STANDBY ONLINE OFF STOP

EXIT STASIM STOSIM SELFTST KILL

===========================================================================

MAINTENANCE_COMMANDS

===========================================================================

TEST_COMMANDS

===========================================================================

3.3 Tools

3.3.1 motClear(1)
NAME
motClear - clear motor descriptor


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motClear (
IN dbSYMADDRESS dbPath
)


DESCRIPTION
The mot server routine motClear is used to reinitialize the descriptor
of the motor defined by <dbPath> (absolute symbolic path or alias)


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if an error occurred


CAUTIONS
No checks with regard to access rights etc. will be done. Any user
attached to the motor will be detached immediately.




- - - - - -
Last change: 30/09/98-10:36


3.3.2 motInitDb(1)
NAME
motInitDb - initialize database


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motInitDb ( char *motor, char *file, ccsERROR *error )


DESCRIPTION
This function restores the MCM database for the DB branch
@<lcuEnv><alias><motor>, taking the values from the '.dbcfg' <file>.

<motor> IN name of the camera
<file> IN absolute pathname of the '.dbcfg' file
<error> OUT error structure


RETURN VALUES
SUCCESS if everything ok
FAILURE if anything went wrong


CAUTIONS
It is assumed that the FS containing the file to restore is NFS mounted.




- - - - - -
Last change: 30/09/98-10:36


3.3.3 motInstall(1)/motDeinstall(1)
NAME
motInstall - install a motor in MCM


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motInstall ( IN char *dbPath, IN ccsERROR *error )


DESCRIPTION
This routine initializes the motor control module "mot" (first call),
and the motor designated by the argument <dbPath>,
database path to the motor point (symbolic or alias).

The routine checks whether the Local Database exists and the motor
section is accessible and then initializes all sub-modules: API and SDL

If anything goes wrong FAILURE is returned and the error reason and
description are logged.


FILES
none


ENVIRONMENT
none


RETURN VALUES
SUCCESS if function terminated successfully
FAILURE if anything went wrong


CAUTIONS
This routine must be called once for each motor at system start-up.




- - - - - -
Last change: 30/09/98-10:36



3.3.4 motPrintMotors(1)
NAME
motPrintMotors - Display the list of installed motors


SYNOPSIS
#include "mot.h"

ccsCOMPL_STAT motPrintMotors ( void )


DESCRIPTION
This function displays the list of installed motors on the LCU console.


FILES
none


ENVIRONMENT
none


SUCCESS
FAILURE if ccsInit, ccsExit or dbAliasToName fail.


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.3.5 motVersion(1)
NAME
motVersion - Print Motor Library Module Version


SYNOPSIS
void motVersion ( vltBYTES80 version )


DESCRIPTION
Extracts the version number of the installed Motor Control Module.
If <version> is NULL, the line is printed to the console.


FILES
none


ENVIRONMENT
none


RETURN VALUES
none


CAUTIONS
none




- - - - - -
Last change: 30/09/98-10:36


3.4 Include files

In order to get the necessary MCM and LCC data type definitions and function prototypes, the file mot.h must be included by any application source file referencing API functions and/or data structures. The file motDefines.h contains all the macros used in MCM. The file motPublic.h contains additional data type and structure definitions mapping database data structures. This file is intended to be included by SDL modules only, thus it should not be used at API level.

3.4.1 mot.h

/******************************************************************************

* E.S.O. - VLT project

*

* "@(#) $Id: mot.h,v 2.7 1998/09/18 14:03:28 vltsccm Exp $"

*

* who when what

* -------- -------- ----------------------------------------------

* CAM GmbH --/05/94 Created for Release 1.1

* P.Duhoux --/07/94 Modified for Release 1.2

* P.Duhoux 09/09/94 Renamed motVERSION_NUMBER to motVERSION

* and changed its definition

* P.Duhoux 12/05/95 Modified interface to motPrintMotors ( void )

* New function motMotors()

* P.Duhoux 09/06/95 Modified for CMM Archive

* P.Duhoux 07/07/95 Removed all literal definitions and

* include motDefines.h instead

* P.Duhoux 25/07/95 Added new function motCheckBrake()

* P.Duhoux 26/03/96 Added motStatus

* overCurrent,overTemperature

* onLimit,emergencyStop,driveFault,posError

* posIndex,nextPosIndex

* P.Duhoux 29/03/96 Added new functions:

* motGetSemIEV() & motWriteEncoderValue()

* P.Duhoux 12/09/96 Added new function motEncToIndex(), motGetHandle()

* P.Duhoux 13/09/96 Added new function motSetSection()

* P.Duhoux 10/11/96 Added new function motGetDbStatus()

* P.Duhoux 12/11/96 Moved definitions from motPublic.h for

* motCONFIG data structure,

* Added new function motGetDbConfig(), motFreeConfig()

* P.Duhoux 19/12/96 Added `par' in motMOTION for INIT HW (initCode/waitDelay)

* P.Duhoux 14/01/97 Added functions motResetSw/motResetHw equivalent to

* motResetAxis/motResetBoards (for cosmetics)

*/

#ifndef MOT_H

#define MOT_H

/******************************************************************************

* mot.h - motor control module API definition file

*------------------------------------------------------------------------------

*/

#ifdef __cplusplus

extern "C" {

#endif

/*

******************************************************************************

* Header Files

******************************************************************************

*/

/*

* LCC include files

*/

#include "CCS.h"

#include "cai.h"

/*

* MCM include files

*/

#include "motDefines.h"

#include "motErrors.h"

/*

******************************************************************************

* Literals

******************************************************************************

*/

/* MOT module name */

#define motMODULE "mot"

#define motMODULE_NAME "Motor Control Module API"

/* literal for motor library version */

#define motVERSION "$Revision: 2.7 $"

#define motVERSION_DATE "SEP98"

/*

******************************************************************************

* Data Types

******************************************************************************

*/

/*

* definition of motor handle

*/

typedef vltUINT32 motHANDLE;

/* data type for access modes */

typedef vltINT32 motACCESS_MODE;

/* data type for operational modes */

typedef vltINT32 motOPMODE;

/* data type for units */

typedef vltBYTES8 motUNIT;

/* data type for axis types */

typedef vltINT32 motAXIS_TYPE;

/* data type for encoder types */

typedef vltINT32 motENC_TYPE;

/* data type for motor types */

typedef vltINT32 motMOTOR_TYPE;

/* data type for encoder coding types */

typedef vltINT32 motENC_CODE;

/* data type for abnormal event types */

typedef vltINT32 motEVENT_TYPE;

/* data type for digital IO signal types */

typedef vltINT32 motSIGNAL_TYPE;

/* data type for position/speed definition types */

typedef vltINT32 motSPEC_TYPE;

/* data type for section types */

typedef vltINT32 motSECTION;

/* data type for position types */

typedef vltINT32 motPOS_TYPE;

/* data type for motion modes */

typedef vltINT32 motMOTIONMODE;

/* data type for electrical connection types for amplifier boards */

typedef vltINT32 motCONNECTION;

/* data type for board types */

typedef vltINT32 motBOARD_TYPE;

/* data type for limit types */

typedef vltINT32 motLIMITS;

/* data type for motion status types */

typedef vltINT32 motMOTION_STATUS;

/* data type for initialization status types */

typedef vltINT32 motINIT_STATUS;

/* data structure for parameters */

typedef struct

{

vltBYTES20 parName;

vltINT32 parValue;

} motPARAMETER;

/* data structure for default units */

typedef struct

{

motUNIT position;

motUNIT speed;

motUNIT current;

} motDEFAULT_UNITS;

/* data structure for metric number */

typedef struct

{

vltDOUBLE value;

motUNIT unit;

} motMETRIC;

/* data structure for speed definition */

typedef struct

{

motSPEC_TYPE how; /* speed definition mode */

motMETRIC number; /* speed literal (value and unit) */

vltBYTES32 name; /* speed name */

vltUINT32 index; /* index in speed name table */

vltUINT32 pollInt; /* polling interval in millisec */

vltUINT32 endPollInt; /* end-phase polling interval in millisec */

vltUINT32 inPosTime; /* needed in-position count for motion */

/* complete condition in ms */

} motSPEED;

/* data structure for position name */

typedef struct

{

vltBYTES32 posName;

motSECTION section;

} motPOS_NAME;

/* data structure for position definition */

typedef struct

{

motSPEC_TYPE how; /* position definition mode */

motMETRIC number; /* position literal (value and unit) */

motPOS_NAME name; /* named position */

vltUINT32 index; /* name index */

} motPOSITION;

/* data structure for motion definition */

typedef struct

{

motPOS_TYPE posType; /* position type */

motPOSITION pos; /* position */

motSPEED speed; /* speed */

vltINT32 par; /* initCode/waitDelay (INIT only) */

vltLOGICAL lastStep; /* flag for "last step in motion sequence" */

} motMOTION;

typedef struct

{

motMOTOR_TYPE type; /* DC | STEPPER */

vltINT32 timeout; /* motion timeout in milliseconds */

vltINT32 timelim; /* timeout for motion out of limit */

vltINT32 timemon; /* automatic monitoring period */

motOPMODE opMode; /* operational mode on first attach */

vltINT32 posEnc; /* Fixed Position definition */

vltDOUBLE posUser;

vltBYTES8 posUnit;

vltBYTES32 posName;

vltINT32 posSection;

vltINT32 chkHwLimit;/* Check flag for HW limits */

} motMOTOR_DEF;

/* database map for board configuration */

typedef struct

{

motBOARD_TYPE type;

vltINT32 available;

vltBYTES8 prefix;

} motBOARD_CONF;

typedef struct

{

vltUINT32 name;

motEVENT_TYPE eventType;

motBOARD_TYPE boardType;

vltBYTES20 eventName;

} motEVENT_CFG;

/* database for IO signals */

typedef struct

{

vltINT32 signal; /* Signal type */

vltBYTES8 device; /* Associated device name */

vltINT32 startBit; /* Start bit number */

vltINT32 level; /* Signal logic */

} motSIGNAL_CFG;

typedef struct

{

motENC_TYPE type; /* Encoder type */

motBOARD_TYPE board; /* Interface board */

motENC_CODE code; /* Code type [binary/BCD/Gray] */

vltUINT32 address; /* Address for external */

vltUINT32 resolution; /* Valid bits (absolute only) */

vltUINT32 count; /* Encoder Counts / Encoder Turn */

vltUINT32 circularRange; /* Circular Range */

vltUINT32 stepCount; /* Encoder Counts / Motor turn (STP) */

vltUINT32 bitShift; /* Shift (SSI only) */

} motENCODER;

/* database map for special positions' configuration */

typedef struct

{

vltINT32 set;

motPOS_TYPE posType;

vltDOUBLE position;

motUNIT unit; /* Unit must be motBOARD_UNIT_POS */

} motSPECIAL_POSITIONS_CFG;

/* database map for named position offsets in Enc */

typedef struct

{

/* Offsets - Unit must be motBOARD_UNIT_POS or default position unit */

vltDOUBLE maintOffset; /* offset to maintenance section */

vltDOUBLE userOffset; /* offset to user defined section */

motUNIT unit;

/* reserved for internal use - Unit is motBOARD_UNIT_POS */

vltINT32 maintOffsetEnc; /* Unit is motBOARD_UNIT_POS */

vltINT32 userOffsetEnc; /* Unit is motBOARD_UNIT_POS */

} motNAMED_POSITION_OFFSET;

/* database map for named positions */

typedef struct

{

vltBYTES32 name; /* position name */

motPOS_TYPE posType; /* position type */

vltDOUBLE obsPos; /* nominal observation position value */

vltDOUBLE lowRange; /* lower range offset */

vltDOUBLE upRange; /* upper range offset */

vltINT32 maintOffsetAvail;/* maintenance offset available flag */

vltDOUBLE maintOffset; /* offset to maintenance position */

vltINT32 userOffsetAvail;/* user offset available flag */

vltDOUBLE userOffset; /* offset to user position */

motUNIT unit; /* position unit */

/* reserved for internal use - Unit is motBOARD_UNIT_POS */

vltINT32 available; /* named position is resolved */

vltINT32 obsPosEnc[3]; /* observation positions [low,nom,up] */

vltINT32 mntPosEnc[3]; /* maintenance positions [low,nom,up] */

vltINT32 usrPosEnc[3]; /* userDefined positions [low,nom,up] */

} motNAMED_POSITION;

/* database map for speed */

typedef struct

{

vltBYTES32 name; /* speed name */

vltDOUBLE speed; /* speed value */

motUNIT unit; /* speed unit */

vltUINT32 pollInt; /* polling interval in ms */

vltUINT32 endPollInt; /* end-phase polling interval in ms */

vltUINT32 inPosTime; /* needed in-position time for */

/* motion complete condition in ms */

/* reserved for internal use - Unit is motBOARD_UNIT_SPD */

vltDOUBLE speedEnc; /* Speed in motBOARD_UNIT_SPD */

} motNAMED_SPEED;

/* database map for two step offset */

typedef struct

{

vltDOUBLE offset; /* offset value in user unit */

motUNIT unit; /* Unit must be motBOARD_UNIT_POS */

motSPEED speed; /* speed to be used for second step */

vltINT32 offsetEnc; /* offset in motBOARD_UNIT_POS */

vltDOUBLE speedEnc; /* Speed in motBOARD_UNIT_SPD */

} motTWO_STEP_OFFSET;

/* database map for index pulse speed */

typedef struct

{

motSPEED speed; /* speed to be used for second step */

vltDOUBLE speedEnc; /* Speed in motBOARD_UNIT_SPD */

} motINDEX_PULSE_SPEED;

/* data structures for motor configuration */

typedef struct

{

motMOTOR_DEF motor;

motBOARD_CONF boards[motMAX_BOARD];

motEVENT_CFG events[motMAX_EVENT];

motSIGNAL_CFG signals[motMAX_SIGNAL];

motAXIS_TYPE axis;

motENCODER encoder;

motSPECIAL_POSITIONS_CFG specialPositions[motMAX_SPECIAL_POSITION];

motNAMED_POSITION_OFFSET offsets;

vltINT32 numNamedPositions;

motNAMED_POSITION *namedPositions;

vltINT32 numNamedSpeeds;

motNAMED_SPEED *namedSpeeds;

motTWO_STEP_OFFSET twoStepOffset;

motINDEX_PULSE_SPEED indexPulseSpeed;

vltINT32 defaultSpeed;

} motCONFIG;

/*

* status data structure

*/

typedef struct

{

motOPMODE opMode; /* operational mode */

motMOTIONMODE motionMode; /* motion mode */

motMOTION_STATUS motionStatus; /* motion status */

vltINT32 motionStep; /* motion step */

motINIT_STATUS initStatus; /* initialization status */

vltINT32 initStep; /* step of initialization sequence */

vltINT32 brakeClamped; /* brake status */

vltINT32 axisEnabled; /* axis enabled flag */

vltUINT32 eventMask; /* bit mask to encode abnormal events */

vltINT32 amplStatus; /* amplifier board status */

motCONNECTION powerStatus; /* pos./neg. relay open closed */

vltINT32 overCurrent; /* Amplifier Current (over=1) */

vltINT32 overTemperature;/* Amplifier Temperature (over=1) */

vltINT32 mconStatus; /* controller board status */

vltINT32 driveFault; /* Drive Fault (Fault=1) */

vltINT32 emergencyStop; /* Emergency Stop (Stopped=1) */

vltINT32 posError; /* Positioning Error (Error=1) */

vltINT32 inPos; /* in position flag */

vltINT32 onLimit; /* Motor On Limit */

motLIMITS amplOnLimit; /* on limit flag for amplifier */

motLIMITS mconOnLimit; /* on limit flag for controller */

vltINT32 mconOnRef; /* on RefSwitch for controller */

vltINT32 mconOnInd; /* on IndexPulse for controller */

vltINT32 interlock; /* interlock line status */

vltDOUBLE speed; /* actual speed in user units */

motUNIT speedUnit; /* motor speed user unit */

vltDOUBLE current; /* actual motor current in user units */

motUNIT currentUnit; /* motor current user unit */

vltINT32 posEnc; /* actual position in encoder ticks */

vltDOUBLE posUser; /* actual position in user units */

motUNIT posUnit; /* position user unit */

vltBYTES32 posName; /* actual position as name */

motSECTION posSection; /* specifies the section of the name */

vltINT32 posIndex; /* position index */

vltINT32 nextPosEnc; /* next position */

vltDOUBLE nextPosUser; /* next position in user units */

vltBYTES32 nextPosName; /* next position as name */

motSECTION nextPosSection; /* specifies the section of the name */

vltINT32 nextPosIndex; /* next position index */

vltDOUBLE followingErr; /* actual following error in user unit */

ccsTIMEVAL startTime; /* start time of last movement in UTC */

ccsTIMEVAL endTime; /* end time of last movement in UTC */

} motSTATUS;

/* type for user function types */

typedef vltINT32 motUSER_FCT;

/* type for user init function */

typedef ccsCOMPL_STAT (* motINIT_FUNC) ( void *, ccsERROR *);

/* type for user unit conversion function */

typedef ccsCOMPL_STAT (* motCONV_FUNC) ( motMETRIC *, motMETRIC *,

void *, ccsERROR *);

/*

******************************************************************************

* API Function Prototypes

******************************************************************************

*/

ccsCOMPL_STAT motInstall ( char *dbPath, ccsERROR *pError );

ccsCOMPL_STAT motDeinstall ( char *dbPath, ccsERROR *pError );

ccsCOMPL_STAT motInitDb ( char *motor, char *file, ccsERROR *pError);

ccsCOMPL_STAT motAttach ( dbSYMADDRESS dbPath, motACCESS_MODE mode,

motHANDLE *handle, ccsERROR *error );

ccsCOMPL_STAT motDetach ( motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motDisable ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motEnable ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motSetOpMode ( const motHANDLE handle[], motOPMODE *mode,

ccsERROR *error );

ccsCOMPL_STAT motGetOpMode ( const motHANDLE handle[], motOPMODE *mode,

ccsERROR *error );

ccsCOMPL_STAT motNameToEnc ( motHANDLE handle, vltBYTES32 name,

motSECTION section, vltINT32 *posEnc,

ccsERROR *error );

ccsCOMPL_STAT motEncToIndex ( motHANDLE handle, vltINT32 posEnc,

motSECTION *section, vltINT32 *index,

ccsERROR *error );

ccsCOMPL_STAT motEncToName ( motHANDLE handle, vltINT32 posEnc,

motSECTION *section, vltBYTES32 name,

ccsERROR *error );

ccsCOMPL_STAT motNameToVel ( motHANDLE handle, vltBYTES32 name,

vltDOUBLE *velEnc, ccsERROR *error );

ccsCOMPL_STAT motPosToEnc ( motHANDLE handle, motMETRIC *position,

vltINT32 *encValue, ccsERROR *error );

ccsCOMPL_STAT motEncToPos ( motHANDLE handle, vltINT32 encValue,

motMETRIC *position, ccsERROR *error );

ccsCOMPL_STAT motVelToEnc ( motHANDLE handle, motMETRIC *velocity,

vltDOUBLE *encValue, ccsERROR *error );

ccsCOMPL_STAT motEncToVel ( motHANDLE handle, vltDOUBLE encValue,

motMETRIC *velocity, ccsERROR *error );

ccsCOMPL_STAT motVelToRef ( motHANDLE handle, motMETRIC *velocity,

vltINT32 *refValue, ccsERROR *error );

ccsCOMPL_STAT motRefToVel ( motHANDLE handle, vltINT32 refValue,

motMETRIC *velocity, ccsERROR *error );

ccsCOMPL_STAT motDigToCurrent ( motHANDLE handle, vltINT32 currDig,

motMETRIC *currUser, ccsERROR *error );

ccsCOMPL_STAT motInitSw ( const motHANDLE handle[],

vltLOGICAL mandatory, ccsERROR *error );

ccsCOMPL_STAT motInitHw ( const motHANDLE handle[],

vltLOGICAL mandatory, ccsERROR *error );

ccsCOMPL_STAT motSetDefaultUnits( const motHANDLE handle[],

motDEFAULT_UNITS units[], ccsERROR *error );

ccsCOMPL_STAT motSetMotionMode ( const motHANDLE handle[],

motMOTIONMODE mode[], ccsERROR *error );

ccsCOMPL_STAT motMove ( const motHANDLE handle[], motMOTION *motion,

ccsERROR *error );

ccsCOMPL_STAT motCheckMove ( const motHANDLE handle[], motMOTION *motion,

ccsERROR *error );

ccsCOMPL_STAT motSetSection ( const motHANDLE handle[], motSECTION *section,

ccsERROR *error );

ccsCOMPL_STAT motGetStatus ( const motHANDLE handle[], motSTATUS *status,

ccsERROR *error );

ccsCOMPL_STAT motGetDbStatus ( const motHANDLE handle[], motSTATUS *status,

ccsERROR *error );

ccsCOMPL_STAT motGetDbConfig ( const motHANDLE handle[], motCONFIG *config,

ccsERROR *error );

ccsCOMPL_STAT motFreeConfig ( motCONFIG *config );

ccsCOMPL_STAT motWaitInit ( const motHANDLE handle[], vltINT32 timeout,

motSTATUS *motStatus, ccsERROR *error );

ccsCOMPL_STAT motWaitMove ( const motHANDLE handle[], vltINT32 timeout,

motSTATUS *motStatus, ccsERROR *error );

ccsCOMPL_STAT motResetSw ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motResetHw ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motStop ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motConnect ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motDisconnect ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motClampBrake ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motUnclampBrake ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motCheckInterlock ( const motHANDLE handle[], vltINT32 *status,

ccsERROR *error );

ccsCOMPL_STAT motCheckBrake ( const motHANDLE handle[], vltINT32 *status,

ccsERROR *error );

ccsCOMPL_STAT motInitSampling ( const motHANDLE handle[], vltINT32 seconds,

motSECTION section, ccsERROR *error );

ccsCOMPL_STAT motStopSampling ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motLoadPar ( motHANDLE handle, motBOARD_TYPE board,

vltUINT32 *number, motPARAMETER *parBuf,

ccsERROR *error );

ccsCOMPL_STAT motRetrievePar ( motHANDLE handle, motBOARD_TYPE board,

vltUINT32 *number, motPARAMETER *parBuf,

ccsERROR *error );

ccsCOMPL_STAT motSetSwLimits ( const motHANDLE handle[],

motPOSITION *positions,

motPOS_TYPE *posTypes,

motLIMITS *limitFlags,

ccsERROR *error );

ccsCOMPL_STAT motSetParListAddress ( motHANDLE handle, motUSER_FCT fctType,

vltINT32 fctOccurence, vltBYTES32 fctName,

vltUINT32 parList, ccsERROR *error );

ccsCOMPL_STAT motGetParListAddress ( motHANDLE handle, motUSER_FCT fctType,

vltINT32 fctOccurence, vltBYTES32 fctName,

vltUINT32 *parList, ccsERROR *error );

ccsCOMPL_STAT motGetHandle ( char *name, motHANDLE *handle,

ccsERROR *error );

ccsCOMPL_STAT motGetSemIEV ( const motHANDLE handle, SEM_ID *semIEV,

ccsERROR *error );

ccsCOMPL_STAT motWriteEncoderValue ( const motHANDLE handle,

vltINT32 encoderValue, ccsERROR *error );

/*

* Tools

*/

void motVersion ( vltBYTES80 version );

ccsCOMPL_STAT motClear ( dbSYMADDRESS dbPath );

ccsCOMPL_STAT motPrintMotors ( void );

ccsCOMPL_STAT motMotors ( int *num, vltBYTES20 list[] );

void motDebug ( vltINT32 level );

/*

* Oldies for compatibility

*/

ccsCOMPL_STAT motResetAxis ( const motHANDLE handle[], ccsERROR *error );

ccsCOMPL_STAT motResetBoards ( const motHANDLE handle[], ccsERROR *error );

#ifdef __cplusplus

}

#endif

#endif /* if !MOT_H */

/*************************************************************************/

/*___oOo___*/

3.4.2 motDefines.h

/*******************************************************************************

* E.S.O. - VLT project

#

# "@(#) $Id: motDefines.h,v 2.7 1998/09/18 14:04:36 vltsccm Exp $"

*

* who when what

* -------- -------- ----------------------------------------------

* P.Duhoux 07/07/95 Created for Release 1.3

* P.Duhoux 25/07/95 Added new literals for optimized unit conversions

* motBOARD_UNIT_... motUNIT_... [POS/SPD/CUR/REF]

* P.Duhoux 04/12/95 Added new literal for motion to HOME position

* P.Duhoux 26/03/96 Added macros for position index with section (SPR960183)

* P.Duhoux 26/03/96 Added macros motHALF_TURN_ABS/REL (SPR960512)

* P.Duhoux 13/12/96 Added macros motACTION_DELAY

*/

#ifndef MOT_DEFINES_H

#define MOT_DEFINES_H

/******************************************************************************

* motDefines.h - MCM definition file

*

* This file contains all definitions needed for MCM as #define macros.

*

*-----------------------------------------------------------------------------

*/

/* formats for dbcfg files */

#define motDBCFG_FMT "%s.dbcfg"

#define motDBCFG_CWP_FMT "%s=@%s<alias>%s"

#define motDBCFG_CWP "<CWP>: "

/* literals for event types */

#define motEVENT_MOTION_END 0

#define motEVENT_DRIVE_FAULT 1

#define motEVENT_EMERGENCY_STOP 2

#define motEVENT_OVER_TEMPERATURE 3

#define motEVENT_OVER_CURRENT 4

#define motEVENT_POSITIONING_ERROR 5

#define motEVENT_ON_LIMIT 6

#define motEVENT_NORMAL_STOP 7

#define motEVENT_INTERLOCK_ACTIVE 8

#define motEVENT_NEW_MOTION 9

#define motEVENT_BOARD_INIT_READY 10

/* Public events (mot<event> = 2 << motEVENT_<event>) */

#define motMOTION_END 1

#define motDRIVE_FAULT 2

#define motEMERGENCY_STOP 4

#define motOVER_TEMPERATURE 8

#define motOVER_CURRENT 16

#define motPOSITIONING_ERROR 32

#define motON_LIMIT 64

#define motNORMAL_STOP 128

#define motINTERLOCK_ACTIVE 256

#define motNEW_MOTION 512

#define motBOARD_INIT_READY 1024

/* logical flags */

#define motNOT_SUPPORTED 0

#define motNOT_APPLICABLE 0

#define motAVAILABLE 1

#define motSET 1

/* empty string */

#define motEMPTY_STRING ""

/* interlock status strings */

#define motUNLOCKED_STRING "Unlocked"

#define motLOCKED_STRING "Locked"

/* brake status strings */

#define motUNCLAMPED_STRING "Unclamped"

#define motCLAMPED_STRING "Clamped"

/* axis status strings */

#define motDISABLED_STRING "Disabled"

#define motENABLED_STRING "Enabled"

/* special values */

#define motINVALID -1

#define motNONE 0

/* 8 bit signed extrema */

#define motMIN8 -128

#define motMAX8 127

/* 16 bit signed extrema */

#define motMIN16 -32768

#define motMAX16 32767

/* literal for maximum number of special positions */

#define motMAX_SPECIAL_POSITION 7

/* literal for maximum number of motors to be controlled */

#define motMAX_MOTOR 32

/* literal for maximum number of control boards */

#define motMAX_BOARD 3

/* literal for maximum number of events */

#define motMAX_EVENT 32

/* literal for maximum number of digital IO signals */

#define motMAX_SIGNAL 3

/* literal for minimum number of conversion methods */

#define motMIN_CONV_METHOD 4

/* literal for maximum number of steps in a motion sequence */

#define motMAX_MOTION_SEQ 10

/* literal for minimum polling rate in milli-seconds */

#define motMIN_POLL_RATE 100

#define motMIN_MOVE_POLL_FAR 100

#define motMIN_MOVE_POLL_NEAR 20

/* literal for maximum number of interpolation points */

#define motMAX_INTERPOL_POINTS 50

/* literal for maximum length of motor name/alias */

#define motMAX_MOTORNAME_LENGTH 12

/* definition of access modes */

#define motUNUSED 0

#define motREAD_ONLY 1

#define motEXCLUSIVE 2

#define motEMERGENCY 3

#define motUNUSED_STRING "Unused"

#define motREAD_ONLY_STRING "Read-Only"

#define motEXCLUSIVE_STRING "Exclusive"

#define motEMERGENCY_STRING "Emergency"

/* operational modes */

#define motDETACHED 1

#define motNOT_AVAILABLE 2

#define motFIXED_POSITION 3

#define motSIMULATION 4

#define motNORMAL 5

#define motHANDSET 6

#define motDETACHED_STRING "Detached"

#define motNOT_AVAILABLE_STRING "NotAvailable"

#define motFIXED_POSITION_STRING "FixedPosition"

#define motSIMULATION_STRING "Simulation"

#define motNORMAL_STRING "Normal"

#define motHANDSET_STRING "Handset"

/* axis types */

#define motAXIS_OFF motNONE

#define motAXIS_LINEAR 1

#define motAXIS_CIRCULAR 2

#define motAXIS_CIRCULAR_OPT 3

#define motAXIS_OFF_STRING "Off"

#define motAXIS_LINEAR_STRING "Linear"

#define motAXIS_CIRCULAR_STRING "Circular"

#define motAXIS_CIRCULAR_OPT_STRING "CircularOptimized"

/* encoder types */

#define motENC_NONE 0

#define motENC_INC 1

#define motENC_ABS 2

#define motENC_ABS_REL 3

#define motENC_NONE_STRING "None"

#define motENC_INC_STRING "Incremental"

#define motENC_ABS_STRING "Absolute"

#define motENC_ABS_REL_STRING "Absolute in relative mode"

/* position/speed definition types */

#define motBY_DEFAULT 1

#define motBY_VALUE 2

#define motBY_NAME 3

#define motBY_INDEX 4

#define motBY_DEFAULT_STRING "ByDefault"

#define motBY_VALUE_STRING "ByValue"

#define motBY_NAME_STRING "ByName"

#define motBY_INDEX_STRING "ByIndex"

#define motNAMED_POSITION_DUMMY "DUMMY"

/* section types */

#define motNO_SECTION motNONE

#define motOBSERVATION 1

#define motMAINTENANCE 2

#define motUSER_DEFINED 3

#define motALL_SECTIONS 4

#define motNO_SECTION_STRING "None"

#define motOBSERVATION_STRING "Observation"

#define motMAINTENANCE_STRING "Maintenance"

#define motUSER_DEFINED_STRING "UserDefined"

#define motALL_SECTIONS_STRING "AllSections"

/* section with index */

#define motSET_OBSERVATION_INDEX(i) \

(vltUINT32)((i & 0x00FFFFFF) | (vltUINT32)motOBSERVATION << 24)

#define motSET_MAINTENANCE_INDEX(i) \

(vltUINT32)((i & 0x00FFFFFF) | (vltUINT32)motMAINTENANCE << 24)

#define motSET_USERDEFINED_INDEX(i) \

(vltUINT32)((i & 0x00FFFFFF) | (vltUINT32)motUSER_DEFINED << 24)

/* position types */

#define motABSOLUTE 1

#define motRELATIVE 2

#define motLOWER_LIMIT 3

#define motUPPER_LIMIT 4

#define motREFERENCE_SWITCH 5

#define motINDEX_PULSE 6

#define motHOME_POSITION 7

#define motBY_SPEED 8

#define motTWO_STEP_ABS 9

#define motTWO_STEP_REL 10

#define motHALF_TURN_ABS 11

#define motHALF_TURN_REL 12

#define motOFF_POSITION 0x100

#define motOFF_REFERENCE_SWITCH (motOFF_POSITION | motREFERENCE_SWITCH)

#define motABSOLUTE_STRING "Absolute"

#define motRELATIVE_STRING "Relative"

#define motLOWER_LIMIT_STRING "LowerLimit"

#define motUPPER_LIMIT_STRING "UpperLimit"

#define motREFERENCE_SWITCH_STRING "ReferenceSwitch"

#define motINDEX_PULSE_STRING "IndexPulse"

#define motHOME_POSITION_STRING "HomePosition"

#define motBY_SPEED_STRING "BySpeed"

#define motTWO_STEP_ABS_STRING "TwoStepAbsolute"

#define motTWO_STEP_REL_STRING "TwoStepRelative"

#define motHALF_TURN_ABS_STRING "HalfTurnAbsolute"

#define motHALF_TURN_REL_STRING "HalfTurnRelative"

/* motion modes */

#define motINVALID_MOTION_MODE 1

#define motDIRECT_MODE 2

#define motPOSITION_MODE 3

#define motTRACKING_MODE 4

#define motSPEED_MODE 5

#define motINVALID_MOTION_MODE_STRING "Invalid"

#define motDIRECT_MODE_STRING "Direct"

#define motPOSITION_MODE_STRING "Position"

#define motTRACKING_MODE_STRING "Tracking"

#define motSPEED_MODE_STRING "Speed"

/* electrical connection types for amplifier boards */

#define motDISCONNECTED 0

#define motPOSITIVE 1

#define motNEGATIVE 2

#define motBOTH 3

#define motDISCONNECTED_STRING "Disconnected"

#define motPOSITIVE_STRING "Positive"

#define motNEGATIVE_STRING "Negative"

#define motBOTH_STRING "Both connected"

/* board types */

#define motNO_BOARD 0

#define motAMPLIFIER 1

#define motCONTROLLER 2

#define motDIGITAL_IO 3

#define motCPU_BOARD 4

#define motEXT_BOARD 5

#define motNO_BOARD_STRING "No Board"

#define motAMPLIFIER_STRING "Amplifier"

#define motCONTROLLER_STRING "Controller"

#define motDIGITAL_IO_STRING "Digital I/O"

#define motCPU_BOARD_STRING "CPU Board"

#define motEXT_BOARD_STRING "External Board"

/* limits types */

#define motNOT_ON_LIMIT 0

#define motSW_LOWER 1

#define motSW_UPPER 2

#define motSW_BOTH 3

#define motHW_LOWER 4

#define motHW_UPPER 5

#define motHW_BOTH 6

#define motNOT_ON_LIMIT_STRING "Not on Limit"

#define motSW_LOWER_STRING "Lower SW Limit"

#define motSW_UPPER_STRING "Upper SW Limit"

#define motSW_BOTH_STRING "Both SW Limit"

#define motHW_LOWER_STRING "Lower HW Limit"

#define motHW_UPPER_STRING "Upper HW Limit"

#define motHW_BOTH_STRING "Both HW Limit"

/* motion status */

#define motSTANDING 1

#define motMOVING 2

#define motTIMEOUT 3

#define motABORTED 4

#define motREDEFINED 5

#define motSTANDING_STRING "Standing"

#define motMOVING_STRING "Moving"

#define motTIMEOUT_STRING "Timeout"

#define motABORTED_STRING "Aborted"

#define motREDEFINED_STRING "Redefined"

/* initialization status */

#define motNOT_INIT 1

#define motSW_INIT 2

#define motHW_INIT_RUN 3

#define motINIT_DONE 4

#define motNOT_INIT_STRING "Not Initialized"

#define motSW_INIT_STRING "S/W Initialized"

#define motHW_INIT_RUN_STRING "H/W Initialization Running"

#define motINIT_DONE_STRING "Initialization Done"

/* conversion methods types */

#define motEXTERN 1

#define motLINEAR 2

#define motINTERPOLATION 3

/* types for user function */

#define motUSER_INIT 0

#define motUSER_CONV 1

/* unit types */

#define motUNIT_POS 0

#define motUNIT_SPD 1

#define motUNIT_CUR 2

#define motUNIT_REF 3

/* board units */

#define motBOARD_UNIT_POS "Enc"

#define motBOARD_UNIT_SPD "Enc/ms"

#define motBOARD_UNIT_CUR "Dig"

#define motBOARD_UNIT_REF "Ref"

/* motor types */

#define motDC_MOTOR 1

#define motSTEPPER_MOTOR 2

/* HW initialization actions */

#define motNO_ACTION motNONE

#define motACTION_END 1

#define motACTION_MOVE 2

#define motACTION_SET_LOW_SW_LIMIT 3

#define motACTION_SET_UP_SW_LIMIT 4

#define motACTION_SET_ENC_VALUE 5

#define motACTION_CLAMP_BRAKE 6

#define motACTION_DISCONNECT 7

#define motACTION_USERFUNCTION 8

#define motACTION_BOARD_PROCEDURE 9

#define motACTION_DELAY 10

/* encoder coding types */

#define motCODE_BINARY 1

#define motCODE_BCD 2

#define motCODE_GRAY 3

/* events handling types */

#define motNO_EVENT motNONE

#define motEVENT_INTERRUPT 1

#define motEVENT_SIGNAL 2

#define motEVENT_SOFTWARE 3

/* digital IO signal types */

#define motNO_SIGNAL -1

#define motSIGNAL_BRAKE_ACTION 0

#define motSIGNAL_BRAKE_STATUS 1

#define motSIGNAL_INTERLOCK 2

#define motSIGNAL_BRAKE_ACTION_NAME "brakeAction"

#define motSIGNAL_BRAKE_STATUS_NAME "brakeStatus"

#define motSIGNAL_INTERLOCK_NAME "interlock"

#define motSIGNAL_ATTRIBUTE_NAME "value"

#define motSIGNAL_OFF 0

#define motSIGNAL_ACTIVE_LOW 1

#define motSIGNAL_ACTIVE_HIGH 2

/*

* index of motor status database attributes for cai Access

*/

#define motDB_STATUS_OP_MODE 0

#define motDB_STATUS_MOTION_MODE 1

#define motDB_STATUS_MOTION_STATUS 2

#define motDB_STATUS_MOTION_STEP 3

#define motDB_STATUS_INIT_STATUS 4

#define motDB_STATUS_INIT_STEP 5

#define motDB_STATUS_BRAKE_CLAMPED 6

#define motDB_STATUS_AXIS_ENABLED 7

#define motDB_STATUS_EVENT_MASK 8

#define motDB_STATUS_AMPL_STATUS 9

#define motDB_STATUS_POWER_STATUS 10

#define motDB_STATUS_OVER_CURRENT 11

#define motDB_STATUS_OVER_TEMPERATURE 12

#define motDB_STATUS_MCON_STATUS 13

#define motDB_STATUS_DRIVE_FAULT 14

#define motDB_STATUS_EMERGENCY_STOP 15

#define motDB_STATUS_POS_ERROR 16

#define motDB_STATUS_IN_POS 17

#define motDB_STATUS_ON_LIMIT 18

#define motDB_STATUS_AMPL_ON_LIMIT 19

#define motDB_STATUS_MCON_ON_LIMIT 20

#define motDB_STATUS_INTERLOCK 21

#define motDB_STATUS_SPEED 22

#define motDB_STATUS_SPEED_UNIT 23

#define motDB_STATUS_CURRENT 24

#define motDB_STATUS_CURRENT_UNIT 25

#define motDB_STATUS_POS_ENC 26

#define motDB_STATUS_POS_USER 27

#define motDB_STATUS_POS_UNIT 28

#define motDB_STATUS_POS_NAME 29

#define motDB_STATUS_POS_SECTION 30

#define motDB_STATUS_POS_INDEX 31

#define motDB_STATUS_NEXT_POS_ENC 32

#define motDB_STATUS_NEXT_POS_USER 33

#define motDB_STATUS_NEXT_POS_NAME 34

#define motDB_STATUS_NEXT_POS_SECTION 35

#define motDB_STATUS_NEXT_POS_INDEX 36

#define motDB_STATUS_FOLLOWING_ERR 37

#define motDB_STATUS_TIME_BEG 38

#define motDB_STATUS_TIME_END 39

/*

* index of motor configuration database attributes for cai Access

*/

#define motDB_CONF_MOTOR 0

#define motDB_CONF_BOARDS 1

#define motDB_CONF_EVENTS 2

#define motDB_CONF_SIGNALS 3

#define motDB_CONF_AXIS 4

#define motDB_CONF_ENCODER 5

#define motDB_CONF_OFFSETS 6

#define motDB_CONF_SPECIAL_POS 7

#define motDB_CONF_NAMED_POSITIONS 8

#define motDB_CONF_NAMED_SPEEDS 9

#define motDB_CONF_TWO_STEP_OFFSET 10

#define motDB_CONF_INDEX_PULSE_SPEED 11

#define motDB_CONF_DEFAULT_SPEED 12

#define motDB_INIT_ACTIONS 13

#define motDB_UNIT_DEFAULT 14

#define motDB_UNIT_METHODS 15

/*************************************************************************/

/* THE FOLLOWING MACROS REMAIN AVAILABLE BUT ARE NOT USED ANYMORE */

/* SINCE THE DIMENSION OF THE TABLES IS FREE */

/*************************************************************************/

/* literal for maximum number of named positions */

#define motMAX_NAMED_POSITION 15

/* literal for maximum number of named speeds */

#define motMAX_NAMED_SPEED 15

/* literal for maximum number of HW init actions */

#define motMAX_INIT_ACTION 12

/* literal for maximum number of conversion methods */

#define motMAX_CONV_METHOD 15

#endif /* if !MOT_DEFINES_H */

/*************************************************************************/

/*___oOo___*/

3.4.3 motPublic.h

/******************************************************************************

* E.S.O. - VLT project

*

* "@(#) $Id: motPublic.h,v 2.7 1998/09/18 14:03:29 vltsccm Exp $"

*

* who when what

* -------- -------- ----------------------------------------------

* CAM GmbH --/05/94 Created for Release 1.1

* P.Duhoux --/07/94 Modified for Release 1.2

* P.Duhoux 25/01/95 Compliance with OO approach

* P.Duhoux 31/01/95 Added eventIsr in descriptor (Only set by ISR)

* P.Duhoux 15/05/95 Removed field `motAlias' from the descriptor

* - Field `motName' is now the ALIAS

* P.Duhoux 09/06/95 Modified for CMM Archive

* P.Duhoux 04/07/95 Added literal motMIN_POLL_RATE for status sampling task

* P.Duhoux 07/07/95 Removed all literal definitions (now in motDefines.h

* included by mot.h)

* P.Duhoux 25/07/95 Modified motDESCRIPTION for optimized unit conversions

* P.Duhoux 28/08/95 Renamed from motInternal.h

* P.Duhoux 05/12/95 Added flag convConfigDone to indicate the DB config

* attributes have been converted to board units

* P.Duhoux 19/01/96 Added defaultUnits and posEnc in descriptor

* P.Duhoux 29/03/96 Added mconSemIEV in motDESCRIPTION

* P.Duhoux 12/11/96 Move definitions to mot.h for motCONFIG data structure

* P.Duhoux 11/12/96 Increased motSEM_TIMEOUT from 5 to 10 seconds (SPR960747)

* P.Duhoux 05/08/97 Removed task option VX_NO_STACK_FILL

*/

#ifndef MOT_PUBLIC_H

#define MOT_PUBLIC_H

/******************************************************************************

* motPublic.h - motor library public interface file

*

* This header file contains data type definitions and global variables for the

* interface between the mot server and the mot single device libraries. Hence,

* all these sub-modules need to include this file.

*

*------------------------------------------------------------------------------

*/

#ifdef __cplusplus

extern "C" {

#endif

/*

* VxWorks include files

*/

#include "vxWorks.h"

#include "semLib.h"

#include "string.h"

#include "ctype.h"

#include "stdio.h"

#include "stdlib.h"

#include "ioLib.h"

#include "symLib.h"

#include "sysSymTbl.h"

#include "sysLib.h"

#include "taskLib.h"

#include "tickLib.h"

#include "usrLib.h"

#include "errnoLib.h"

#include "vxLib.h"

#include "math.h"

/*

* MCM include files

*/

#include "mot.h"

#define IN

#define OUT

#define INOUT

/******************************************************************************

* server internal macros

*****************************************************************************/

/* macros for task priorities */

#define motBASE_TASK_PRIOR (desc->priority) /* API level */

#define motINIT_TASK_PRIOR (motBASE_TASK_PRIOR + 1) /* H/W Init Task */

#define motMOVE_TASK_PRIOR (motBASE_TASK_PRIOR + 2) /* Motion Task */

#define motPOLL_TASK_PRIOR 200 /* Sampling Task */

/* macros for task flags */

#define motTASK_FLAGS (VX_FP_TASK)

#define motINIT_TASK_FLAGS motTASK_FLAGS /* H/W Init Task */

#define motMOVE_TASK_FLAGS motTASK_FLAGS /* Motion Task */

#define motPOLL_TASK_FLAGS motTASK_FLAGS /* Sampling Task */

/* macros for task stacks */

#define motINIT_TASK_STACK 50000 /* H/W Init Task */

#define motMOVE_TASK_STACK 30000 /* Motion Task */

#define motPOLL_TASK_STACK 30000 /* Sampling Task */

/* macros for task names */

#define motINIT_TASK_NAME "tInit_%s" /* H/W Init Task */

#define motMOVE_TASK_NAME "tMove_%s" /* Motion Task */

#define motPOLL_TASK_NAME "tPoll_%s" /* Sampling Task */

/* timeout for <motor descriptor>.accessSem - in seconds */

#define motSEM_TIMEOUT 10

#define motFIS_TIMEOUT 5

#define motsrvSemTimeout ((int)(motTimeout * motTicksPerSecond))

/* database points */

#define MOTOR_STATUS "STATUS"

#define MOTOR_SERVER "SERVER"

/******************************************************************************

* Internal Data Types

*****************************************************************************/

/*

* index of motor status database attributes for cai Access

*/

typedef enum

{

motsrvDB_STAT_OP_MODE = motDB_STATUS_OP_MODE,

motsrvDB_STAT_MOTION_MODE,

motsrvDB_STAT_MOTION_STATUS,

motsrvDB_STAT_MOTION_STEP,

motsrvDB_STAT_INIT_STATUS,

motsrvDB_STAT_INIT_STEP,

motsrvDB_STAT_BRAKE_CLAMPED,

motsrvDB_STAT_AXIS_ENABLED,

motsrvDB_STAT_EVENT_MASK,

motsrvDB_STAT_AMPL_STATUS,

motsrvDB_STAT_POWER_STATUS,

motsrvDB_STAT_OVER_CURRENT,

motsrvDB_STAT_OVER_TEMPERATURE,

motsrvDB_STAT_MCON_STATUS,

motsrvDB_STAT_DRIVE_FAULT,

motsrvDB_STAT_EMERGENCY_STOP,

motsrvDB_STAT_POS_ERROR,

motsrvDB_STAT_IN_POS,

motsrvDB_STAT_ON_LIMIT,

motsrvDB_STAT_AMPL_ON_LIMIT,

motsrvDB_STAT_MCON_ON_LIMIT,

motsrvDB_STAT_MCON_ON_REF,

motsrvDB_STAT_MCON_ON_IND,

motsrvDB_STAT_INTERLOCK,

motsrvDB_STAT_SPEED,

motsrvDB_STAT_SPEED_UNIT,

motsrvDB_STAT_CURRENT,

motsrvDB_STAT_CURRENT_UNIT,

motsrvDB_STAT_POS_ENC,

motsrvDB_STAT_POS_USER,

motsrvDB_STAT_POS_UNIT,

motsrvDB_STAT_POS_NAME,

motsrvDB_STAT_POS_SECTION,

motsrvDB_STAT_POS_INDEX,

motsrvDB_STAT_NEXT_POS_ENC,

motsrvDB_STAT_NEXT_POS_USER,

motsrvDB_STAT_NEXT_POS_NAME,

motsrvDB_STAT_NEXT_POS_SECTION,

motsrvDB_STAT_NEXT_POS_INDEX,

motsrvDB_STAT_FOLLOWING_ERR,

motsrvDB_STAT_TIME_BEG,

motsrvDB_STAT_TIME_END,

motsrvDB_MAX_STAT

} motsrvDB_STAT;

/* data type for conversion methods */

typedef vltINT32 motCONV_TYPE;

/* data type for HW initialization actions */

typedef vltINT32 motACTION_TYPE;

/* interpolation table fix point */

typedef struct

{

vltDOUBLE x;

vltDOUBLE y;

} motPOINT;

typedef struct /* conversion record */

{

vltBYTES20 name;

motCONV_TYPE method;

vltBYTES32 userFctName;

vltUINT32 userParList;

vltDOUBLE offset;

vltDOUBLE slope;

vltUINT32 numPoints;

motPOINT point[motMAX_INTERPOL_POINTS];

vltUINT32 userFctAddr;

} motUNIT_CONV;

typedef struct

{

motACTION_TYPE actionType; /* action type (see above) */

vltBYTES32 userFctName; /* if action USER_FUNCTION: function name */

vltUINT32 userParList; /* pointer to parameter list */

vltINT32 initCode; /* if action BOARD_PROCEDURE: init code */

motMOTIONMODE motionMode; /* motion mode */

motPOSITION position; /* definition of the position */

motPOS_TYPE posType; /* position type: ABSOLUTE, RELATIVE, ... */

motSPEED speed; /* definition of the speed */

} motACTION;

/* database map for special position values (-> SERVER:INTERN) */

typedef struct

{

vltINT32 available;

vltINT32 encValue; /* Position in motBOARD_UNIT_POS */

} motSPECIAL_POSITIONS_INT;

/* data structures for motor descriptor */

typedef struct motDESCRIPTION *motDESCRIPTION_PTR;

typedef struct motDESCRIPTION

{

/* access section */

vltBYTES20 motName; /* alias to motor point */

int priority; /* API task priority */

motACCESS_MODE accessMode; /* highest access mode */

SEM_ID accessSem; /* semaphore for descriptor access */

vltUINT8 numHandles; /* number of open handles */

motOPMODE opMode; /* operational mode */

char *motDbStatus; /* server database address table STATUS */

char *motDbServer; /* server database address table SERVER */

struct motDESCRIPTION *next; /* ptr to next motor descriptor */

/* board section */

vltLOGICAL mconAvail; /* flag for "controller available" */

vltBYTES8 mconPrefix; /* prefix of controller SDL */

char *mconFunc; /* controller SDL routine table */

char *mconDesc; /* controller descriptor */

SEM_ID mconSemIEV; /* semaphore for IEV (external encoder) */

vltLOGICAL amplAvail; /* flag for "amplifier available" */

vltBYTES8 amplPrefix; /* prefix of amplifier SDL */

char *amplFunc; /* amplifier SDL routine table */

char *amplDesc; /* amplifier descriptor */

/* axis & encoder section */

motMOTOR_TYPE motorType; /* type of the motor DC/STP */

motAXIS_TYPE axisType; /* type of the axis LIN/CIR/OPT */

motENC_TYPE encoderType; /* type of the encoder NO/INC/ABS */

int circularRange;/* range for Circular Axis */

vltINT32 chkHwLimit; /* Check flag for HW limits */

vltLOGICAL logChkHwLimit;/* Log Check flag for HW limits */

/* sample section */

int sampleTid; /* task id of sampling task */

motSECTION sampleSection;/* section for sampling / get status */

int pollRate; /* polling rate in ticks */

SEM_ID pollSem; /* poll task start semaphore */

SEM_ID pollAck; /* poll task done semaphore */

/* hwinit/motion section */

int motionTid; /* task id of motion task */

ccsERROR *motionErr; /* Error stack */

int hwinitTid; /* task id of HwInit task */

ccsERROR *hwinitErr; /* Error stack */

motINIT_STATUS initStatus; /* initialization status */

vltINT32 initStep; /* initialization procedure step */

motMOTION *motionSeq; /* pointer to motion sequence to run */

motMOTIONMODE motionMode; /* motion mode */

motMOTION_STATUS motionStatus; /* motion status */

vltINT32 motionStep; /* number of current motion step */

SEM_ID moveSem; /* motion task end semaphore */

SEM_ID initSem; /* semaphore to release motWaitInit */

SEM_ID waitSem; /* semaphore to release motWaitMove */

vltINT32 posEnc; /* current position */

vltINT32 nextPosEnc; /* next position */

ccsTIMEVAL startTime; /* start time of last motion in ticks */

ccsTIMEVAL endTime; /* end time of last motoin in ticks */

/* digital IO signals access section */

ioDIRADDRESS ioSignals[motMAX_SIGNAL];

/* default unit conversion section */

vltUINT8 convConfigDone; /* flag to indicate conv config done */

vltUINT16 numConvMethods; /* Number of conversion methods */

motUNIT_CONV *convMethods[motMIN_CONV_METHOD]; /* default methods */

motDEFAULT_UNITS defUnits; /* default units */

/* event handling section */

/* KEEP STRICTLY AT END OF STRUCTURE */

SEM_ID eventSem; /* semaphore for abnormal events */

vltUINT32 eventMsk;

vltUINT8 eventFlg[32];

vltUINT32 eventTab[32];

} motDESCRIPTION;

/* data type for functions */

typedef ccsCOMPL_STAT (* motFUNCTION) ( void * );

/* data type for error messages */

typedef vltBYTES256 motERRMSG;

/* data structure for handle description */

typedef struct motHANDLEDATA

{

vltUINT32 idFlag; /* own address for identification */

motDESCRIPTION *motDesc; /* pointer to motor descriptor */

motACCESS_MODE accessMode; /* access mode */

struct motHANDLEDATA *next; /* pointer to next handle */

} motsrvHANDLEDATA;

/*

******************************************************************************

* Server internal global Variables

******************************************************************************

*/

extern SEM_ID motsrvSemAccess; /* access protection semaphore */

extern motsrvHANDLEDATA *motsrvFirstHandle; /* ptr to first motor handle */

extern motDESCRIPTION *motsrvFirstDesc; /* ptr to first motor descriptor */

extern int motTimeout; /* semaphore timeout value */

extern int motFisTimeout; /* FIS timeout value */

extern int motTicksPerSecond; /* CPU ticks per second */

/*

******************************************************************************

* Debug handling

******************************************************************************

*/

extern vltINT32 motDebugLevel;

#define motDEBUG_NONE 0x00000000

#define motDEBUG_API 0xF0000000

#define motDEBUG_API_SERVER 0x10000000

#define motDEBUG_API_MOTOR 0x20000000

#define motDEBUG_ACI 0x0F000000

#define motDEBUG_MESSAGE 0x000000F0

#define motDEBUG_MSG_COMMAND 0x00000010

#define motDEBUG_MSG_REPLY 0x00000020

#define motDEBUG_MSG_ERROR 0x00000040

#define motDEBUG_POLLING 0x00000100

#define motDEBUG_MONITOR 0x00000200

#define motDEBUG_CHKSTACK 0x00000400

#define motDEBUG_SDL 0x00F00000

#define motDEBUG_CONTROLLER 0x00100000

#define motDEBUG_AMPLIFIER 0x00200000

#define motDEBUG_DIGITALIO 0x00010000

#define motDEBUG_DRIVER 0x0000000F

#define motDEBUG_WRITE 0x00000001

#define motDEBUG_READ 0x00000002

#define motDEBUG_COMMAND 0x00000004

#define motDEBUG_INTERRUPT 0x00000008

#define MCM_LOG(fct,txt) \

{ ccsTIMEVAL utc; timsMODE tm; ccsERROR err; vltBYTES32 str; \

errResetStack(&err); timsGetUTC(&utc,&tm,&err); \

timsTimeToIsoString(&utc,timsTIME_OF_DAY,6,str,&err); str[15]=0; \

printf("%s [%s] : %s\n",fct,str,txt); }

#define MCM_LOG1(fct,fmt,p1) \

{ ccsTIMEVAL utc; timsMODE tm; ccsERROR err; vltBYTES256 msg,str; \

errResetStack(&err); timsGetUTC(&utc,&tm,&err); \

timsTimeToIsoString(&utc,timsTIME_OF_DAY,6,str,&err); str[15]=0; \

sprintf(msg,"%s [%s] : ",fct,str); sprintf(str,fmt,p1); \

printf("%s%s\n",msg,str); }

#define MCM_LOG2(fct,fmt,p1,p2) \

{ ccsTIMEVAL utc; timsMODE tm; ccsERROR err; vltBYTES256 msg,str; \

errResetStack(&err); timsGetUTC(&utc,&tm,&err); \

timsTimeToIsoString(&utc,timsTIME_OF_DAY,6,str,&err); str[15]=0; \

sprintf(msg,"%s [%s] : ",fct,str); sprintf(str,fmt,p1,p2); \

printf("%s%s\n",msg,str); }

#define MCM_LOG3(fct,fmt,p1,p2,p3) \

{ ccsTIMEVAL utc; timsMODE tm; ccsERROR err; vltBYTES256 msg,str; \

errResetStack(&err); timsGetUTC(&utc,&tm,&err); \

timsTimeToIsoString(&utc,timsTIME_OF_DAY,6,str,&err); str[15]=0; \

sprintf(msg,"%s [%s] : ",fct,str); sprintf(str,fmt,p1,p2,p3); \

printf("%s%s\n",msg,str); }

#ifdef __cplusplus

}

#endif

#endif /* if !MOT_PUBLIC_H */

/*****************************************************************************/

/*___oOo___*/

3.4.4 motciDefines.h

/*******************************************************************************

* E.S.O. - VLT project

*

* "@(#) $Id: motciDefines.h,v 1.21 1997/08/08 11:40:13 vltsccm Exp $

*

* who when what

* -------- -------- ----------------------------------------------

* P.Duhoux 28/08/95 Created for Release 1.5

*/

#ifndef MOTCI_DEFINES_H

#define MOTCI_DEFINES_H

/*

* MACROS for Status Names [Indexes & associated Strings]

*/

#define motciSTAT_OPMODE 0

#define motciSTAT_MOTIONMODE 1

#define motciSTAT_MOTIONSTATUS 2

#define motciSTAT_MOTIONSTEP 3

#define motciSTAT_INITSTATUS 4

#define motciSTAT_INITSTEP 5

#define motciSTAT_BRAKE 6

#define motciSTAT_AXIS 7

#define motciSTAT_EVENTMASK 8

#define motciSTAT_AMPLIFIER 9

#define motciSTAT_POWER 10

#define motciSTAT_CONTROLLER 11

#define motciSTAT_INPOSITION 12

#define motciSTAT_INTERLOCK 13

#define motciSTAT_SPEED 14

#define motciSTAT_CURRENT 15

#define motciSTAT_POSENC 16

#define motciSTAT_POSUSER 17

#define motciSTAT_POSNAME 18

#define motciSTAT_NEXTPOSENC 19

#define motciSTAT_NEXTPOSUSER 20

#define motciSTAT_NEXTPOSNAME 21

#define motciSTAT_FOLLOWINGERR 22

#define motciSTAT_STARTTIME 23

#define motciSTAT_ENDTIME 24

#define motciSTAT_UTC 25

#define motciSTAT_OPMODE_STRING "OperationalMode"

#define motciSTAT_MOTIONMODE_STRING "MotionMode"

#define motciSTAT_MOTIONSTATUS_STRING "MotionStatus"

#define motciSTAT_MOTIONSTEP_STRING "MotionStep"

#define motciSTAT_INITSTATUS_STRING "InitStatus"

#define motciSTAT_INITSTEP_STRING "InitStep"

#define motciSTAT_BRAKE_STRING "Brake"

#define motciSTAT_AXIS_STRING "Axis"

#define motciSTAT_EVENTMASK_STRING "EventMask"

#define motciSTAT_AMPLIFIER_STRING "AmplifierStatus"

#define motciSTAT_POWER_STRING "PowerStatus"

#define motciSTAT_CONTROLLER_STRING "ControllerStatus"

#define motciSTAT_INPOSITION_STRING "InPosition"

#define motciSTAT_INTERLOCK_STRING "Interlock"

#define motciSTAT_SPEED_STRING "Speed"

#define motciSTAT_CURRENT_STRING "Current"

#define motciSTAT_POSENC_STRING "PositionEnc"

#define motciSTAT_POSUSER_STRING "PositionUser"

#define motciSTAT_POSNAME_STRING "PositionName"

#define motciSTAT_NEXTPOSENC_STRING "NextPositionEnc"

#define motciSTAT_NEXTPOSUSER_STRING "NextPositionUser"

#define motciSTAT_NEXTPOSNAME_STRING "NextPositionName"

#define motciSTAT_FOLLOWINGERR_STRING "FollowingError"

#define motciSTAT_STARTTIME_STRING "StartTime"

#define motciSTAT_ENDTIME_STRING "EndTime"

#define motciSTAT_UTC_STRING "UTC"

#endif



Quadralay Corporation
http://www.webworks.com
Voice: (512) 719-3399
Fax: (512) 719-3606
sales@webworks.com
TOC PREV NEXT INDEX