Copyright: Help Contents Copyright (c) 1995-2007 by PMC Corp.


Motion Control API Version 3.3
Motion Control API

Version 4.1

Welcome to the online edition of the Motion Control API (MCAPI) users manual. This help file contains detailed information about API functions, constants, and data structures. Additional technical information, as well as help for the sample programs included with the MCAPI may be found in the printed MCAPI manual that accompanies this package.

For a general overview of the MCAPI programming information see the MCAPI User's Guide., or for help with the Motion Dialog functions see the  Motion Dialog Reference

 API Function Listing

 API Functions Grouped by Type

 Constants

 Data Structures

 Programming Examples Grouped by Type

 Error Messages

 Contacting Technical Support


API Function Listing

MCAbort MCArcCenter MCArcEndAngle MCArcRadius MCBlockBegin MCBlockEnd MCCancelTask MCCaptureData MCClose MCConfigureCompare MCConfigureDigitalIO MCContourDistance MCContourPath MCDecodeStatus MCDecodeStatusEx MCDirection MCEdgeArm MCEnableAxis MCEnableBacklash MCEnableCapture MCEnableCompare MCEnableDigitalFilter MCEnableDigitalIO MCEnableEncoderFault MCEnableGearing MCEnableInterrupt MCEnableJog MCEnableSync MCErrorNotify MCFindAuxEncIdx MCFindEdge MCFindIndex MCGetAccelerationEx MCGetAnalog MCGetAnalogEx MCGetAuxEncIdxEx MCGetAuxEncPosEx MCGetAxisConfiguration MCGetBreakpointEx MCGetCaptureData MCGetConfiguration MCGetConfigurationEx MCGetContourConfig MCGetContouringCount MCGetCount MCGetDecelerationEx MCGetDigitalFilter MCGetDigitalIO MCGetDigitalIOEx MCGetDigitalIOConfig MCGetError	MCGetFilterConfig MCGetFilterConfigEx MCGetFollowingError MCGetGain MCGetIndexEx MCGetInstalledModules MCGetJogConfig MCGetJogConfigEx MCGetLimits MCGetModuleInputMode MCGetModuleOutputMode MCGetMotionConfig MCGetMotionConfigEx MCGetOperatingMode MCGetOptimalEx MCGetPositionEx MCGetProfile MCGetRegister MCGetScale MCGetServoOutputPhase MCGetStatus MCGetStatusEx MCGetTargetEx MCGetTorque MCGetTrajectoryRate MCGetVectorVelocity MCGetVelocityActual MCGetVelocityEx MCGetVelocityOverride MCGetVersion MCGoEx MCGoHome MCIndexArm MCInterruptOnPosition MCIsAtTarget MCIsDigitalFilter MCIsEdgeFound MCIsIndexFound MCIsStopped MCLearnPoint MCMacroCall MCMoveAbsolute MCMoveRelative MCMoveToPoint MCOpen MCReopen MCRepeat MCReset MCSetAcceleration MCSetAnalog	MCSetAnalogEx MCSetAuxEncPos MCSetCommutation MCSetContourConfig MCSetDeceleration MCSetDigitalFilter MCSetFilterConfig MCSetFilterConfigEx MCSetGain MCSetJogConfig MCSetJogConfigEx MCSetLimits MCSetModuleOutputMode MCSetModuleInputMode MCSetMotionConfig MCSetMotionConfigEx MCSetOperatingMode MCSetPosition MCSetProfile MCSetRegister MCSetScale MCSetServoOutputPhase MCSetTimeoutEx MCSetTorque MCSetTrajectoryRate MCSetVectorVelocity MCSetVelocity  MCSetVelocityOverride MCStop MCTranslateErrorEx MCWait MCWaitForDigitalIO MCWaitForEdge MCWaitForIndex MCWaitForPosition MCWaitForRelative MCWaitForStop MCWaitForTarget pmccmd pmccmdex pmcgetc pmcgetram pmcgetramex pmcgets pmcputc pmcputram pmcputramex pmcputs pmcrdy pmcrpy pmcrpyex


Data Structures

MCAPI uses a number of data structures to maintain configuration information for the controllers and axes it manages. As a user of this API you will need access these structures to configure axes for motion, configure the PID control loop, set up the axes for jog operation, configure contouring and to set up scale factors. In addition, the MCPARAMEX structure provides useful information about the configuration of each installed controller. Each data structure has a corresponding MCGet…( ) function that fills in the data structure with the settings of a controller or axis, and most have a MCSet…( ) function to allow you to change the settings for a controller or axis.

MCAXISCONFIG MCCOMMUTATION MCCONTOUR MCFILTER MCFILTEREX MCJOG MCJOGEX	MCMOTION MCMOTIONEX MCPARAM MCPARAMEX MCSCALE MCSTATUSEX


Status Word Constants Lookup Table

This table lists the MC_STAT_xxxx constants in order of the individual status bits they represent in each controllers status word. For example, to use MCDecodeStatusEx( ) to test for trajectory complete on a DCX-AT200 (bit 3 of the DCX-AT200 status word according to the DCX-AT200 User's Manual) move down the leftmost column until you come to the number 3. Then move across the row until you reach the DCX-AT200 column. According to the table, you must use the constant MC_STAT_TRAJ to test for this condition with MCDecodeStatusEx( ).

Bit	DC2-PC DC2-STN	DCX-PC100 DCX-AT100	DCX-AT200 DCX-AT300	DCX-PCI100 DCX-PCI300	MFX-PCI1000
0 1 2 3 4 5 6 7	MC_STAT_MTR_ENABLE MC_STAT_ERROR MC_STAT_CAPTURE MC_STAT_BREAKPOINT MC_STAT_TRAJ MC_STAT_STOPPING - NONE - MC_STAT_DIR	MC_STAT_BUSY MC_STAT_MTR_ENABLE MC_STAT_MODE_VEL MC_STAT_TRAJ MC_STAT_DIR MC_STAT_PHASE MC_STAT_HOMED MC_STAT_ERROR	MC_STAT_BUSY MC_STAT_MTR_ENABLE MC_STAT_AT_TARGET MC_STAT_TRAJ MC_STAT_DIR MC_STAT_JOG_ENAB MC_STAT_HOMED MC_STAT_ERROR	MC_STAT_BUSY MC_STAT_MTR_ENABLE MC_STAT_AT_TARGET MC_STAT_TRAJ MC_STAT_DIR - NONE - MC_STAT_HOMED MC_STAT_ERROR	MC_STAT_ERROR MC_STAT_MTR_ENABLE MC_STAT_AT_TARGET MC_STAT_TRAJ MC_STAT_DIR MC_STAT_POS_CAPT MC_STAT_BREAKPOINT - NONE -
8 9 10 11 12 13 14 15	MC_STAT_AT_TARGET MC_STAT_PHASE MC_STAT_LOOK_INDEX MC_STAT_LOOK_EDGE MC_STAT_HOMED MC_STAT_INP_HOME MC_STAT_RECORD MC_STAT_SYNC	MC_STAT_LOOK_INDEX MC_STAT_LOOK_EDGE MC_STAT_FULL_STEP MC_STAT_HALF_STEP MC_STAT_BREAKPOINT MC_STAT_JOGGING MC_STAT_AMP_ENABLE MC_STAT_AMP_FAULT	MC_STAT_LOOK_INDEX MC_STAT_LOOK_EDGE - NONE - - NONE - MC_STAT_BREAKPOINT MC_STAT_FOLLOWING MC_STAT_AMP_ENABLE MC_STAT_AMP_FAULT	MC_STAT_LOOK_INDEX MC_STAT_LOOK_EDGE MC_STAT_INDEX_FOUND MC_STAT_POS_CAPT MC_STAT_BREAKPOINT MC_STAT_FOLLOWING MC_STAT_AMP_ENABLE MC_STAT_AMP_FAULT	MC_STAT_FOLLOWING MC_STAT_AMP_FAULT MC_STAT_PLIM_TRIP MC_STAT_MLIM_TRIP MC_STAT_PSOFT_TRIP MC_STAT_MSOFT_TRIP MC_STAT_PRI_ENC_FAULT MC_STAT_AUX_ENC_FAULT
16 17 18 19 20 21 22 23	MC_STAT_ACCEL MC_STAT_MODE_POS MC_STAT_MODE_VEL MC_STAT_MODE_TRQE MC_STAT_MODE_ARC MC_STAT_MODE_CNTR MC_STAT_MODE_SLAVE MC_STAT_MODE_LIN	MC_STAT_PLIM_ENAB MC_STAT_PLIM_TRIP MC_STAT_MLIM_ENAB MC_STAT_MLIM_TRIP MC_STAT_PJOG_ENAB MC_STAT_PJOG_ON MC_STAT_MJOG_ENAB MC_STAT_MJOG_ON	MC_STAT_PLIM_ENAB MC_STAT_PLIM_TRIP MC_STAT_MLIM_ENAB MC_STAT_MLIM_TRIP MC_STAT_PSOFT_ENAB MC_STAT_PSOFT_TRIP MC_STAT_MSOFT_ENAB MC_STAT_MSOFT_TRIP	MC_STAT_PLIM_ENAB MC_STAT_PLIM_TRIP MC_STAT_MLIM_ENAB MC_STAT_MLIM_TRIP MC_STAT_PSOFT_ENAB MC_STAT_PSOFT_TRIP MC_STAT_MSOFT_ENAB MC_STAT_MSOFT_TRIP	- NONE - MC_STAT_LOOK_INDEX MC_STAT_INDEX_FOUND MC_STAT_LOOK_AUX_IDX MC_STAT_AUX_IDX_FND MC_STAT_HOMED - NONE - - NONE -
24 25 26 27 28 29 30 31	MC_STAT_LMT_ABORT MC_STAT_LMT_STOP MC_STAT_MLIM_TRIP MC_STAT_MLIM_ENAB MC_STAT_INP_MLIM MC_STAT_PLIM_TRIP MC_STAT_PLIM_ENAB MC_STAT_INP_PLIM	MC_STAT_INP_INDEX MC_STAT_INP_HOME MC_STAT_INP_AMP - NONE - MC_STAT_INP_PLIM MC_STAT_INP_MLIM MC_STAT_INP_PJOG MC_STAT_INP_MJOG	MC_STAT_INP_INDEX MC_STAT_INP_HOME MC_STAT_INP_AMP MC_STAT_INP_AUX MC_STAT_INP_PLIM MC_STAT_INP_MLIM MC_STAT_INP_USER1 MC_STAT_INP_USER2	MC_STAT_INP_INDEX MC_STAT_INP_HOME MC_STAT_INP_AMP MC_STAT_INP_AUX MC_STAT_INP_PLIM MC_STAT_INP_MLIM MC_STAT_INP_NULL - NONE -	MC_STAT_INP_INDEX MC_STAT_INP_HOME MC_STAT_INP_AUX MC_STAT_INP_AMP MC_STAT_INP_PLIM MC_STAT_INP_MLIM - NONE - - NONE -


Status Word Constants Cross Reference

This table is provided for cross-platform comparisons of MCDecodeStatusEx( ) constants. Suppose you are using the MC_STAT_TRAJ status bit on a DC2-PC100 controller and plan to migrate to the more powerful DCX-AT200 controller. Locate the constant in the leftmost column, read across the row to the DCX-AT200 column and you will see that the MC_STAT_TRAJ constant is also supported for the DCX-AT200.

You will also notice that the bit positions for MC_STAT_TRAJ on the DC2-PC100 and the DCX-AT200 are different. If you had hard-coded this bit in your application you would be forced to change your program to accommodate a different controller. By using MCDecodeStatusEx( ) and the appropriate constants, no changes are required!

The numbers in the table represent the status word bit position for the specific controller. A dash indicates the constant is not supported for a particular controller. Numbers followed by an "a" indicate bits in the controller's auxiliary status word, those followed by an "p" indicate bits in the controller's profile status word, and those followed by an "m" indicate bits in the controller's mode status word.

Constant	DC2-PC DC2-STN	DCX-PC100 DCX-AT100	DCX-AT200 DCX-AT300	DCX-PCI100 DCX-PCI300	MFX-PCI1000
MC_STAT_BUSY MC_STAT_MTR_ENABLE MC_STAT_MODE_VEL MC_STAT_TRAJ MC_STAT_DIR MC_STAT_JOG_ENAB MC_STAT_HOMED MC_STAT_ERROR MC_STAT_LOOK_INDEX MC_STAT_LOOK_EDGE	- 0 18 4 6 - 12 1 10 11	0 1 2 3 4 - 6 7 8 9	0 1 - 3 4 5 6 7 8 9	0 1 - 3 4 - 6 7 8 9	- 1 - 3 4 - 21 0 17 17
MC_STAT_BREAKPOINT MC_STAT_FOLLOWING MC_STAT_AMP_ENABLE MC_STAT_AMP_FAULT MC_STAT_PLIM_ENAB MC_STAT_PLIM_TRIP MC_STAT_MLIM_ENAB MC_STAT_MLIM_TRIP MC_STAT_PSOFT_ENAB MC_STAT_PSOFT_TRIP	3 - - - 30 29 27 26 - -	12 - 14 15 16 17 18 19 - -	12 13 14 15 16 17 18 19 20 21	12 13 14 15 16 17 18 19 20 21	6 8 10 a 9 0 a 10 1 a 11 4 a 12
MC_STAT_MSOFT_ENAB MC_STAT_MSOFT_TRIP MC_STAT_INP_INDEX MC_STAT_INP_HOME MC_STAT_INP_AMP MC_STAT_INP_AUX MC_STAT_INP_PLIM MC_STAT_INP_MLIM MC_STAT_INP_USER1 MC_STAT_INP_USER2	- - - 13 - - 31 28 - -	- - 24 25 26 - 28 29 - -	22 23 24 25 26 27 28 29 30 31	22 23 24 25 26 27 28 29 - -	5 a 13 24 25 27 26 28 29 - -
MC_STAT_PHASE MC_STAT_FULL_STEP MC_STAT_HALF_STEP MC_STAT_JOGGING MC_STAT_PJOG_ENAB MC_STAT_PJOG_ON MC_STAT_MJOG_ENAB MC_STAT_MJOG_ON MC_STAT_INP_PJOG MC_STAT_INP_MJOG	9 - - - - - - - - -	5 10 11 13 20 21 22 23 30 31	- - - - - - - - - -	- - - - - - - - - -	11 a 26 a - - - - - - - -
MC_STAT_STOPPING MC_STAT_PROG_DIR MC_STAT_AT_TARGET MC_STAT_ACCEL MC_STAT_MODE_POS MC_STAT_MODE_TRQE MC_STAT_MODE_ARC MC_STAT_MODE_CNTR MC_STAT_MODE_SLAVE MC_STAT_LMT_ABORT	5 7 8 16 17 19 20 21 22 24	- - - - - - - - - -	- - 2 - - - - - - -	- - 2 - - - - - - -	5 p - 2 3 p 0 m 3 m - 4 m - 2 a
MC_STAT_LMT_STOP MC_STAT_CAPTURE MC_STAT_RECORD MC_STAT_SYNC MC_STAT_MODE_LIN MC_STAT_INDEX_FOUND MC_STAT_POS_CAPT MC_STAT_NULL MC_STAT_EDGE_FOUND MC_STAT_PRI_ENC_FAULT MC_STAT_AUX_ENC_FAULT	25 2 14 15 23 - - - - - -	- - - - - - - - - - -	- - - - - - - - - - -	- - - - - 10 11 30 - - -	3 a - - - - 18 5 - 18 14 15
MC_STAT_LOOK_AUX_IDX MC_STAT_AUX_IDX_FND	- -	- -	- -	- -	16 20


Error Message Cross Reference
Error Messages

MCAPI defined error messages are listed numerically in the table below. Where possible corrective action is included in the description column. Please note that many MCAPI function descriptions also include information regarding errors that are specific to that function.

Error	Constant	Description
0	MCERR_NOERROR	No error has occurred.
1	MCERR_NO_CONTROLLER	No controller assigned at this ID. Use MCSETUP to configure a controller.
2	MCERR_OUT_OF_HANDLES	MCAPI driver out of handles. The driver is limited to 32 open handles. Applications that do not call MCClose( ) when they exit may leave handles unavailable, forcing a reboot.
3	MCERR_OPEN_EXCLUSIVE	Cannot open - another application has the controller opened for exclusive use.
4	MCERR_MODE_UNAVAIL	Controller already open in different mode. Some controller types can only be open in one mode (ASCII or binary) at a time.
5	MCERR_UNSUPPORTED_MODE	Controller doesn't support this mode for MCOpen( ) - i.e. ASCII or binary.
6	MCERR_INIT_DRIVER	Couldn't initialize the device driver.
7	MCERR_NOT_PRESENT	Controller hardware not present.
8	MCERR_ALLOC_MEM	Memory allocation error. This is an internal memory allocation problem with the DLL, contact Technical Support for assistance.
9	MCERR_WINDOWSERROR	A windows function returned an error - use GetLastError () under WIN32 for details
10	-	reserved
11	MCERR_NOTSUPPORTED	Controller doesn't support this feature.
12	MCERR_OBSOLETE	Function is obsolete.
13	MCERR_CONTROLLER	Invalid controller handle.
14	MCERR_WINDOW	Invalid window handle.
15	MCERR_AXIS_NUMBER	Axis number out of range.
16	MCERR_AXIS_TYPE	Axis type doesn't support this feature.
17	MCERR_ALL_AXES	Cannot use MC_ALL_AXES for this function.
18	MCERR_RANGE	Parameter was out of range.
19	MCERR_CONSTANT	Constant value inappropriate.
20	MCERR_UNKNOWN_REPLY	Unexpected or unknown reply.
21	MCERR_NO_REPLY	Controller failed to reply.
22	MCERR_REPLY_SIZE	Reply size incorrect.
23	MCERR_REPLY_AXIS	Wrong axis for reply.
24	MCERR_REPLY_COMMAND	Reply is for different command.
25	MCERR_TIMEOUT	Controller failed to respond.
26	MCERR_BLOCK_MODE	Block mode error. Caused by calling MCBlockEnd( ) without first calling MCBlockBegin( ) to begin the block.
27	MCERR_COMM_PORT	Communications port (RS232) driver reported an error.
28	MCERR_CANCEL	User canceled action (such as when an MCDLG dialog box is dismissed with the CANCEL button.
29	MCERR_NOT_FOUND	MCDLG_RestoreAxis( ) was unable to locate restore data.


API Functions Grouped By Type

Analog I/O Functions

Analog I/O functions control the Input and output of analog values through A/D and D/A ports installed on the controller.

MCGetAnalog	read analog input channel value

MCGetAnalogEx  (3.4)	read analog input channel value (extended)

MCSetAnalog	set analog output channel value

MCSetAnalogEx  (3.4)	set analog output channel value (extended)

Contouring Functions

Contouring functions provide direct support for high level contouring functions supported by the controller. The field CanDoContouring in the MCPARAM  structure will be set to TRUE if the controller type supports high level contouring functions.

MCArcCenter  (2.0)	set the center point for arc contour path motions

MCArcEndAngle  (2.2)	set the end angle for arc contour path motions

MCArcRadiusr  (2.2)	set the radius for arc contour path motions

MCBlockBegin  (1.3)	begin a macro, compound command, contour path, or task definition

MCBlockEnd  (1.3)	end a macro, compound command, contour path, or task definition

MCContourDistance  (2.0)	set the path distance for user mode contour path commands

MCContourPath	select type of contouring path (circular, linear, etc)

MCEnableSync	delay axis until triggered (synchronize with other axes)

MCGetContourConfig	get contour configuration settings

MCSetContourConfig	set contour configuration settings

Digital I/O Functions

Each digital I/O channel can be configured independently for input or output, as well as for high or low true logic. When configured for low true logic the "on" state of the channel will represent a low voltage (< 0.4VDC) and "off" a high voltage (> 2.4VDC). Conversely, when configured for high true logic the "on" state of the channel will represent a high voltage (> 2.4VDC) and "off" a low voltage (< 0.4VDC).

MCConfigureDigitalIO	configure digital channel for input or output, and set logic state

MCEnableDigitalIO	set digital output channel state

MCGetDigitalIO	get digital input channel state

MCGetDigitalIOEx  (4.0)	get digital input channel state

MCGetDigitalIOConfig  (2.1)	get digital I/O channel configuration

MCWaitForDigitalIO	wait for digital input channel to reach specific state

Driver Functions

Driver functions handle driver related housekeeping, and as such do not directly affect the controller.

MCGetAxisConfiguration  (3.0)	obtain hardware configuration of a motor axis

MCClose	close a controller (free handle)

MCGetConfiguration	see MCGetConfigurationEx( ), below

MCGetConfigurationEx  (3.0)	obtain hardware configuration of controller

MCGetInstalledModules  (3.0)	get the list of installed module types, by physical location on the controller

MCGetVersion  (1.2)	get version number of DLL and device driver

MCOpen	open controller for positioning (get handle)

MCReopen  (1.3)	re-opens existing controller handle with a new mode - ideal for switching between ASCII and binary modes

MCSetTimeoutEx  (1.3)	set a timeout value for controller I/O

Jog Functions

Jog functions configure and enable (or disable) controller response to external jog inputs. This input is typically in the form of a joystick or similar input device.

MCEnableJog	enable / disable jogging for axis

MCGetJogConfig	get jogging configuration for axis

MCGetJogConfigEx  (4.1)	get jogging configuration for axis

MCSetJogConfig	set jogging configuration for axis

MCSetJogConfigEx  (4.1)	set jogging configuration for axis

Electronic Gearing Functions

Electronic gearing permits you to slave the motion of an axis to the motion of a master axis by a fixed ratio.

MCEnableGearing	enable or disable electronic gearing at a specified ratio

Error Handling Functions

These functions support the communication of errors between the API and application programs.

MCErrorNotify  (1.2)	enables / disables error messages for application window

MCGetError  (1.2)	returns most recent error code for controller

MCTranslateErrorEx  (2.1)	translate numeric error code to text message

Macro & Multi-Tasking Functions

Macro and multi-tasking functions provide access to the motion controllers on-board macro capability, as well as the multitasking features of advanced controllers.

MCBlockBegin  (1.3)	begin a macro, compound command, contour path, or task definition

MCBlockEnd  (1.3)	end a macro, compound command, contour path, or task definition

MCCancelTask  (1.3)	cancel a task on a multi-tasking controller

MCMacroCall	executes a previously stored macro

MCRepeat  (1.3)	inserts a repeat command into a macro or task sequence

Motion Functions

Motion functions control the sequencing and operation of axes during.

MCAbort	abort current motion for axis

MCCaptureData  (1.3)	initiate real-time capture of position and servo loop data

MCDirection	set travel direction for axis (velocity mode)

MCEdgeArm  (3.2)	arm edge input for position capture

MCEnableAxis	turn axis on or off

MCEnableBacklash  (2.0)	enable backlash compensation

MCEnableCapture  (3.1)	enable position capture

MCEnableCompare  (3.1)	enable position compare

MCEnableDigitalFilter  (3.1)	enable digital filter

MCEnableEncoderFault  (3.4)	enable encoder fault detection

MCFindAuxEncIdx  (2.2)	find auxiliary encoder index position

MCFindEdge  (2.0)	initialize a stepper motor at a given position

MCFindIndex  (2.0)	initialize a servo motor at a given position

MCGoEx  (2.1)	start pre-programmed velocity mode motion

MCGoHome	send axis to home position (absolute location 0.0)

MCIndexArm  (2.2)	arm index for position capture

MCInterruptOnPosition  (3.3)	configure controller status word interrupts based on position

MCLearnPoint	store location in point memory

MCMoveAbsolute	move axis to an absolute position

MCMoveRelative	move axis by a distance relative to the current position

MCMoveToPoint	move to a location stored in point memory

MCReset	perform a software triggered reset of the controller

MCStop	stop axis

MCWait	wait for a variable time period

MCWaitForEdge  (2.0)	wait for the coarse home input to go to the specified logic state.

MCWaitForIndex  (3.2)	wait for the index input to go true.

MCWaitForPosition	wait for axis to reach position

MCWaitForRelative	wait for axis to reach position relative to target position

MCWaitForStop	wait for axis to stop

MCWaitForTarget	wait for axis to reach target position

Parameter Setup Functions

Parameter setup functions configure the basic motion parameters and operation.

MCConfigureCompare  (3.1)	configure high-speed position compare

MCSetAcceleration	set acceleration for axis

MCSetAuxEncPos	set position of the auxiliary encoder for axis

MCSetCommutation  (3.2)	configure commutation

MCSetDeceleration	set axis deceleration

MCSetDigitalFilter  (3.1)	configure digital filter

MCSetFilterConfig	set the PID filter parameters

MCSetFilterConfigEx  (3.2)	set the PID filter parameters (extended)

MCSetGain  (1.3)	set the proportional gain for servo axis

MCSetLimits  (1.3)	configure hard and soft limits

MCSetModuleInputMode  (3.2)	configure stepper module input mode

MCSetModuleOutputMode	select the axis output mode (unipolar, bipolar, etc)

MCSetMotionConfig	set motion configuration parameters

MCSetMotionConfigEx  (3.2)	set motion configuration parameters (extended)

MCSetOperatingMode	select the axis operating mode (position, velocity, gain, etc.)

MCSetPosition	set current position of axis

MCSetProfile	select motion profile

MCSetRegister  (2.0)	set general purpose register to value

MCSetServoOutputPhase	select normal or reverse phase for axis

MCSetTorque  (1.3)	set torque for servo axis

MCSetTrajectoryRate  (4.1)	set controller maximum trajectory rate

MCSetVectorVelocity  (2.0)	set vector velocity for axis

MCSetVelocity	set velocity for axis

MCSetVelocityOverride  (3.5)	set velocity override for an axis

Reporting Functions

Reporting functions query the controller for current motion settings.

MCDecodeStatus  (1.3)	controller independent status word decoding

MCDecodeStatusEx  (3.3)	controller independent status word decoding

MCEnableInterrupt  (3.3)	enable controller status word interrupts

MCGetAccelerationEx  (1.3)	get current acceleration value for axis

MCGetAuxEncIdxEx  (1.3)	get last observed position of auxiliary encoder index pulse

MCGetAuxEncPosEx  (1.3)	get current position of auxiliary encoder

MCGetBreakpointEx  (1.3)	get the most recent breakpoint position

MCGetCaptureData  (1.3)	retrieve captured position data for an axis

MCGetContouringCount	get index of current contouring command

MCGetCount  (3.1)	get count parameter of various modes

MCGetDecelerationEx  (1.3)	get deceleration value for axis

MCGetDigitalFilter  (3.1)	get digital filter settings

MCGetFilterConfig	get the PID filter parameters

MCGetFilterConfigEx  (3.2)	get the PID filter parameters (extended)

MCGetFollowingError  (1.3)	get current following error for a servo axis

MCGetGain  (1.3)	get current proportional gain setting for a servo axis

MCGetIndexEx  (1.3)	get last observed position of primary encoder index pulse

MCGetLimits  (1.3)	get current hard and soft limit settings

MCGetModuleInputMode  (3.2)	get the current input mode for an axis

MCGetModuleOutputMode  (3.5)	get the current output mode for an axis

MCGetMotionConfig	get motion configuration settings

MCGetMotionConfigEx  (3.2)	get motion configuration settings (extended)

MCGetOperatingMode  (3.2)	get the current operating mode for a motor module

MCGetOptimalEx  (1.3)	get current optimal position for axis

MCGetPositionEx  (1.3)	get current position of axis

MCGetProfile  (1.3)	get current acceleration / deceleration profile setting

MCGetRegister  (2.0)	get the contents of a general purpose register

MCGetServoOutputPhase (1.3)	get the output phase setting for a servo axis

MCGetStatus	get status word from axis

MCGetStatusEx  (3.3)	get status word from axis

MCGetTargetEx  (1.3)	get current target position for axis

MCGetTorque  (1.3)	get the current torque setting for a servo axis

MCGetTrajectoryRate  (4.1)	get the controller current maximum trajectory rate

MCGetVectorVelocity  (2.0)	get vector velocity of an axis

MCGetVelocityActual  (3.4)	get current actual velocity for axis

MCGetVelocityEx  (1.3)	get programmed velocity for axis

MCGetVelocityOverride  (3.5)	get the velocity override for an axis

MCIsAtTarget  (2.2)	is axis at target position?

MCIsDigitalFilter  (3.1)	is digital filter enabled?

MCIsEdgeFound  (3.2)	has edge input gone true?

MCIsIndexFound  (3.2)	has edge input gone true?

MCIsStopped  (2.2)	is axis stopped?

Scale Functions

Scale functions permit the application to change the controller units from simple encoder based values to more natural units such as inches, meters, mm/sec, etc.

MCGetScale	get scaling factors for axis

MCSetScale	set scaling factors for axis

OEM Low Level Functions

The OEM low level commands provide direct access to controller functionality. The functions in this group are not part of the formal Motion Control API.

These functions have been implemented in a way that is consistent with DOS mode libraries for these controllers. This consistency is designed to simplify the task of porting existing DOS applications to Windows.

pmccmd	send a binary command

pmccmdex  (2.2)	send a binary command

pmcgetc	get ASCII character from controller

pmcgetram	read directly from controller memory

pmcgetramex  (3.4)	read directly from controller memory (extended)

pmcgets	get ASCII string from controller

pmcputc	write ASCII character to controller

pmcputram	write directly to controller memory

pmcputram  (3.4)	write directly to controller memory (extended)

pmcputs	write ASCII string to controller

pmcrdy	is the controller ready to accept a binary command

pmcrpy	read binary reply from controller

pmcrpyex  (2.2)	read binary reply from controller


Programming Samples Grouped By Type
Programming Examples Grouped By Type

Advanced Feature Examples

Advanced feature examples include high-speed capture and compare, contouring, closed-loop stepper operation, digital filtering, etc.

	Use the high-speed capture feature to capture multiple positions
	Demonstrates the motion capture feature (used by Servo Tuning)
	Using the high-speed position compare feature
	Coordinated motion using on-board contouring
	Copy a digital filter from one axis to another

Basic Motion Examples

These examples demonstrate fundamental motion concepts, moving, setting speeds and accelerations, etc.

	Abort a motion in progress
	Abort a motion in progress
	Abort a motion in progress
	Wait for an axis to stop, adjust acceleration, and move again
	Enable an axis for motion
	Enable an axis for motion
	Enable an Axis for motion
	Examine motor following error on-the-fly
	Use electronic gearing to link the motion of 2 axes
	Basic motion commands are used to draw a rectangle
	Basic motion commands are used to draw a rectangle
	Basic absolute and relative moves
	Learn positions and move using point memory

Digital and Analog I/O Examples

These examples demonstrate the use of the user defined analog and digital I/O channels.

	Sample an analog input and generate a scaled analog output
	Configure and test digital I/O channels

Driver Examples

Driver examples include samples that interact with the MCAPI driver for administrative (i.e. non-motion related) reasons, such as opening a handle to a motion controller.

	Closing a motion controller handle at the end of a program
	Hook the error reporting feature of the MCAPI
	Opening a motion controller
	Opening a motion controller

Homing Examples

The homing examples demonstrate different methods of using the MCAPI functions to home (reference) servo and stepper motors.

	Simple servo homing using just an encode index.
	Open-loop stepper homing using a home input and limit switch
	Stepper homing using just a limit switch
	Closed-loop stepper homing using a coarse home input, limit switch, and encoder index.

Setup Examples

Setup examples demonstrate how to configuration a motion controller for motion.

	Configure automatic backlash compensation
	Configure the motion and PID parameters
	Configure the motion and PID parameters
	Configure the motion and PID parameters
	Setup and enable hardware jogging
	Configure limit switch operation


MCAbort

MCAbort( ) aborts any current motion for the specified axis or axes.

void MCAbort(

HCTRLR hCtlr,	// controller handle

WORD axis 	// axis number

);

// .NET

Mcapi.Error Mcapi.Abort(

Int16 axis

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to abort motion.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The selected axis will execute an emergency stop following this command. Issuing this command with axis set to MC_ALL_AXES will abort motion for all axes installed on the motion controller.

Servo axes will stop abruptly, and the servo control loop will remain energized.

For stepper motors, pulses from the motion controller will be disabled immediately. The state of the axis (enabled or disabled) following the call to MCAbort( ) will depend upon the type of controller (see your controller hardware manual).

Compatibility

Following a call to MCAbort( ), you should wait for the motor to stop and then re-initialize the axis using MCEnableAxis( ) before performing any further motions.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

AB

See Also

MCEnableAxis( ), MCSetOperatingMode( ), MCStop( )


MCArcCenter
MCArcCenter  (2.0)

MCArcCenter( ) specifies the center of an arc for contour path motion.

long int MCArcCenter(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int type,	// absolute / relative

double position 	// center position

);

// .NET

Mcapi.Error Mcapi.ArcCenter(

Int16 axis,

Mcapi.PositionType type,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to specify arc center for.

type	Flag to indicate if the center position is specified in absolute units or relative to the current position.

Value	Description

MC_ABSOLUTE	Center position is specified in absolute units.

MC_RELATIVE	Center position is specified relative to the current position of axis.

Position	Absolute or relative arc center position for axis.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function sets the center of an arc for contour path motion. Since arc motion is performed by two axes, this function should be called twice in a contour path block, once for each axis. To determine if a particular controller can process the MCArcCenter( ) contouring function, check the CanDoContouring flag of the MCPARAMEX structure.

Compatibility

Contouring is not supported on the DCX-PC or DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

CA, CR

See Also

MCArcEndAngle( ), MCArcRadius( ), MCBlockBegin( ), MCPARAMEX structure definition, MCSetOperatingMode( )


MCArcEndAngle
MCArcEndAngle  (2.2)

MCArcEndAngle( ) specifies the ending angle of an arc for contour path motion.

long int MCArcEndAngle(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int type,	// absolute / relative

double angle 	// ending angle

);

// .NET

Mcapi.Error Mcapi.ArcEndAngle(

Int16 axis,

Mcapi.PositionType type,

Double angle

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to specify arc ending angle for.

type	Flag to indicate if the end angle is specified in absolute units or relative to the current position.

Value	Description

MC_ABSOLUTE	End angle is specified in absolute units.

MC_RELATIVE	End angle is specified relative to the current position of axis.

angle	Absolute or relative arc ending angle for axis.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function sets the ending angle of an arc for contour path motion. To determine if a particular controller can process the MCArcEndAngle( ) contouring function, check the CanDoContouring flag of the MCPARAMEX structure.

Compatibility

Contouring is not supported on the DCX-PC or DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

MCCL Reference

EA, ER

See Also

MCArcCenter( ), MCArcRadius( ), MCBlockBegin( ), MCPARAMEX structure definition, MCSetOperatingMode( )


MCArcRadius
MCArcRadius  (2.2)

MCArcRadius( ) specifies the radius of an arc for contour path motion.

long int MCArcRadius(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double radius 	// arc radius

);

// .NET
Mcapi.Error Mcapi.ArcRadius(

Int16 axis,

Double radius

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to specify arc radius for.

radius	Arc radius for axis.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function sets the radius of an arc for contour path motion. To determine if a particular controller can process the MCArcRadius( ) contouring function, check the CanDoContouring flag of the MCPARAMEX structure.

Compatibility

Contouring is not supported on the DCX-PC or DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

MCCL Reference

RR

See Also

MCArcCenter( ), MCArcEndAngle( ), MCBlockBegin( ), MCPARAMEX structure definition, MCSetOperatingMode( )


MCBlockBegin
MCBlockBegin  (1.3)

MCBlockBegin( ) initiates a block command sequence. All commands up to the subsequent MCBlockEnd( ) will be included in the block. Block commands include compound commands, macro definition commands, contour path motions, and tasks on multitasking controllers.

long int MCBlockBegin(

HCTRLR hCtlr,	// controller handle

long int mode,	// block mode type

long int num 	// macro / task number / controlling axis

);

// .NET

Mcapi.Error Mcapi.BlockBegin(

Mcapi.BlockType mode,

Int32 num

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

mode	Type of block command to begin:

Value	Description

MC_BLOCK_COMPOUND	Specifies that this block is a compound command.

MC_BLOCK_TASK	Specifies this block as an individual task on multitasking controllers. Num should be set to the desired task number.

MC_BLOCK_MACRO	Specifies this block as a macro definition. Num should be set to the desired macro number for this macro.

MC_BLOCK_RESETM	Resets macro memory. Setting Num to zero resets all macros (and works with all controllers), Num may also be set to 1 or 2 on the DCX-AT controllers to selectively delete ram or flash based macros.

MC_BLOCK_CANCEL	Cancels a block command without sending any commands to the controller.

MC_BLOCK_CONTR_USER	Specifies that this block is a user defined contour path motion. Num should be set to the controlling axis number.

MC_BLOCK_CONTR_LIN	Specifies that this block is a linear contour path motion. Num should be set to the controlling axis number.

MC_BLOCK_CONTR_CW	Specifies that this block is a clockwise arc contour path motion. Num should be set to the controlling axis number.

MC_BLOCK_CONTR_CCW	Specifies that this block is a counter-clockwise arc contour path motion. Num should be set to the controlling axis number.

num	Specifies the macro number for macro blocks, the task number for task blocks, the controlling axis for contour blocks, or the macro types for macro reset.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

The MCBlockBegin( ) and MCBlockEnd( ) commands are used to bracket other API commands in order to affect how those commands are executed. While the high level MCAPI is function based (as are most Windows APIs), PMC's motion control cards are command based. They are capable of accepting single commands or blocks of commands, depending upon the complexity of the motion. To provide the same block functionality to the MCAPI the MCBlockBegin( ) and MCBlockEnd( ) functions where created. These functions may be used to bracket one or more MCAPI function calls to create function blocks.

One use is to create a compound command block - where multiple commands are sent to the controller as a single block. This is useful for data capture sequences, homing sequences, or anywhere you want to synchronize a complex group of commands.

For multi-tasking controllers, the block commands can be used to group individual commands as separate tasks. Multi-tasking permits multiple user programs to run in parallel on PMC's advanced motion control cards. Multi-tasking also permits you to run command sequences that would normally lock-up the controller's command interpreter in the background, thus leaving the command interpreter unaffected.

A third use of the block commands is to store the bracketed command sequence as a macro. Macros may be replayed at any time using the MCMacroCall( ) function. Please note that API commands that read data from a controller, such as any of the MCGet...( ) functions, should not be included in macros. Macro memory may be reset (cleared) by calling MCBlockBegin( ) with mode set to MC_BLOCK_RESETM. If your controller allows you to reset selected blocks of macros you may specify this by setting num to 1 for RAM-based macros or 2 for Flash memory macros.

All calls to MCBlockBegin( ), except those with an Mode of MC_BLOCK_RESETM or MC_BLOCK_CANCEL require a corresponding call to MCBlockEnd( ). Calls to MCBlockBegin( ) may not be nested, except that MCBlockBegin( ) calls with an Mode of MC_BLOCK_CANCEL may be included within other MCBlockBegin( ) blocks (this call terminates the outer MCBlockBegin( ), so no MCBlockEnd( ) is needed in this case).

Beginning with version 2.0 of the MCAPI, blocks are also used for multi-axis contouring. Contouring requires first that the selected axes be placed in contouring mode and a controlling axis specified. This is done with the MCSetOperatingMode( ) function. Then blocks of contour path moves are issued. Under the MCAPI, these contour path blocks are specified by bracketing MCArcCenter( ), MCGoHome( ), MCMoveAbsolute( ), MCMoveRelative( ), or MCSetVectorVelocity( ) with block commands that are one of the MC_BLOCK_CONTR_xxx types.

Block commands may be canceled prior to issuing an MCBlockEnd( ) by calling MCBlockBegin( ) with Mode set to MC_BLOCK_CANCEL.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

CP, GT, MD, RM

See Also

MCBlockEnd( ), MCCancelTask( ), MCMacroCall( ), MCRepeat( )


MCBlockEnd
MCBlockEnd  (1.3)

MCBlockEnd( ) ends a block command and transmits the compound command, task, macro, or contour path to the controller.

long int MCBlockEnd(

HCTRLR hCtlr,	// controller handle

long int* taskID 	// task ID for MC_BLOCK_TASK blocks

);

// .NET

Mcapi.Error Mcapi.BlockEnd(

ref UInt32 taskID 	// task ID for MC_BLOCK_TASK blocks

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

taskID	Pointer to variable to hold the Task ID value for MC_BLOCK_TASK blocks, this parameter is ignored and may be set to NULL for MC_BLOCK_COMPOUND or MC_BLOCK_MACRO blocks. Setting this parameter to NULL for MC_BLOCK_TASK will cause the function to not return the Task ID.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

The MCBlockBegin( ) and MCBlockEnd( ) commands are used to bracket other API commands in order to affect how those commands are executed.

See the description of MCBlockBegin( ) for more information.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

None

See Also

MCBlockBegin( ), MCCancelTask( )


MCCancelTask
MCCancelTask  (1.3)

MCCancelTask( ) cancels an executing task on a multi-tasking controller. The task should have been previously started with an MCBlockBegin( ) / MCBlockEnd( ) pair.

long int MCCancelTask(

HCTRLR hCtlr,	// controller handle

long int taskID 	// ID of task to cancel

);

// .NET
Mcapi.Error Mcapi.CancelTask(

UInt32 taskID 	// ID of task to cancel

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

taskID	Task ID value for the task to be stopped. This value was returned by the MCBlockEnd( ) function when the task was generated.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

MCCancelTask( ) is the only way to stop tasks that are not programmed to stop themselves (i.e. infinite loop tasks).

See the description of MCBlockBegin( ) for more information and examples.

Compatibility

Multi-tasking is not supported on the DCX-PC or DC2-PC controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

ET

See Also

MCBlockBegin( ), MCCancelTask( )


MCCaptureData
MCCaptureData  (1.3)

MCCaptureData( ) configures a controller to perform data capture for the specified axis. Captured data includes actual position vs. time, optimal position vs. time, and following error vs. time.

long int MCCaptureData(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int points,	// number of data points to collect

double period,	// time period between data points (seconds)

double delay 	// delay prior to data capture (seconds)

);

// .NET

Mcapi.Error Mcapi.CaptureData(

Int16 axis,

Int32 points,

Double period,

Double delay

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to capture data.

points	Number of data points to collect.

period	Time period between subsequent data point captures.

delay	Delay (dwell) before initial data collection.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

Captured position data is typically used to analyze servo motor performance and PID loop tuning parameters. PMC's Servo Tuning utility uses this function to analyze servo performance.

MCBlockBegin( ) may be used with MCCaptureData( ) to bundle the capture data command with mode and move commands (see the example below).

Beginning with version 3.0 of the MCAPI users may use the MCGetAxisConfiguration( ) function to determine the data capture capabilities of an axis.

Compatibility

Data capture is not supported on the DCX-PC controller.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

DY , PR, RI

See Also

MCGetConfiguration( ), MCGetCaptureData( ), MCBlockBegin( )


MCClose

MCClose( ) closes the specified motion controller handle, and is typically called at the end of a program.

short int MCClose(

HCTRLR hCtlr	// controller handle

);

// .NET

Mcapi.Error MCClose();

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

Returns

For WIN32 the return value from this function is MCERR_NOERROR (zero) if the handle was closed with no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

Following a call to MCClose( ), no further calls should be made to the Motion Control API functions with this handle (the exception being MCOpen( ), which may be called to open or reopen the API at any time).

By calling MCClose( ) you notify Windows that you are done with the controller and device driver. When the last user has closed the driver Windows is then free to unload the driver from memory. Failure to call close leaves the handle open, reducing the number of available controller handles for other applications.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

None

See Also

MCOpen( )


MCConfigureCompare
MCConfigureCompare  (3.1)

The MCConfigureCompare( ) function configures an axis for high-speed position compare mode operation.

long int MCConfigureCompare(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* values,	// array of compare points

long int num,	// number of points in values array

double inc,	// increment between equally paced points

long int mode,	// output signal mode

double period 	// output period for one shot mode (seconds)

);

// .NET

Mcapi.Error Mcapi.ConfigureCompare(

Int16 axis,

ref Double values,

Int32 num,

Double inc,

Mcapi.CompareType mode,

Double period

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to configure.

values	Array of compare position values.

num	Number of compare values.

inc	Increment between successive compare positions when in evenly-spaced mode (see Comments, below).

mode	Specifies how the controller is to signal that a compare position has been seen:

Value	Description

MC_COMPARE_DISABLE	Disables the output.

MC_COMPARE_INVERT	Inverts active level of the output – may be or'ed together with any of the other settings for mode.

MC_COMPARE_ONESHOT	Configures the output for one-shot operation. The value for period will be used for the period of the one-shot.

MC_COMPARE_STATIC	Configures the output for static mode (see the controller documentation for details).

MC_COMPARE_TOGGLE	Configures the output to toggle between the active and inactive states each time a compare value is reached.

period	Period, in seconds, of the one-shot output when one-shot output mode has been selected.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

Points for MCConfigureCompare( ) may be entered in one of two ways. Discrete points, up to the number allowed by the axis type (typically 512 or 1024) may be stored in the array values and passed to the controller. If the compare points are equally spaced store the beginning point in the first location of values, set num to one, and set inc to the per point increment. Note that inc is ignored if it is set equal to or less than zero, or if num is set to a value other than one.

The high-speed compare function signals a valid compare by way of a hardware output signal from the motor module. Use the mode flag to configure the operation of this hardware output.

Compatibility

Position compare is not supported on the DCX-AT200, DCX-PC, or the DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

LC, NC, OC, OP

See Also

MCEnableCompare( ), MCGetCount( )


MCConfigureDigitalIO

The MCConfigureDigitalIO( ) function configures a specific digital I/O channel for input or output and for high or low true logic.

short int MCConfigureDigitalIO(

HCTRLR hCtlr,	// controller handle

WORD channel,	// channel number

WORD mode 	// configuration flags

);

// .NET

Mcapi.Error Mcapi.ConfigureDigitalIO(

Int16 channel,

DigitalIOType mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Digital channel number to configure.

mode	Specifies how the channel is to be configured. This parameter may be any one of the digital I/O flags listed below. An input/output flag and a logic level flag may be OR'ed together (see example).

Value	Description

MC_DIO_INPUT	Configures the channel for input.

MC_DIO_OUTPUT	Configures the channel for output.

MC_DIO_LOW	Configures the channel for negative logic level.

MC_DIO_HIGH	Configures the channel for positive logic level.

MC_DIO_LATCH	Configures the (input) channel for latched operation.

Returns

For Win32 he return value is TRUE if the channel was configured, or FALSE if MCConfigureDigitalIO( ) was unable to configure the channel as requested.

For .NET this function returns a Mcapi.Error error status.

Comment

Each digital I/O channel may be configured for input or for output. The logic level maps the logical "on" and "off" states of the channel to the physical input and output voltages for that channel. If the channel is set to MC_DIO_LOW (negative logic) the "on" state of a channel will represent a low voltage (<0.4VDC) and "off" a high voltage (>2.4VDC). When set to MC_DIO_HIGH (positive logic) the "on" state of a channel will represent a high voltage (>2.4VDC) and "off" a low voltage (<.0.4VDC).

Digital I/O channels on the DCX-PCI motherboards (not to be confused with Digital I/O channels on MC400 modules) are fixed as inputs or outputs and may only be configured for positive or negative logic levels.

On the DC2-STN controller, beginning with firmware release 1.2a, it is possible to configure an input channel to "latch" input events (see the controller manual for details of signal hold time, etc.). Configure an input channel using the MC_DIO_LATCH constant to enable latching or clear the latched state. Configure an input channel using the MC_DIO_INPUT constant to disable latching.

NOTE: Under MCAPI the DC2-STN controller's input channels are numbered 1 - 8, and the output channels are numbered 9 - 16 (MCAPI requires that each channel have a unique channel number).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

CH, CI, CL, CT, LC

See Also

MCEnableDigitalIO( ), MCGetDigitalIOEx( ), MCGetDigitalIOConfig( )


MCContourDistance
MCContourDistance  (2.0)

This function sets the distance for user defined contour path motions.

long int MCContourDistance(

HCTRLR hCtlr,	// controller handle

WORD axis,	// selects controlling axis

double distance 	// path distance

);

// .NET

Mcapi.Error Mcapi.ContourDistance(

Int16 axis,

Double distance

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number of controlling axis for contour motion.

distance	Path distance for user path.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to specify the distance, as measured along the path, from the contour path starting point to the end of the next motion. It is required for user defined contour path motions.

Compatibility

Contouring is not supported on the DCX-PC or DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

CD

See Also

MCBlockBegin( )


MCContourPath

The MCContourPath( ) function is obsolete as of version 2.0 of the MCAPI and should not be used. See MCBlockBegin( ) to construct contour path commands.

long int MCContourPath(

HCTRLR hCtlr,	// controller handle

WORD axis,	// selects controlling axis

WORD mode,	// contouring mode

char* command 	// compound contouring command

);

// .NET - Use Mcapi.BlockBegin()

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number of controlling axis for contour motion.

mode	Type of contouring motion, one of the following:

Value	Description

MC_LINEAR	Perform linear interpolation for selected axes.

MC_CIRC_CW	Perform clockwise circular contouring for selected axes.

MC_CIRC_CCW	Perform counter clockwise circular contouring for selected axes.

command	compound contouring command string.

Returns

This function does not return a value.

Comment

This function is obsolete as of version 2.0 of the MCAPI and should not be used. See MCBlockBegin( ) to construct contour path commands.

Compatibility

Contouring is not supported on the DCX-PC or DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher, now obsolete

MCCL Reference

CP

See Also

MCBlockBegin( ), MCSetOperatingMode( ), MCPARAMEX structure definition


MCDecodeStatus
MCDecodeStatus  (1.3)

The MCDecodeStatus( ) function permits you to test flags in the controller status word in a way that is independent of the type of controller being inspected. This function has been superseded by MCDecodeStatusEx( ), which should in general be used for new designs.

long int MCDecodeStatus(

HCTRLR hCtlr,	// controller handle

DWORD status,	// status word

long int bit 	// status bit selection flag

);

// .NET

Boolean Mcapi.DecodeStatus(

UInt32 status,

Mcapi.StatusBit bit

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

status	Status value returned from a previous call to MCGetStatus( ).

bit	Status bit to decode. Over fifty different status bit flags (not all flags are supported by all controllers) are defined in the Constants section of this help file. Valid Bit constants begin with "MC_STAT_".

Returns

This function returns TRUE if the selected bit is set, or FALSE if the bit is not set or the bit does not apply to this controller type.

Comment

Using this function to test the status word returned by MCGetStatus( ) isolates the program from controller dependent bit ordering of the status word. The sample programs include numerous examples of the MCDecodeStatus( ) function.

To assist with proper constant selection two tables have been provided. The Status Word Lookup Table lists the constants in the same order as the status word bits they represent for each controller model. A second table, The Status Word Cross Reference lists the controller models supported by each constant.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

None

See Also

MCDecodeStatusEx( ), MCGetStatus( ), sample programs


MCDecodeStatusEx
MCDecodeStatusEx  (3.3)

The MCDecodeStatusEx( ) function permits you to test flags in the controller status words in a way that is independent of the type of controller being inspected.

long int MCDecodeStatusEx(

HCTRLR hCtlr,	// controller handle

MCSTATUSEX* status,	// status word data structure

long int bit 	// status bit selection flag

);

// .NET

Boolean MCDecodeStatusEx(

ref Mcapi.StatusEx status,

Mcapi.StatusBit bit

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

status	Status word structure returned from a previous call to MCGetStatusEx( ).

bit	Status bit to decode. Over sixty different status bit flags (not all flags are supported by all controllers) are defined in the Constants section of this help file. Valid Bit constants begin with "MC_STAT_".

Returns

This function returns TRUE if the selected bit is set, or FALSE if the bit is not set or the bit does not apply to this controller type.

Comment

Using this function to test the status words returned by MCGetStatusEx( ) isolates the program from controller dependent bit ordering of the status word. The sample programs include numerous examples of the MCDecodeStatusEx( ) function.

Begininng with version 3.3.0 of the MCAPI extended functions for getting and testing status word bits have been added to the API. These functions read and test bits in the up to four separate status words maintained by the controller. The Status variable used by the original functions has been replaced with a status structure that holds the individual status words.

To assist with proper constant selection two tables have been provided. The Status Word Lookup Table lists the constants in the same order as the status word bits they represent for each controller model. A second table, The Status Word Cross Reference lists the controller models supported by each constant.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.3 or higher

MCCL Reference

None

See Also

MCGetStatusEx( ), MCSTATUSEX structure definition, sample programs


MCDirection

The MCDirection( ) function sets the direction of motion when operating in velocity mode.

void MCDirection(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD dir 	// new direction

);

// .NET

Mcapi.Error Mcapi.Direction(

Int16 axis,

Mcapi.MoveDirection dir

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to set the direction of.

dir	New direction to move in, may be either of the following values:

Value	Description

MC_DIR_POSITIVE	selects the positive direction for motion.

MC_DIR_NEGATIVE	selects the negative direction for motion.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

This command may be used to change the direction of travel when an axis is operating in Velocity Mode. The actual direction of travel for MC_DIR_POSITIVE and MC_DIR_NEGATIVE will depend upon your hardware configuration.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

DI

See Also

MCSetOperatingMode( )


MCEdgeArm
MCEdgeArm  (3.2)

MCEdgeArm( ) arms the edge capture function for the home input of an open-loop stepper axis.

long int MCEdgeArm(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new position for edge

);

// .NET

Mcapi.Error Mcapi.EdgeArm(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to search for the edge signal.

position	The position where the edge signal is sensed for the axis will be properly set to Position only after a call to MCWaitforEdge( ) and MCEnableAxis( ).

Returns

For Win32 function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to initialize an open-loop stepper motor at a given position. The function remains pending until the leading edge of the home input of the module goes active. At that time you must call MCWaitForEdge( ) followed by MCEnableAxis( ) to set the current position of the axis to the value of the Position parameter. This function does not cause any motion to be started or stopped.

Compatability

Edge arm is not supported by the MC300, MC320, or the MC360 (when in closed-loop mode) modules, or by the  DCX-AT200, DCX-PC, or DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

EL

See Also

MCFindEdge( ), MCWaitForEdge( )


MCEnableAxis

MCEnableAxis( ) turns the specified axis on or off.

void MCEnableAxis(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

short int state 	// boolean flag for on/off setting of axis

);

// .NET
Mcapi.Error Mcapi.EnableAxis(

Int16 axis,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to turn on or off.

state	Flag to indicate if this axis should be turned on or turned off:

Value	Description

TRUE	turn on axis.

FALSE	turn off axis.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The selected axis will be turned on or off depending upon the value of state. Note that an axis must be enabled before any motion will take place. Issuing this command with axis set to MC_ALL_AXES will enable or disable all axes installed on hCtlr.

This function accepts any non-zero value for state as TRUE, and will work correctly with most programming languages, including those that define TRUE as a non-zero value other than one (one is the Windows default value for TRUE).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

MF, MN

See Also

MCAbort( ), MCStop( )


MCEnableBacklash
MCEnableBacklash  (2.0)

The MCEnableBacklash( ) function sets the backlash compensation distance and turns backlash compensation on or off, depending upon the value of State.

long int MCEnableBacklash(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double backlash,	// backlash compensation distance

short int state 	// enable state

);

// .NET

Mcapi.Error Mcapi.EnableBacklash(

Int16 axis,

Double backlash,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Number of axis that is to have feature enabled or disabled.

backlash	Amount of backlash compensation to apply. This parameter is ignored if State is FALSE.

state	Specifies whether the channel is to be turned on or turned off.

Value	Description

TRUE	Turns backlash compensation on.

FALSE	Turns backlash compensation off.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

In applications where the mechanical system is not directly connected to the motor, it may be required that the motor move an extra amount to take up gear backlash. The Backlash parameter to this function sets the amount of this compensation, and should be equal to one half of the amount the axis must move to take up the backlash when it changes direction.

This function accepts any non-zero value for State as TRUE, and will work correctly with most programming languages, including those that define TRUE as a non-zero value other than one (one is the Windows default value for TRUE).

Compatibility

This function is supported only on the DCX-PCI300 and DCX-AT controllers for MC200 / MC210 / MC300 / MC310 Advanced Servo modules.

Example

Compatibility

Backlash compensation is not supported on the DCX-PCI100, DCX-PC or DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

BD, BF, BN


MCEnableCapture
MCEnableCapture  (3.1)

MCEnableCapture( ) begins position capture for the specified axis if count is greater than zero, or stops position capture if count is -1.

long int MCEnableCapture(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int count 	// number of points to capture

);

// .NET

Mcapi.Error Mcapi.EnableCapture(

Int16 axis,

Int32 count

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Number of axis that is to have feature enabled or disabled.

count	Set to -1 to disable capture mode, or to a number greater than zero to capture that many positions.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function enables the high-speed capture of Count points (maximum 512) if Count is greater than zero, or disables position capture if Count is -1. The count of currently captured data points may be obtained using MCGetCount( ), and captured position values may be retrieved using MCGetCaptureData ( ).

Compatibility

High-speed position capture is not supported on the DCX-PCI100, DCX-AT200, DCX-PC or the DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

CB

See Also

MCGetCaptureData ( ), MCGetCount( )


MCEnableCompare
MCEnableCompare  (3.1)

MCEnableCompare( ) enables or disables high-speed compare mode for the specified axis.

long int MCEnableCompare(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int count 	// enable/disable argument

);

// .NET

Mcapi.Error Mcapi.EnableCompare(

Int16 axis,

Int32 count

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Number of axis that is to have feature enabled or disabled.

count	Numeric argument, value depends on the type of compare

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

The high-speed compare function for axis is enabled or disabled by this function. High-speed compare mode must first be initialized by MCConfigureCompare( ) before compare mode may be enabled. To determine how many compares have occurred use MCGetCount( ).

If the compare operation was configured as one or more discrete points then the count argument of MCEnableCompare( ) should be set equal to the number of points. If instead the compare operation was configured for fixed increment mode set count to 0. To disable compare set count to –1.

Compatibility

Position compare is not supported on the DCX-PCI100, DCX-AT200, DCX-PC or the DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

BC

See Also

MCConfigureCompare( ), MCGetCount( )


MCEnableDigitalFilter
MCEnableDigitalFilter  (3.1)

MCEnableDigitalFilter( ) enables or disables the  digital filter capability of advanced motor modules, such as the MC300.

long int MCEnableDigitalFilter(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int state	// boolean flag enables/disables digital filter

);

// .NET

Mcapi.Error MCEnableDigitalFilter(

Int16 axis,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Number of axis that is to have feature enabled or disabled.

state	Flag to indicate if digital filter should be enabled on or disabled:

Value	Description

TRUE	enable digital filter for axis.

FALSE	disable digital filter for axis.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

The digital filter function for axis is enabled or disabled by this function. Digital filter coefficients are loaded using MCSetDigitalFilter( ) and may be read back from the controller using MCGetDigitalFilter( ). The function MCIsDigitalFilter( ) will return a flag indicating the current enabled state of the digital filter, and MCGetCount( ) may be used to determine the maximum filter size and the size of the currently loaded filter.

Compatibility

Digital filtering is not supported on the DCX-PCI100, DCX-AT200, DCX-PC or the DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

NF, YF

See Also

MCGetCount( ), MCGetDigitalFilter( ), MCIsDigitalFilter( ), MCSetDigitalFilter( )


MCEnableDigitalIO

The MCEnableDigitalIO( ) function turns the specified digital I/O channel on or off.

void MCEnableDigitalIO(

HCTRLR hCtlr,	// controller handle

WORD channel,	// channel number

short int state 	// enable state

);

// .NET

Mcapi.Error Mcapi.EnableDigitalIO(

Int16 channel,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Digital channel number to enable.

state	Specifies whether the channel is to be turned on or turned off.

Value	Description

TRUE	Turns the channel on.

FALSE	Turns the channel off.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The I/O channel selected by hCtlr and channel must have previously been configured for output using the MCConfigureDigitalIO( ) command. Note that depending upon how a channel has been configured "on" (and conversely "off") may represent either a high or a low voltage level.

This function accepts any non-zero value for state as TRUE, and will work correctly with most programming languages, including those that define TRUE as a non-zero value other than one (one is the Windows default value for TRUE).

NOTE: Under MCAPI the DC2-STN controller's input channels are numbered 1 - 8, and the output channels are numbered 9 - 16 (MCAPI requires that each channel have a unique channel number).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

CF, CN

See Also

MCConfigureDigitalIO( ), MCGetDigitalIOEx( ), MCGetDigitalIOConfig( )


MCEnableEncoderFault
MCEnableEncoderFault  (3.4)

MCEnableEncoderFault( ) enables or disables encoder fault detection.

long int MCEnableEncoderFault(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int type 	// Encoder type

);

// .NET

Mcapi.Error MCEnableEncoderFault(

Int16 axis,

Mcapi.Encoder type

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Number of axis that is to have feature enabled or disabled.

state	Flags to indicate which encoders to detect faults for (or'ed together):

Value	Description

MC_ENC_FAULT_PRI	enable encoder fault detection for the primary encoder.

MC_ENC_FAULT_AUX	enable encoder fault detection for the auxiliary encoder.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

Encoder fault detection must be enabled by MCEnableEncoderFault( ) before the controller will detect and report an encoder fault.You may enable fault detection separately for the primary and the auxiliary encoder inputs, you should not enable fault detection for an encoder input that is not physically connected to an encoder (circuit noise would be interpreted as encoder failures). To disable call this function with state set to zero.

Compatibility

Encoder fault detection is only supported on the MultiFlex family of motion controllers..

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.4 or higher

MCCL Reference

EE

See Also

MCGetStatusEx( )


MCEnableGearing

The MCEnableGearing( ) function enables or disables electronic gearing for the specified axis / Master pair.

void MCEnableGearing(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD master,	// master axis number

double ratio,	// gearing ratio

short int state 	// enable state

);

// .NET

Mcapi.Error Mcapi.EnableGearing(

Int16 axis,

Int16 master,

Double ratio,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to enable or disable gearing.

master	Master axis that axis is to follow.

ratio	Ratio at which axis is to reproduce Master’s motions.

state	Specifies whether the gearing is to be enabled on or disabled.

Value	Description

TRUE	Enables gearing.

FALSE	Disables gearing.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

This function permits you to configure one axis to automatically reproduce the motions of a master axis. In addition, by using a ratio of other than 1.0, the reproduced motion can be scaled as desired.

This function accepts any non-zero value for state as TRUE, and will work correctly with most programming languages, including those that define TRUE as a non-zero value other than one (one is the Windows default value for TRUE).

Compatibility

DC2 users should express ratio as a floating point value (i.e. 0.5 for 2:1, 2.0 for 1:2, etc.). MCEnableGearing( ) automatically converts this ratio to the 32 bit fixed point fraction the DC2 requires. The DCX-PC100 controller supports only a fixed ration of 1:1, the ratio parameter is ignored for this controller.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

SM, SS


MCEnableInterrupt

The MCEnableInterrupt( ) function enables or disables the status word interrupt feature on motion controllers that support interrupts. Users may elect to receive notification of interrupts via a message posted to a window message queue, or through a callback function.

long int MCEnableInterrupt(

HWND hWnd,	// window handle for notification messages

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

DWORD mask,	// selects status bits to use for interrupt

MCINTERRUPTPROC callback	// callback function pointer

);

// .NET

Mcapi.Error Mcapi.EnableInterrupt(

Int16 axis,

UInt32 mask,

Mcapi.InterrruptCallback callback

);

// .NET – not implemented

Parameter	Description

hWnd	Window handle to post notification messages to.

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to enable or disable interrupt notifications.

mask	Bits set in this variable select the corresponding bits in the main status word of the controller which will cause an interrupt if set. Setting Mask to zero disables interrupt notification for this axis.

callback	Pointer to a callback function (.NET delegate) to be used for interrupt notification, or null to indicate that a message should be posted to the window function instead..

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

Comment

This function permits you to configure an axis to notify your application program when any of the primary status word bits specified by Mask go true. If the callback function argument specifies a function the function will be called to notify the application of the status event. If the callback function argument is NULL then a message will be posted to the window specified by hWnd. Only the callback function method is supported under .NET as there is no concept of a message loop.

Use the windows function RegisterWindowsMessage( ) with the name "MCStatusNotify" to get the message identifier. Then test for this message value in your window procedure. The WPARAM of the message will include the controller handle in the low word and the Axis number in the high word. The LPARAM value of this message will contain the status value.

The callback function must have the following signature:

void CALLBACK MyIntProc(HWND hWnd, HCTRLR hCtlr, WORD wAxis, DWORD Status);

Where MyIntProc is any name you choose. If a windows handle was specified in the call to MCEnableInterrupt( ) that will be the first argument to the callback function, the second argument will be the controller handle, the third the axis number, and the forth a status word with bits set (true) for bits that have just transitioned from false to true and are selected by the Mask.

Only one notification window or callback function may be specified per axis per MCAPI handle at a time.

The callback function is called in the context of a background thread and it is generally not advised that the background thread not do any GUI updates. This is especially true for .NET applications.

Compatibility

Currently only the Multiflex PCI motion controller supports interrupts.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.3 or higher


MCEnableJog

The MCEnableJog( ) function enables or disables jogging for the axis specified by axis.

void MCEnableJog(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

short int state 	// enable state

);

// .NET

Mcapi.Error Mcapi.EnableJog(

Int16 axis,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to enable or disable jogging.

state	Specifies whether the jogging is to be enabled on or disabled.

Value	Description

TRUE	Enables jogging.

FALSE	Disables jogging.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The selected axis should be configured for jogging using the MCSetJogConfig( ) function before being enabled by this function.

This function accepts any non-zero value for state as TRUE, and will work correctly with most programming languages, including those that define TRUE as a non-zero value other than one (one is the Windows default value for TRUE).

Compatibility

Hardware jogging is not supported on the DCX-PCI controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

JF, JN

See Also

MCGetJogConfig( ), MCSetJogConfig( )


MCEnableSync

The MCEnableSync( ) function enables or disables synchronized motion for contour path motion for the specified axis.

void MCEnableSync(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

short int state	// enable state

);

// .NET

Mcapi.Error Mcapi.EnableSync(

Int16 axis,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to enable or disable synchronized motion.

state	Specifies whether the synchronized motion is to be enabled on or disabled.

Value	Description

TRUE	Enables synchronized motion.

FALSE	Disables synchronized motion.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is issued to the controlling axis of a contour path motion, prior to issuing any contour path motions, to inhibit any motion until a call to MCGoEx( ) is made.

It accepts any non-zero value for state as TRUE, and will work correctly with most programming languages, including those that define TRUE as a non-zero value other than one (one is the Windows default value for TRUE).

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

NS, SN

See Also

MCContourPath( ), MCGoEx( )


MCErrorNotify
MCErrorNotify  (1.2)

The MCErrorNotify( ) function registers with the MCAPI a specific window procedure that is to receive message based notification of API errors for this controller handle.

void MCErrorNotify(

HWND hWnd,	// error handling window procedure

HCTRLR hCtlr,	// controller handle

DWORD errormask 	// mask to select error category

);

// .NET – not implemented

Parameter	Description

hWnd	Handle of window procedure to receive error messages.

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

errormask	Selects error categories to be notified about. Any combination of the MCERRMASK_xxxx constants may be or’ed together to select errors to be reported. The constant MCERRMASK_STANDARD includes the most common error messages.

Comment

Only one window procedure at a time may receive error messages for a controller handle. If another window procedure attempts to hook the error messages for a handle that already has an error handler it will replace the current error handler. In practice this is not a problem as applications have control of the handle and can decide who to have hook the error notification mechanism.

The error notification message is a pre-agreed upon, inter-application message that goes by the name "MCErrorNotify". Application programs need to call the Windows function RegisterWindowMessage( ) with the message name “MCErrorNotify” to obtain the numeric value if the message. The error message will have a numeric error code as its wParam, and a pointer to a null-terminated ASCII string representation of the name of the function that caused the error as its lParam. The CWDemo sample application includes an example of hooking the error notification loop and processing error messages.

In the event of a bad controller handle passed to an API function as part of an API call, an error message will be broadcast to every windows procedure. This is done because with a bad handle there is no way for the API to identify which window procedure should receive the error. Rather than quietly tell no one, the API plays it safe and tells everyone.

The standard Windows message queue is small and may be over-run if error messages occur in rapid succession. During application development, when errors are most likely, you may want to call the Windows function SetMessageQueue( ) in your WinMain function to set the application queue to something larger than the default size of 8 messages.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.2 or higher

MCCL Reference

None

See Also

MCGetError( ), MCTranslateErrorEx( ), CWDemo sample code


MCFindAuxEncIdx
MCFindAuxEncIdx  (2.2)

The MCFindAuxEncIdx( ) function is used to initialize a motor's auxiliary encoder at a given position, relative to the auxiliary encoder index input.

long int MCFindAuxEncIdx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new position for index

);

// .NET

Mcapi.Error Mcapi.FindAuxEncIdx(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to search for the index signal.

position	The current position of the auxiliary encoder will be set to this position when the index signal is sensed. This parameter is ignored by current motion controller firmware.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to initialize a servo motor's auxiliary encoder at a given position. The function remains pending until the auxiliary encoder index input of the module goes active. At that time the auxiliary encoder position of the axis will be set to zero. This function does not cause any motion to be started or stopped.

The value of the position parameter is ignored by current motion controller firmware and this parameter should be set to zero.

Compatibility

Auxiliary encoder functions are not supported for MC100, MC110, MC150, and MC160 modules. Closed-loop steppers do not support auxiliary encoder functions since, in closed-loop mode, the attached encoder is considered to be the primary encoder.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

MCCL Reference

AF

See Also

MCBlockBegin( ), MCFindIndex( )


MCFindEdge
MCFindEdge  (2.0)

The MCFindEdge( ) function is used to initialize a stepper motor at a given position, relative to the coarse home input.

long int MCFindEdge(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new position for edge

);

// .NET

Mcapi.Error Mcapi.FindEdge(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to search for the edge signal.

position	The current position of the axis will be set to this position when the edge signal is sensed.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to initialize a stepper motor at a given position. The function remains pending until the home input of the module goes active. At that time the current position of the axis will be set to the value of the position parameter. This function does not cause any motion to be started or stopped. See the example code for details of how to use MCFindEdge( ).

Compatibility

Not supported for servo axes.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

FE

See Also

MCBlockBegin( ), MCEdgeArm( ), MCFindIndex( ), MCIsEdgeFound( ), MCWaitForEdge( )


MCFindIndex
MCFindIndex  (2.0)

The MCFindIndex( ) function is used to initialize a servo motor at a given position, relative to the index input.

long int MCFindIndex(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new position for index

);

// .NET

Mcapi.Error Mcapi.FindIndex(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to search for the index signal.

position	The position where the encoder index pulse occurred for the axis will be set to Position after a call to MCEnableAxis( ) .

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to initialize a servo motor at a given position. The function remains pending until the index input of the module goes active. At that time the current position of the axis will be set to the value of the position parameter. This function does not cause any motion to be started or stopped. See the example code for details of how to use MCFindIndex( ).

Compatibility

Open-loop steppers do not support this command since the connected encoder is considered an auxiliary encoder, not a primary encoder.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

FI

See Also

MCBlockBegin( ), MCFindEdge( ), MCWaitForEdge( )


MCGetAccelerationEx
MCGetAccelerationEx  (1.3)

MCGetAccelerationEx( ) returns the current programmed acceleration value for the given axis, in whatever units the axis is configured for.

long int MCGetAccelerationEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* accel 	// acceleration return value

);

// .NET

Mcapi.Error Mcapi.GetAccelerationEx(

Int16 axis,

ref Double accel

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query for acceleration.

accel	Pointer to a double precision floating point variable that will hold the acceleration for the specified axis (MCGetAccelerationEx( ) only).

Returns

The acceleration value is placed in the variable specified by the pointer accel and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by accel is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The acceleration value returned by this function is the same as the Acceleration field of the MCMOTIONEX structure returned by MCGetMotionConfigEx( ); MCGetAccelerationEx( ) provides a short-hand method for obtaining just the acceleration value.

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

None

See Also

MCSetAcceleration( ), MCGetMotionConfigEx( )


MCGetAnalogEx
MCGetAnalog

MCGetAnalogEx  (3.4)

MCGetAnalogEx( ) reads the current input state of the specified input channel.

WORD MCGetAnalog(

HCTRLR hCtlr,	// controller handle

WORD channel 	// channel number

);

long int MCGetAnalogEx(

HCTRLR hCtlr,	// controller handle

long int channel, 	// channel number

DWORD* value;	// analog value

);

// .NET

Mcapi.Error Mcapi.GetAnalogEx(

Int32 channel,

ref UInt32 value;

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Analog channel number to read from.

value	pointer to a variable that will contain the analog reading when MCGetAnalogEx( ) returns.

Returns

MCGetAnalog( ) returns the current A/D reading for channel. For MCGetAnalogEx( ) the analog channel reading is placed in the variable specified by the pointer value and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by value is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

PMC motion controllers typically include four undedicated analog input channels. On older controllers these inputs are 8-bit, the newer Multiflex series of controllers is typically configured with 14-bit inputs. By default these channels are assigned channel numbers 1 to 4.

Additional analog input/output channels supplied by MC500 modules will occupy sequential channel numbers beginning with channel 5. The fields AnalogInput and AnalogOutput in the MCPARAMEX structure contain the number of input and output channels the controller is configured for.

MCGetAnalogEx( ) should be used for new designs.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher (3.4 or higher for MCGetAnalogEx( ))

MCCL Reference

TA

See Also

MCSetAnalogEx( ), MCPARAMEX structure definition


MCGetAuxEncIdxEx
MCGetAuxEncIdxEx  (1.3)

For Win32 this function returns the position where the auxiliary encoder's index pulse was observed.

long int MCGetAuxEncIdxEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* index	// index position return value

);

// .NET

Mcapi.Error Mcapi.GetAuxEncIdxEx(

Int16 axis,

ref Double index

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

index	Pointer to a double precision floating point variable that will hold the auxiliary encoder index position for the specified axis.

Returns

The auxiliary encoder index position is placed in the variable specified by the pointer pIndex and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by index is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The auxiliary encoder's position may be set (to zero) using the MCSetAuxEncPos( ) function. The index position reported will be relative to this zero position.

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Compatibility

Auxiliary encoder functions are not supported for MC100, MC110, MC150, and MC160 modules. Closed-loop steppers do not support auxiliary encoder functions since, in closed-loop mode, the attached encoder is considered to be the primary encoder.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

AZ

See Also

MCGetAuxEncPosEx( ), MCSetAuxEncPos( )


MCGetAuxEncPosEx
MCGetAuxEncPosEx  (1.3)

For Win32 this function returns the current position of the auxiliary encoder.

long int MCGetAuxEncPosEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* position 	// position return value

);

// .NET

Mcapi.Error Mcapi.GetAuxEncPosEx(

Int16 axis,

ref Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

position	Pointer to a double precision floating point variable that will hold the auxiliary encoder position for the specified axis.

Returns

The auxiliary encoder position is placed in the variable specified by the pointer position and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by position is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The auxiliary encoder's position may be set using the MCSetAuxEncPos( ) function.

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Compatibility

Auxiliary encoder functions are not supported for MC100, MC110, MC150, and MC160 modules. Closed-loop steppers do not support auxiliary encoder functions since, in closed-loop mode, the attached encoder is considered to be the primary encoder.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

AT

See Also

MCGetAuxEncIdxEx( ), MCSetAuxEncPos ( )


MCGetAxisConfiguration
MCGetAxisConfiguration  (3.0)

MCGetAxisConfiguration( ) obtains the configuration for the specified axis. Configuration information includes the axis type, servo motor update rates, stepper motor step rates, etc.

long int MCGetAxisConfiguration(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCAXISCONFIG* axiscfg 	// axis configuration structure pointer

);

// .NET

Mcapi.Error Mcapi.GetAxisConfiguration(

Int16 axis,

ref Mcapi.AxisConfig axiscfg

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

axiscfg	Points to an MCAXISCONFIG structure that receives the configuration information.

Returns

For Win32 MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

This function allows the application to query the driver about installed motor axis hardware and capabilities.

Before you call MCGetAxisConfiguration( ) you must set the cbSize member to the size of the MCAXISCONFIG data structure. C/C++ programmers may use sizeof( ), Visual Basic programmers Len( ), and Delphi programmers SizeOf( ).

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.0 or higher

MCCL Reference

Dual Port RAM

See Also

MCAXISCONFIG structure definition


MCGetBreakpointEx
MCGetBreakpointEx  (1.3)

For Win32 this function returns the current breakpoint position as placed by the MCWaitForPosition( ) or MCWaitForRelative( ) command.

long int MCGetBreakpointEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* breakpoint 	// breakpoint position return value

);

// .NET

Mcapi.Error Mcapi.GetBreakpointEx(

Int16 axis,

ref Double breakpoint

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

breakpoint	Pointer to a double precision floating point variable that will hold the breakpoint position for the specified axis.

Returns

The breakpoint position is placed in the variable specified by the pointer breakpoint and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by breakpoint is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

TB

See Also

MCWaitForPosition( ), MCWaitForRelative( )


MCGetCaptureData
MCGetCaptureData  (1.3)

MCGetCaptureData( ) retrieves data collected following the most recent MCCaptureData( ) call.

long int MCGetCaptureData(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number to get capture data from

long int type,	// type of capture data to retrieve

long int start,	// index of starting point

long int points,	// number of data points to retrieve

double* data	// pointer to data array to for data

);

// .NET

Mcapi.Error Mcapi.GetCaptureData(

Int16 axis,

CaptureType type,

Int32 start,

Int32 points,

Double[] data

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

type	Specifies the type of data to retrieve:

Value	Description

MC_CAPTURE_ACTUAL	Retrieves the captured actual position data.

MC_CAPTURE_ERROR	Retrieves the following error (difference between actual and optimal positions).

MC_CAPTURE_OPTIMAL	Retrieves the captured optimal position data.

MC_CAPTURE_TORQUE	Retrieves the captured torque data.

MC_CAPTURE_AUXILIARY	Retrieves the captured auxiliary encoder data (MCAPI version 3.4 or later).

MC_CAPTURE_STATUS	Retrieves the captured status word data (MCAPI version 3.4 or later).

start	Index of the first data point to retrieve. The index is zero based, ie the first data point is 0, not 1.

points	Total number of data points to retrieve.

data	Pointer to a double precision floating point aarray large enough to hold requested capture data.

Returns

MCGetCaptureData( ) places one or more captured data values in the array specified by the pointer data and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and state of the array pointed to by data is undefined.

For .NET this function returns a Mcapi.Error error status.

Comment

Capture data settings (number of points, delay, etc.) are set with the MCCaptureData( ) function.

Beginning with version 3.0 of the MCAPI users may use the MCGetAxisConfiguration( ) function to determine the data capture capabilities of an axis.

Compatibility

Data capture is not supported on the DCX-PC controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

DO, DR, DQ

See Also

MCCaptureData( ), MCGetAxisConfiguration( )


MCGetConfiguration
MCGetConfigurationEx  (3.0)

MCGetConfigurationEx( ) obtains the configuration for the specified controller. Configuration information includes the controller type, number and type of installed motor modules, and if the controller supports scaling, contouring, etc.

short int MCGetConfiguration(

HCTRLR hCtlr,	// controller handle

MCPARAM* param 	// address of configuration structure

);

long int MCGetConfigurationEx(

HCTRLR hCtlr,

MCPARAMEX* paramex

);

// .NET

Mcapi.Error Mcapi.GetConfigurationEx(

ref Mcapi.ParamEx paramex

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

param	Points to an MCPARAM structure that receives the configuration information for hCtlr (MCGetConfiguration( ) only).

paramex	Points to an MCPARAMEX structure that receives the configuration information for hCtlr (MCGetConfigurationEx( ) only).

Returns

MCGetConfigurationEx( ) returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem. MCGetConfiguration( ) returns TRUE if the function is successful, otherwise it returns FALSE, indicating the function did not find the controller specified.

For .NET this function returns a Mcapi.Error error status.

Comment

This function allows the application to query the driver about installed controller hardware and capabilities. Included are the number and type of axes, digital and analog IO channels, scaling, and contouring.

New programs should use MCGetConfigurationEx( ).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

Dual Port RAM

See Also

MCPARAMEX structure definition


MCGetContourConfig

MCGetContourConfig( ) obtains the contouring configuration for the specified axis.

long int MCGetContourConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCCONTOUR* contour 	// structure to hold contour data

);

// .NET

Mcapi.Error Mcapi.GetContourConfig(

Int16 axis,

ref Mcapi.Contour contour

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

contour	Points to an MCCONTOUR structure that receives the configuration information for axis.

Returns

For Win32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

For .NET this function returns a Mcapi.Error error status.

Comment

This function allows the application to query an axis about contouring configuration data.

You may not set the axis parameter to MC_ALL_AXES for this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCSetContourConfig( ), MCCONTOUR structure definition


MCGetContouringCount

MCGetContouringCount( ) obtains the current contour path motion that an axis is performing.

long int MCGetContouringCount(

HCTRLR hCtlr,	// controller handle

WORD axis 	// axis number

);

// .NET – see MCGetCount()

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

Returns

For Win32 the return value is the number of linear or user defined contour path motions that have been completed.

Comment

This function allows the application to determine in what area of a continuous path motion an axis is at any given time.

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatibility

Contouring is not supported for the DCX-PC or DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

MCCL Reference

TX

See Also

MCContourPath( ), MCGetContourConfig( ), MCSetContourConfig( ), MCCONTOUR structure definition


MCGetCount
MCGetCount  (3.1)

MCGetCount( ) retrieves various count values from the specified axis.

long int MCGetCount(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number to get data from

long int type,	// type of count to retrieve

long int* count 	// variable to hold count value

);

// .NET

Mcapi.Error Mcapi.GetCount(

Int16 axis,

Mcapi.CountType type,

ref Int32 count

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

type	Specifies the type of data to retrieve:

Value	Description

MC_COUNT_CAPTURE	Retrieves the number of  captured positions in high-speed capture mode.

MC_COUNT_COMPARE	Retrieves the number of successful comparisons in high-speed compare mode.

MC_COUNT_CONTOUR	Retrieves the index of the currently executing contour move in contouring mode.

MC_COUNT_FILTER	Retrieves the number of digital filter coefficients currently loaded.

MC_COUNT_FILTERMAX	Retrieves the maximum number of digital filter coefficients supported.

count	Variable to hold requested count value.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

MCGetCount( ) is a general purpose function for retrieving values related to high-speed capture mode, high-speed compare mode, contouring mode, and digital filter mode.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

CG, GC, TX


MCGetDecelerationEx
MCGetDecelerationEx  (1.3)

For Win32 this function returns the current programmed deceleration value for the given axis, in whatever units the axis is configured for.

long int MCGetDecelerationEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* decel 	// deceleration return value

);

// .NET

Mcapi.Error Mcapi.GetDecelerationEx(

Int16 axis,	// axis number

ref Double decel 	// deceleration return value

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

decel	Pointer to a double precision floating point variable that will hold the deceleration for the specified axis.

Returns

The deceleration is placed in the variable specified by the pointer decel and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by decel is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The deceleration value is the same as that reported by the MCGetMotionConfigEx( ) function, these functions provide a short-hand method for obtaining just the deceleration value.

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Compatibility

A separate value for deceleration is not supported by the MC100, MC110, MC150, or MC160 modules (deceleration is equal to acceleration).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCSetDeceleration( ), MCGetMotionConfigEx( )


MCGetDigitalFilter
MCGetDigitalFilter  (3.1)

MCGetGetDigitalFilter ( ) obtains the digital filter coefficients for the specified axis.

long int MCGetDigitalFilter(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* coeff,	// array to hold retrieved coefficients

long int num,	// number of coefficients to retrieve

long int* actual 	// number of valid coefficients retrieved

);

// .NET

Mcapi.Error Mcapi.GetDigitalFilter(

Int16 axis,

Double[] coeff,

Int32 num,

ref Int32 actual

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

coeff	array to hold retrieved coefficients, must be num elements long (or longer). If this pointer is NULL no coefficients are retrieved.

num	Number of coefficients to retrieve, cannot be larger than the maximum digital filter size supported by the controller.

actual	Points to long integer that will be set equal to the number of valid coefficients currently loaded for this axis. If this pointer is NULL no value is returned.

Returns

For Win32 MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

This function retrieves zero or more of the digital filter coefficients currently loaded in an axis. Optionally the actual number of loaded coefficients is also returned (this value is also available from MCGetCount( )).

Compatibility

Digital filtering is not supported on the DCX-PCI100, DCX-AT200, DCX-PC or the DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

GF

See Also

MCEnableDigitalFilter( ), MCGetCount( ), MCIsDigitalFilter( ), MCSetDigitalFilter( )


MCGetDigitalIO

The MCGetDigitalIO( ) function returns the current state of the specified digital I/O channel. Beginning with MCAPI version 4.0.0 MCGetDigitalIO( ) has been superseded by MCGetDigitalIOEx( ).

short int MCGetDigitalIO(

HCTRLR hCtlr,	// controller handle

WORD channel 	// channel number

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Digital channel number to get state of.

Returns

For Win32 the return value is TRUE if the channel is "on" or FALSE if the channel is "off".

Comment

This function will read the current state of both input and output digital I/O channels. Note that this function simply reports if the channel is "on" or "off"; depending upon how a channel has been configured "on" (and conversely "off") may represent either a high or a low voltage level.

The field DigitalIO in the MCPARAMEX structure contains the total number of digital I/O channels the controller is configured for.

NOTE: Under MCAPI the DC2-STN controller's input channels are numbered 1 - 8, and the output channels are numbered 9 - 16 (MCAPI requires that each channel have a unique channel number).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

MCCL Reference

TC

See Also

MCConfigureDigitalIO( ), MCEnableDigitalIO( ), MCGetDigitalIOConfig( ), MCPARAMEX structure definition


MCGetDigitalIOEx

The MCGetDigitalIOEx( ) function returns the current state of the specified digital I/O channel, or of all 32 digital channels at once.

int MCGetDigitalIOEx(

HCTRLR hCtlr,	// controller handle

WORD channel, 	// channel number

unsigned int state 	// channel number

);

// .NET

Mcapi.Error Mcapi.GetDigitalIOEx(

Int16 channel

Ref UInt32 state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Digital channel number to get state of. Set to zero (0) to return the state of all 32 digital I/O channels as a single 32-bit unsigned value, one bit per channel.

state	Upon return contains the state of the selected channel.

Returns

MCGetDigitalIOEx( ) places the state of the selected digital I/O channel in the paratemer state and MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

This function will read the current state of both input and output digital I/O channels. Note that this function simply reports if the channel is "on" or "off"; depending upon how a channel has been configured "on" (and conversely "off") may represent either a high or a low voltage level.

The field DigitalIO in the MCPARAMEX structure contains the total number of digital I/O channels the controller is configured for.

NOTE: Under MCAPI the DC2-STN controller's input channels are numbered 1 - 8, and the output channels are numbered 9 - 16 (MCAPI requires that each channel have a unique channel number).

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 4.0 or higher

MCCL Reference

TC

See Also

MCConfigureDigitalIO( ), MCEnableDigitalIO( ), MCGetDigitalIOConfig( ), MCPARAMEX structure definition


MCGetDigitalIOConfig
MCGetDigitalIOConfig  (2.1)

The MCGetDigitalIOConfig( ) function returns the current configuration (in / out / high / low) of the specified digital I/O channel.

long int MCGetDigitalIOConfig(

HCTRLR hCtlr, 	// controller handle

WORD channel,	// channel number

WORD* type 	// variable to hold the channel settings

);

// .NET

Mcapi.Error Mcapi.GetDigitalIOConfig(

Int16 channel,

ref DigitalIOType type

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Digital channel number to get configuration of.

type	Pointer to a variable to hold the current configuration settings of the specified channel. This variable will contain one or more of the following flags on return:

Value	Description

MC_DIO_INPUT	Channel configured for input.

MC_DIO_OUTPUT	Channel configured  for output.

MC_DIO_LOW	Channel configured for low true logic level.

MC_DIO_HIGH	Channel configured for high true logic level.

MC_DIO_LATCH	Input channel configured for latched operation.

MC_DIO_FIXED	Channel is a fixed input or output and cannot be changed using MCConfigureDigitalIO( ).

MC_DIO_LATCHABLE	Input channel is capable of latched operation.

MC_DIO_STEPPER	Input channel has been dedicated to driving a stepper motor (DC2-PC or DC2-STN).

Returns

The current configuration of the specified digital I/O channel is placed in the variable specified by the pointer type and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by type is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The configuration of the specified channel is returned as one or more of the MC_DIO_xxx constants OR'ed together. This value is identical to the value you would create to configure the channel using MCConfigureDigitalIO( ), with the exception of the MC_DIO_FIXED, MC_DIO_LATCHABLE, and MC_DIO_STEPPER which are read-only (i.e. MCGetDigitalIOConfig( ) only) parameters.

Currently none of the motion controllers supported by MCAPI allow you to read back the configuration of the digital I/O. To implement MCGetDigitalIOConfig( ) MCAPI "remembers" any changes made to the digital I/O using MCConfigureDigitalIO( ). When the MCAPI DLL is loaded into memory (at application run time), it assumes the default state power-on state for all the installed digital I/O. Therefore, this function is most useful within a single application, after you have explicitly configured each I/O channel.

The field DigitalIO in the MCPARAMEX structure contains the total number of digital I/O channels the controller is configured for.

NOTE: Under MCAPI the DC2-STN controller's input channels are numbered 1 - 8, and the output channels are numbered 9 - 16 (MCAPI requires that each channel have a unique channel number).

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.1 or higher

MCCL Reference

None

See Also

MCConfigureDigitalIO( ), MCEnableDigitalIO( ), MCPARAMEX structure definition


MCGetError
MCGetError  (1.2)

The MCGetError( ) function returns the most recent error code for hCtlr.

short int MCGetError(

HCTRLR hCtlr 	// controller handle

);

// .NET

Mcapi.Error Mcapi.GetError();

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

Returns

For Win32 the return value is a numeric error code (or MCERR_NOERROR if there is no error) for the most recent MCAPI function call detected for the specified controller handle.

For .NET this function returns a Mcapi.Error error status.

Comment

Errors are maintained on a per-handle basis, calls to MCGetError( ) only return errors that occurred during function calls that used the same handle.

A more flexible way to detect errors is to use the MCErrorNotify( ). This function delivers error messages directly to the window procedure of your choice.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.2 or higher

MCCL Reference

None

See Also

MCErrorNotify( ), MCTranslateErrorEx( )


MCGetFilterConfig

MCGetFilterConfig( ) obtains the current PID filter configuration block for the specified axis. This function has been superseded by MCGetFilterConfigEx( ), which should be used for new designs.

short int MCGetFilterConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCFILTER* filter 	// address of filter configuration structure

);

// .NET – see MCGetFilterConfigEx()

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

filter	Points to an MCFILTER structure that receives the PID filter configuration information for axis.

Returns

For Win32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

Comment

This function must be used to obtain the current PID filter settings for an axis.

You may not set the axis parameter to MC_ALL_AXES for this function.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

MCCL Reference

TD, TI, TL, Controller RAM Motor Tables

See Also

MCGetFilterConfigEx( ), MCSetFilterConfig( ), MCFILTER structure definition


MCGetFilterConfigEx

MCGetFilterConfigEx( ) obtains the current PID filter configuration for a servo motor or the closed-loop configuration for a stepper motor operating in closed-loop mode.

long int MCGetFilterConfigEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCFILTEREX* filter 	// address of filter configuration structure

);

// .NET

Mcapi.Error Mcapi.GetFilterConfigEx(

Int16 axis,

ref Mcapi.FilterEx filter

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

filter	Points to an MCFILTEREX structure that receives the PID filter configuration information for axis.

Returns

MCGetFilterConfigEx( ) places the PID filter settings in the structure specified by the pointer filter and MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

This function must be used to obtain the current PID filter configuration for a servo motor or the closed-loop configuration for a stepper motor operating in closed-loop mode.

Closed-loop stepper operation requires firmware version 2.1a or higher on the DCX-PCI300 and firmware version 2.5a or higher on the DCX-AT300.

You may not set the axis parameter to MC_ALL_AXES for this function.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

TG, TD, TI, TL, Controller RAM Motor Tables

See Also

MCSetFilterConfigEx( ), MCFILTEREX structure definition


MCGetFollowingError
MCGetFollowingError  (1.3)

MCGetFollowingError( ) returns the current following error (difference between the actual and the optimal positions) for the specified axis.

long int MCGetFollowingError(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* error 	// following error return value

);

Mcapi.Error Mcapi.GetFollowingError(

Int16 axis,

ref Double error

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

error	Points to a double precision variable that will hold the following error.

Returns

MCGetFollowingError( ) places the following error in the variable specified by the pointer error and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by error is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

TF

See Also

MCGetOptimalEx( ), MCGetPositionEx( )


MCGetGain
MCGetGain  (1.3)

MCGetGain( ) returns the current gain setting for the specified axis.

long int MCGetGain(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* gain 	// gain return value

);

// .NET

Mcapi.Error Mcapi.GetGain(

Int16 axis,

ref Double gain

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

gain	Points to a double precision variable that will hold the gain value.

Returns

MCGetGain( ) places the gain value in the variable specified by the pointer gain and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by gain is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The gain value is the same as that reported by the MCGetFilterConfigEx( ) function, this function provide a short-hand method for obtaining just the gain value.

You may not set the axis parameter to MC_ALL_AXES for this command.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

TG

See Also

MCGetFilterConfigEx( ), MCSetGain( )


MCGetIndexEx
MCGetIndexEx  (1.3)

For Win32 this function returns the position where the encoder index pulse was observed for the specified axis, in whatever units the axis is configured for.

long int MCGetIndexEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* index 	// index position return value

);

// .NET

Mcapi.Error Mcapi.GetIndexEx(

Int16 axis,

ref Double index

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

index	Pointer to a double precision floating point variable that will hold the index position for the specified axis.

Returns

The index position is placed in the variable specified by the pointer index and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by index is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

Controller resets and the MCSetPosition( ) function may be change the position reading of the primary encoder.

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

TZ

See Also

MCGetAuxEncIdxEx( ), MCSetPosition( )


MCGetInstalledModules
MCGetInstalledModules  (3.0)

MCGetInstalledModules( ) enumerates the types of modules installed on a motion controller.

long int MCGetInstalledModules(

HCTRLR hCtlr,	// controller handle

long int* modules,	// pointer to an array for controller type IDs

long int size	// size of Modules array

);

// .NET

Mcapi.Error Mcapi.GetInstalledModules(

Int32[] modules,

Int32 size

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

modules	Pointer to an array of long integers, filled with module types on return.

size	Size of Modules array (number of integers).

Returns

For Win32 MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comments

MCGetInstalledModules( ) fills the modules array with module type identifiers, where the type of module installed in position #1 on the controller is stored in modules [0], the type of module installed in position #2 on the controller is stored in modules [1], etc. In order to list all installed controllers the array must have a size at least equal to the value in the MaximumModules field of the MCPARAMEX( ) data structure.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.0 or higher

See Also

MCGetConfigurationEx( )


MCGetJogConfig

MCGetJogConfig( ) obtains the current jog configuration block for the specified axis.

short int MCGetJogConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCJOG* jog 	// address of jog configuration structure

);

// .NET

Mcapi.Error Mcapi.GetJogConfig(

Int16 axis,

ref Mcapi.Jog jog

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

jog	Points to an MCJOG structure that receives jog configuration information for axis.

Returns

For Win32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

For .NET this function returns a Mcapi.Error error status.

Comment

This function must be used to obtain current jog configuration information for an axis.

You may not set the axis parameter to MC_ALL_AXES for this function.

Compatibility

Hardware jogging is not supported on the DCX-PCI controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCEnableJog( ), MCSetJogConfig( ), MCJOG structure definition


MCGetJogConfigEx
MCGetJogConfigEx  (4.1)

MCGetJogConfigEx( ) obtains the current jog configuration block for the specified axis.

long int MCGetJogConfigEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCJOGEX* jog 	// address of jog configuration structure

);

// .NET

Mcapi.Error Mcapi.GetJogConfigEx(

Int16 axis,

ref Mcapi.JogEx jog

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

jog	Points to an MCJOGEX structure that receives jog configuration information for axis.

Returns

For Win32 MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

This function must be used to obtain current jog configuration information for an axis.

You may not set the axis parameter to MC_ALL_AXES for this function.

Compatibility

Hardware jogging is not supported on the DCX-PCI controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 4.1 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCEnableJog( ), MCSetJogConfigEx( ), MCJOGEX structure definition


MCGetLimits
MCGetLimits  (1.3)

MCGetLimits( ) obtains the current hard and soft limit settings for the specified axis.

long int MCGetLimits(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

short int* hardlimitmode,	// hard limit mode flags

short int* softlimitmode,	// soft limit mode flags

double* softlimitminus,	// soft low limit value

double* softlimitplus	// soft high limit value

);

// .NET

Mcapi.Error Mcapi.GetLimits(

Int16 axis,

ref LimitMode hardlimitmode,

ref LimitMode softlimitmode,

ref Double softlimitminus,

ref Double softlimitplus

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

hardlimitmode	Combination of limit mode flags for the hard limits. See description of softlimitmode for details.

softlimitmode	Combination of the following limit mode flags for the soft limits:

Value	Description

MC_LIMIT_PLUS	Enables the positive limit.

MC_LIMIT_MINUS	Enables the negative limit.

MC_LIMIT_BOTH	Enables both the positive and negative limits.

MC_LIMIT_OFF	Limit stopping mode is set to turn the motor off when a limit is tripped.

MC_LIMIT_ABRUPT	Limit stopping mode is set to abrupt (target position is set to current position and PID loop stops axis as quickly as possible).

MC_LIMIT_SMOOTH	Limit stopping mode is set to smooth (axis executes pre-programmed deceleration when limit is tripped).

MC_LIMIT_INVERT	Inverts the polarity of the hardware limit switch inputs. This value may not be used with soft limits.

softlimitminus	Pointer to a variable where the negative limit value for soft limits, if supported by this controller, will be stored.

softlimitplus	Pointer to a variable where the positive limit value for soft limits, if supported by this controller, will be stored.

Returns

MCGetLimits( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned, and the variables pointed to by the function pointers should will be left in an undetermined state.

For .NET this function returns a Mcapi.Error error status.

Comment

The limit settings are the same as those reported by the MCGetMotionConfigEx( ) function, this function provide a short-hand method for obtaining just the limit settings.

Beginning with Version 2.23 of the Motion Control API you may pass a NULL pointer for hardlimitmode, softlimitmode, softlimitminus, or softlimitplus. This permits a program to easily ignore values it is not interested in. A program that needs to check the Hard Limit settings might set all the pointers for Soft Limit values to NULL to ignore those values, as opposed to having to create dummy variables to hold the values that will never be used. Because this feature is new in Version 2.23, only applications that do not require backward compatibility with an earlier MCAPI version should take advantage of it.

To determine if the controller supports soft limits check the SoftLimits field of the MCPARAMEX structure returned by MCGetConfigurationEx( ).

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatibility

Soft Limits are not supported by the DCX-PC or DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCGetMotionConfigEx( ), MCSetLimits( ), MCSetMotionConfigEx( )


MCGetModuleInputMode
MCGetModuleInputMode  (3.2)

MCGetModuleInputMode( ) returns the current input mode for the specified axis.

long int MCGetModuleInputMode(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int* mode	// input mode value

);

// .NET

Mcapi.Error Mcapi.GetModuleInputMode(

Int16 axis,

ref InputMode mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query for input mode.

mode	Pointer to a long integer variable that will hold the input mode for the specified axis:

Value	Description

MC_IM_OPENLOOP	stepper motor axis is in open-loop mode.

MC_IM_CLOSEDLOOP	stepper motor axis is in closed-loop mode.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned and the variable pointed to by mode is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatibility

Closed-loop stepper mode is only support for the MC360 stepper module on either the DCX-PCI300 or the DCX-AT300.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

See Also

MCSetModuleInputMode( )


MCGetModuleOutputMode
MCGetModuleOutputMode  (3.5)

MCGetModuleOutputMode( ) returns the current output mode for the specified axis.

long int MCGetModuleInputMode(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int* mode	// output mode value

);

// .NET

Mcapi.Error Mcapi.GetModuleInputMode(

Int16 axis,	// axis number

ref OutputMode mode	// output mode value

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query for output mode.

mode	Pointer to a long integer variable that will hold the output mode for the specified axis:

Value	Description

MC_OM_BIPOLAR	Servo axis set to bipolar operation.

MC_OM_UNIPOLAR	Servo axis set to unipolar operation.

MC_OM_BI_PWM	Servo axis set to bipolar PWM operation.

MC_OM_UNI_PWM	Servo axis set to unipolar PWM operation.

MC_OM_PULSE_DIR	Stepper axis set to pulse and direction output.

MC_OM_CW_CCW	Stepper axis set to clockwise and counter-clockwise operation.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned and the variable pointed to by mode is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatibility

This function is only supported for the MultiFlex family of motion controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.5 or higher

See Also

MCSetModuleOutputMode( )


MCGetMotionConfig

MCGetMotionConfig( ) obtains the current motion configuration block for the specified axis. This function has been superseded by MCGetMotionConfigEx( ), which should be used for new designs.

short int MCGetMotionConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCMOTION* motion 	// motion configuration structure pointer

);

// .NET – see MCGetMotionConfigEx()

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

motion	Points to an MCMOTION structure that receives motion configuration information for axis.

Returns

For Win32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

Comment

This function provides a way of initializing a MCMOTION structure with the current motion parameters for the given axis. When you need to setup many of the parameters for an axis it is easier to call MCGetMotionConfig( ), update the MCMOTION structure, and write the changes back using MCSetMotionConfig( ), rather than use a Get/Set function call for each parameter.

Note that some less often used parameters will only be accessible from this function and from MCSetMotionConfig( ) - they do not have individual Get/Set functions.

You may not set the axis parameter to MC_ALL_AXES for this command.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

MCCL Reference

TG, Controller RAM Motor Tables

See Also

MCGetMotionConfigEx( ), MCSetMotionConfig( ), MCMOTION structure definition


MCGetMotionConfigEx

MCGetMotionConfigEx( ) obtains the current motion configuration for the specified axis.

long int MCGetMotionConfigEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCMOTIONEX* motion 	// motion configuration structure pointer

);

// .NET

Mcapi.Error Mcapi.GetMotionConfigEx(

Int16 axis,

ref Mcapi.MotionEx motion

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

motion	Points to an MCMOTIONEX structure that receives motion configuration information for axis.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or one of the MCERR_xxxx error codes if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

This function provides a way of initializing a MCMOTIONEX structure with the current motion parameters for the given axis. When you need to setup many of the parameters for an axis it is easier to call MCGetMotionConfigEx( ), update the MCMOTIONEX structure, and write the changes back using MCSetMotionConfigEx( ), rather than use a Get/Set function call for each parameter.

Note that some less often used parameters will only be accessible from this function and from MCSetMotionConfigEx( ) - they do not have individual Get/Set functions.

You may not set the axis parameter to MC_ALL_AXES for this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCSetMotionConfigEx( ), MCMOTIONEX structure definition


MCGetOperatingMode
MCGetOperatingMode  (3.2)

MCGetOperatingMode( ) returns the current operating (position, velocity, gain, torque, etc.) mode for the specified axis.

long int MCGetOperatingMode(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int* mode	// operating mode value

);

// .NET
Mcapi.Error Mcapi.GetOperatingMode(

Int16 axis,

ref OperatingMode mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

mode	Pointer to a long integer variable that will hold the operating mode for the specified axis:

Value	Description

MC_MODE_CONTOUR	contouring mode operation.

MC_MODE_GAIN	gain mode operation.

MC_MODE_POSITION	position mode operation.

MC_MODE_TORQUE	torque mode operation.

MC_MODE_UNKNOWN	unable to determine current mode of operation.

MC_MODE_VELOCITY	velocity mode operation.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned and the variable pointed to by mode is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command. Not all controllers fully support the read-back of the current operating mode. If MCGetOperatingMode( ) is unable to determine the current mode it will return with the Mode argument set to MC_MODE_UNKNOWN.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

See Also

MCSetOperatingMode( )


MCGetOptimalEx
MCGetOptimalEx  (1.3)

For Win32 this function returns the current optimal position from the trajectory generator for the specified axis, in whatever units the axis is configured for.

long int MCGetOptimalEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* optimal 	// optimal return value

);

// .NET

Mcapi.Error Mcapi.GetOptimalEx(

Int16 axis,

ref Double optimal

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

optimal	Pointer to a double precision floating point variable that will hold the optimal position for the specified axis.

Returns

The optimal position is placed in the variable specified by the pointer optimal and a zero is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by optimal is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The trajectory generator generates an optimal position based upon an ideal (i.e. error free) motor. The PID loop then compares the actual position to the optimal position to calculate a correction to the actual trajectory. The maximum difference allowed between the optimal and actual positions is set with the FollowingError member of an MCFILTEREX structure.

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

TO

See Also

MCGetFilterConfigEx( ), MCSetFilterConfigEx( ), MCSetPosition( )


MCGetPositionEx
MCGetPositionEx  (1.3)

For Win32 this function returns the current position for the specified axis, in whatever units the axis is configured for.

long int MCGetPositionEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* position 	// position return value

);

// .NET

Mcapi.Error Mcapi.GetPositionEx(

Int16 axis,

ref Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

position	Pointer to a double precision floating point variable that will hold the position for the specified axis (MCGetPositionEx( ) only).

Returns

The position value is placed in the variable specified by the pointer position and a zero is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by position is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

TP

See Also

MCSetPosition( ), MCSetScale( )


MCGetProfile
MCGetProfile  (1.3)

MCGetProfile( ) returns the current acceleration / deceleration profile for the specified axis.

long int MCGetProfile(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD* profile 	// profile return value

);

Mcapi.Error Mcapi.GetProfile(

Int16 axis,

ref ProfileType profile

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

profile	Pointer to a WORD variable that will hold the profile for the specified axis:

Value	Description

MC_PROF_PARABOLIC	Indicates that a parabolic acceleration / deceleration profile has been selected.

MC_PROF_SCURVE	Indicates that an S-curve acceleration / deceleration profile has been selected.

MC_PROF_TRAPEZOID	Indicates that a trapezoidal acceleration / deceleration profile has been selected.

MC_PROF_UNKNOWN	This value is returned when MCGetProfile( ) cannot determine the current profile setting.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned and the variable pointed to by profile is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

To determine if the controller supports user configurable acceleration profiles check the CanChangeProfile field of the MCPARAMEX structure returned by MCGetConfigurationEx( ).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCSetProfile( ), MCPARAMEX structure definition


MCGetRegister
MCGetRegister  (2.0)

For Win32 this function returns the value of the specified general purpose register.

long int MCGetRegister(

HCTRLR hCtlr,	// controller handle

long int reg,	// register number

void* value,	// pointer to variable to hold register value

long int type 	// type of variable pointed to by pValue

);

// .NET (4 overloads)

Mcapi.Error Mcapi.GetRegister(

Int32 reg,

ref Int32 value

);

Mcapi.Error Mcapi.GetRegister(

Int32 reg,

ref Single value

);

Mcapi.Error Mcapi.GetRegister(

Int32 reg,

ref Double value

);

Mcapi.Error Mcapi.GetRegister(

Int32 reg,

void* value,

DataType type

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

reg	Register number to read from (0 to 255).

value	Pointer to a variable that will hold the register contents.

type	Type of data pointed to by value:

Value	Description

MC_TYPE_LONG	Indicates value points to a variable of type long integer.

MC_TYPE_DOUBLE	Indicates value points to a variable of type double precision floating point.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned and the variable pointed to by value is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

MCGetRegister( ) and MCSetRegister( ) allow you to read from and write to, respectively, the general purpose registers on the motion controller. When running background tasks on a multitasking controller the only way to communicate with the background tasks is to pass parameters in the general purpose registers.

You cannot read from the local registers (registers 0 - 9) of a background task. When you need to communicate with a background task you must be sure to use one or more of the global registers (10 - 255).

To determine if your controller supports multi-tasking check the MultiTasking field of the MCPARAM structure returned by MCGetConfiguration( ).

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

TR

See Also

MCSetRegister( )


MCGetScale

MCGetScale( ) obtains the current scaling factors for the specified axis.

short int MCGetScale(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCSCALE* scale 	// address of scale factors structure

);

// .NET

Mcapi.Error Mcapi.GetScale(

Int16 axis,

ref Mcapi.Scaling scale

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

scale	Pointer to a MCSCALE structure that will hold scaling information for axis.

Returns

For Win32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

For .NET this function returns a Mcapi.Error error status.

Comment

Scaling allows the application to communicate with the controller in real world units such as inches, meters, and radians; as opposed to low level (i.e. un-scaled) values such as raw encoder counts, etc.

In order to see if a controller supports scaling, an application can test the boolean flag CanDoScaling in the MCPARAMEX structure returned by MCGetConfiguration( ).

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatability

Scaling is not supported by the DCX-PC or the DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCGetConfiguration( ), MCSetScale( ), MCSCALE structure definition


MCGetServoOutputPhase
MCGetServoOutputPhase  (1.3)

For Win32 this function returns the current servo output phasing for the specified axis.

long int MCGetServoOutputPhase(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD* phase 	// phase return value

);

// .NET
Mcapi.Error Mcapi.GetServoOutputPhase(

Int16 axis,

ref Phase phase

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query for phase setting.

phase	Pointer to a WORD variable that will hold the phase setting for the specified axis:

Value	Description

MC_PHASE_STD	Indicates that the axis is configured for standard phasing.

MC_PHASE_REV	Indicates that the axis is configured for reverse phasing.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes and the variable pointed to by phase is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

None

See Also

MCSetServoOutputPhase( )


MCGetStatus

MCGetStatus( ) returns the controller dependent status word for the specified axis. This function has been superseded by MCGetStatusEx( ), which should be used for most new designs. One advantage of MCGetStatus( ) over MCGetStatusEx( ) is that it executes more quickly.

unsigned long int MCGetStatus(

HCTRLR hCtlr,	// controller handle

WORD axis 	// axis number

);

// .NET

UInt32 Mcapi.GetStatus(

Int16 axis 	// axis number

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

Returns

The return value is the 32-bit status word for the selected axis.

Comment

Please refer to the hardware manual for your controller for specific information about meaning and location of the flags located within the status word. As an alternative, the MCAPI function MCDecodeStatus( ) provides a controller-independent way to process the flags in the status word.

You may not set the axis parameter to MC_ALL_AXES for this command.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

TS

See Also

MCDecodeStatus( ), Controller hardware reference manual


MCGetStatusEx
MCGetStatusEx  (3.3)

MCGetStatusEx( ) returns the controller dependent status words for the specified axis.

long int MCGetStatus(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCSTATUSEX* status	// status words data structure

);

// .NET

Mcapi.Error Mcapi.GetStatus(

Int16 axis,

ref Mcapi.StatusEx status

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

status	Pointer to an MCSTATUSEX data structure that will hold the retrieved status words

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes.

For .NET this function returns a Mcapi.Error error status.

Comment

With the introduction of the MultiFlex PCI series of motion controllers it became necessary to reorganize the controller status words. The new status word interrupt feature allows the application to receive an asynchronous notification when any of the bits in the primary status word go true. Thus it was important that the primary status word of the MultiFlex PCI controllers contain the critical status information that an application might want to be notified of. As a result some commonly used but non-critical status bits were moved to other status words. The new functions MCDecodeStatusEx( ) and MCGetStatusEx( ), together with the MCSTATUSEX data structure allow application programs to operate on all of these status words as though they were a single entity.

Please refer to the hardware manual for your controller for specific information about meaning and location of the flags located within the status words. As an alternative, the MCAPI function MCDecodeStatusEx( ) provides a controller-independent way to process the flags in the status word.

You may not set the axis parameter to MC_ALL_AXES for this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.3 or higher

MCCL Reference

TS

See Also

MCDecodeStatusEx( ), MCSTATUSEX structure, Controller hardware reference manual


MCGetTargetEx
MCGetTargetEx  (1.3)

For Win32 this function returns the move target position, as set by the most recent MCMoveAbsolute( ) or MCMoveRelative( ) function call, for the specified axis.

long int MCGetTargetEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* target 	// target position return value

);

// .NET

Mcapi.Error Mcapi.GetTargetEx(

Int16 axis,

ref Double target

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

target	Pointer to a double precision floating point variable that will hold the target position for the specified axis (MCGetTargetEx( ) only).

Returns

The target position value is placed in the variable specified by the pointer target and MCERR_NOERROR is returned if there were no errors, or if there was an error one of the MCERR_xxxx error codes is returned and the variable pointed to by target is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The API move functions MCMoveAbsolute( ) and MCMoveRelative( ) update the target position for an axis. The controller will then generate an optimal trajectory to the target position, and the PID loop will seek to minimize the error (difference between actual and optimal trajectories).

You may not set the axis parameter to MC_ALL_AXES for either of these functions.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

TT

See Also

MCMoveAbsolute( ), MCMoveRelative( )


MCGetTorque
MCGetTorque  (1.3)

MCGetTorque( ) returns the current torque setting for the specified axis.

long int MCGetTorque(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* torque 	// torque return value

);

// .NET

Mcapi.Error Mcapi.GetTorque(

Int16 axis,

ref Double torque

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

torque	Points to a double precision variable that will hold the torque.

Returns

MCGetTorque( ) places the torque setting in the variable specified by the pointer torque and a zero is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error and the variable pointed to by torque is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

TQ

See Also

MCGetMotionConfigEx( ), MCSetMotionConfigEx( ), MCSetTorque( ), MCMOTIONEX structure definition


MCGetTrajectoryRate
MCGetTrajectoryRate  (4.1)

MCGetTrajectoryRate( ) returns the current maximum trajectory rate setting.

long int MCGetTrajectoryRate(

HCTRLR hCtlr,	// controller handle

long int* rate	// trajectory rate value

);

// .NET

Mcapi.Error Mcapi.GetTrajectoryRate(

ref RateMode mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

mode	Pointer to an integer variable that will hold the trajectory rate for the specified axis:

Value	Description

MC_RATE_LOW	lowest maximum update rate selected.

MC_RATE_MEDIUM	mid-level maximum update rate selected.

MC_RATE_HIGH	highest maximum update rate selected.

MC_RATE_UNKNOWN	maximum update rate cannot be determined.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned and the variable pointed to by mode is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatibility

Only supported by the MultiFlex controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 4.1 or higher

See Also

MCSetTrajectoryRate( )


MCGetVectorVelocity
MCGetVectorVelocity  (2.0)

For Win32 this function returns the current vector velocity for the specified contouring mode axis, in whatever units the axis is configured for.

long int MCGetVectorVelocity(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* velocity 	// vector velocity return value

);

// .NET

Mcapi.Error Mcapi.GetVectorVelocity(

Int16 axis,

ref Double velocity

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

velocity	Pointer to a double precision floating point variable that will hold the vector velocity value for the specified axis.

Returns

The position value is placed in the variable specified by the pointer velocity and MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error and the variable pointed to by velocity is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The vector velocity value for a particular axis may also be obtained using MCGetContourConfig( ); MCGetVectorVelocity( ) provides a short-hand method for getting just the vector velocity value and is most useful when updating vector velocity settings on the fly.

You may not set the axis parameter to MC_ALL_AXES for this function.

Compatability

The DCX-PCI100 or DCX-PC controllers do not support vector velocity.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

None

See Also

MCGetContourConfig( ), MCSetVectorVelocity( )


MCGetVelocityActual
MCGetVelocityActual  (3.4)

For Win32 this function returns the current actual velocity for the specified axis, in whatever units the axis is configured for.

long int MCGetVelocityActual(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* velocity 	// velocity return value

);

// .NET

Mcapi.Error Mcapi.GetVelocityActual(

Int16 axis,

ref Double velocity

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

velocity	Pointer to a double precision floating point variable that will hold the actual velocity value for the specified axis.

Returns

The velocity value is placed in the variable specified by the pointer velocity and MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error and the variable pointed to by velocity is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

Most PMC controllers report the actual velocity value as the number of encoder counts for an axis during the most recent servo update period. See your motion controller's User's Manual for details.

You may not set the axis parameter to MC_ALL_AXES for this function.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.4 or higher

MCCL Reference

TV


MCGetVelocityEx
MCGetVelocityEx  (1.3)

For Win32 this function returns the current programmed velocity for the specified axis, in whatever units the axis is configured for.

long int MCGetVelocityEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* velocity 	// velocity return value

);

// .NET

Mcapi.Error Mcapi.GetVelocityEx(

Int16 axis,

ref Double velocity

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

velocity	Pointer to a double precision floating point variable that will hold the programmed velocity value for the specified axis.

Returns

The velocity value is placed in the variable specified by the pointer velocity and MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error and the variable pointed to by velocity is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The programmed velocity value for a particular axis may also be obtained using the MCGetMotionConfigEx( ) function; MCGetVelocityEx( ) provides a short-hand method for getting just the velocity value and is most useful when updating velocity settings on the fly in velocity mode.

You may not set the axis parameter to MC_ALL_AXES for this function.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCSetVelocity( ), MCSetMotionConfigEx( )


MCGetVelocityOverride
MCGetVelocityOverride  (3.5)

For Win32 this function returns the current velocity override for the specified axis.

long int MCGetVelocityOverride(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* override 	// velocity override value

);

// .NET

Mcapi.Error Mcapi.GetVelocityOverride(

Int16 axis,	// axis number

ref Double override 	// velocity override value

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

override	Pointer to a double precision floating point variable that will hold the velocity override value for the specified axis.

Returns

The velocity override value is placed in the variable specified by the pointer override and MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error and the variable pointed to by override is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

The programmed velocity value for a particular axis may also be obtained using the MCGetContourConfig( ) function; MCGetVelocityOverride( ) provides a short-hand method for getting just the velocity override value and is most useful when updating velocity override on the fly.

You may not set the axis parameter to MC_ALL_AXES for this function.

Compatibility

This function is not supported on the DCX-PCI100, DCX-PC100, DC2-PC, or DC2-STN controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.5 or higher

MCCL Reference

Controller RAM Motor Tables

See Also

MCGetContourConfig( ), MCSetVelocityOverride( ), MCSetContourConfig( )


MCGetVersion
MCGetVersion  (1.2)

The MCGetVersion( ) function returns version information about the Motion control API DLLs.

DWORD MCGetVersion(

HCTRLR hCtlr 	// controller handle

);

// .NET

UInt32 Mcapi.GetVersion();

Parameter	Description

hCtlr	Controller handle, selects which motion controller to obtain device driver version info from. May be NULL (if NULL MCGetVersion( ) version number info is returned for the MCAPI DLL only).

Returns

The return version number for the MCAPI DLL and, if hCtlr is not NULL, the version number for the interface driver in use for the controller. If hCtlr is NULL interface driver version info will be zero.

Comment

The DLL version number is contained in the low order word of the return value. The major version number is stored as the low order byte of this word, then release number is multiplied by 10, added to the revision number, and stored as the high order byte.

If the controller handle is not NULL, the version information for the interface driver that is associated with this controller will be placed in the high order word of the return value, using the same format as was used for the DLL version information.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.2 or higher

MCCL Reference

None


MCGoEx
MCGoEx  (2.1)

MCGoEx( ) initiates a motion when operating in velocity mode.

long int MCGoEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double param 	// optional argument for the GO command

);

// .NET

Mcapi.Error Mcapi.GoEx(

Int16 axis,

Double param

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to command.

param	Argument to the GO command.

Returns

MCGoEx( ) returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

The axis must be configured for velocity mode operation before issuing a MCGoEx( ) call. All axes may be instructed to move by setting the axis parameter to MC_ALL_AXES.

To enable cubic splining while in contour mode on the DCX-AT200 or DCX-AT300 use MCGoEx( ) with the value of param set to one (1.0). For all other uses param should be set to zero.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

GO

See Also

MCSetOperatingMode( ), MCStop( )


MCGoHome

MCGoHome( ) initiates a home motion for the specified axis.

void MCGoHome(

HCTRLR hCtlr,	// controller handle

WORD axis 	// axis number

);

// .NET

Mcapi.Error Mcapi.GoHome(

Int16 axis

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to command.

Returns

For Win32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The home or zero position is the position that was last set using the MCSetPosition( ) function call. This command effectively executes a MCMoveAbsolute( ) with a target position of 0.0. You may not use MC_ALL_AXES for the axis number with this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

GH

See Also

MCMoveAbsolute( ), MCSetPosition( )


MCIndexArm
MCIndexArm  (2.2)

MCIndexArm( ) arms the index capture function of a servo axis.

long int MCIndexArm(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new position for index

);

// .NET

Mcapi.Error Mcapi.IndexArm(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to search for the index signal.

position	The current position of the axis will be set to this position when the index signal is sensed.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to initialize a servo motor at a given position. The function remains pending until the index input of the module goes active. At that time you must call MCWaitForIndex( ) foir the current position of the axis to be set to the value of the position parameter. This function does not cause any motion to be started or stopped.

For stepper motors this function performs a similar function, using the home input signal in place of the index input signal.

Compatability

Index arm is not supported by the DC2 controllers. Open-loop steppers do not support this command since the connected encoder is considered an auxiliary encoder, not a primary encoder.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

MCCL Reference

IA

See Also

MCFindIndex( ), MCWaitForIndex( )


MCInterruptOnPosition
MCInterruptOnPosition  (3.3)

MCInterruptOnPosition( ) enables the breakpoint flag of the controller status word.

long int MCInterruptOnPosition(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int mode,	// absolute / relative

double position 	// interrupt position

);

// .NET

Mcapi.Error Mcapi.InterruptOnPosition(

Int16 axis,

PositionType mode,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to specify interrupt for.

mode	Flag to indicate if the interrupt position is specified in absolute units or relative to the current position.

Value	Description

MC_ABSOLUTE	Interrupt position is specified in absolute units.

MC_RELATIVE	Interrupt position is specified relative to the current position of axis.

position	Absolute or relative interrupt position for axis.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function configures an axis to set the breakpoint reached bit in the status word when an absolute or relative position is reached. By enabling status word interrupts from the controller with MCEnableInterrupt( ) the application program can be interrupted whrn the specified position is reached.

Compatibility

This function is intended for use on the MFX-PCI1000 series of controllers due to their support for status word interrupts.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.3 higher

MCCL Reference

IP, IR

See Also

MCEnableInterrupt( )


MCIsAtTarget
MCIsAtTarget  (2.2)

MCIsAtTarget( ) waits for the "At Target" condition to go true for the specified axis. Use it to determine when motion has completed for an axis.

long int MCIsAtTarget(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double timeout 	// timeout, in seconds

);

// .NET

Boolean Mcapi.IsAtTarget(

Int16 axis,

Double timeout

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to wait for the "At Target" condition.

timeout	Time to wait, in seconds, for the At Target condition to go true.

Returns

This function returns TRUE if the axis is "At Target" or FALSE if the specified axis is not "At Target" by the end of timeout. If MC_ALL_AXES is specified for axis TRUE will be returned only if all axes are "At Target."

Comment

This function waits for up to timeout seconds for the At Target status of the axis to be TRUE. It returns as soon as the status goes TRUE or when timeout expires. Set timeout to zero to check the At Target status only once and return immediately (i.e. no wait is performed).

The "At Target" condition is met when the position count remains within the Deadband range for the amount of time specified by DeadbandDelay, more simply, when the system has settled.

Compatability

Only advanced controllers such as the DCX-PCI300 and the DCX-AT support the At Target status bit, for all others use MCIsStopped( ).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

MCCL Reference

TS

See Also

MCIsStopped( ), MCMOTIONEX structure definition


MCIsDigitalFilter
MCIsDigitalFilter  (3.1)

MCIsDigitalFilter( ) is used to determine the enabled state of the digital filter mode.

long int MCIsDigitalFilter(

HCTRLR hCtlr,	// controller handle

WORD axis	// axis number

);

// .NET

Boolean Mcapi.IsDigitalFilter(

Int16 axis

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to query.

Returns

This function returns TRUE if the digital filter for the specified axis is enabled or FALSE if the digital filter is disabled.

Comment

This function is used to determine the enabled state of the digital filter mode supported by advanced motion control modules, such as the MC300.

Compatability

Digital filtering is not supported on the DCX-PCI100, DCX-AT200, DCX-PC or DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

none

See Also

MCEnableDigitalFilter( ), MCGetCount( ), MCGetDigitalFilter( ), MCSetDigitalFilter( )


MCIsEdgeFound
MCIsEdgeFound  (3.2)

MCIsEdgeFound( ) waits for the "Edge Found" condition to go true for the specified axis. Use it to determine when an open-loop stepper motor homing sequence has detected the edge sensor.

long int MCIsEdgeFound(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double timeout 	// timeout, in seconds

);

// .NET

Boolean Mcapi.IsEdgeFound(

Int16 axis,

Double timeout

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to wait for the "Edge Found" condition.

timeout	Time to wait, in seconds, for the “Edge Found” condition to go true.

Returns

This function returns TRUE if the stepper axis has detected the edge input or FALSE if the axis has not detected the edge input by the end of timeout.

Comment

This function waits for up to timeout seconds for the Edge Found status of a stepper motor axis to go TRUE. It returns as soon as the status goes TRUE or when timeout expires. Set timeout to zero to check the edge found status only once and return immediately (i.e. no wait is performed). This function uses MCDecodeStatus( ) internally to test the MC_STAT_EDGE_FOUND status bit.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

TS

See Also

MCDecodeStatus( ), MCEdgeArm( ), MCWaitForEdge( )


MCIsIndexFound
MCIsIndexFound  (3.2)

MCIsIndexFound( ) waits for the "Index Found" condition to go true for the specified axis. Use it to determine when a servo motor homing sequence has detected the encoder index.

long int MCIsIndexFound(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double timeout 	// timeout, in seconds

);

// .NET

Boolean Mcapi.IsIndexFound(

Int16 axis,

Double timeout

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to wait for the "Index Found" condition.

timeout	Time to wait, in seconds, for the “Index Found” condition to go true.

Returns

This function returns TRUE if the servo axis has detected the encoder index or FALSE if the axis has not detected the encoder index by the end of timeout.

Comment

This function waits for up to timeout seconds for the Index Found status of a servo motor axis to go TRUE. It returns as soon as the status goes TRUE or when timeout expires. Set timeout to zero to check the encoder index status only once and return immediately (i.e. no wait is performed). This function uses MCDecodeStatus( ) internally to test the MC_STAT_INDEX_FOUND status bit.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

TS

See Also

MCDecodeStatus( ), MCIndexArm( ), MCWaitForIndex( )


MCIsStopped
MCIsStopped  (2.2)

MCIsStopped( ) waits for the "Trajectory Complete" condition to go true for the specified axis. Use it to determine when motion has completed for an axis.

long int MCIsStopped(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double timeout 	// timeout, in seconds

);

// .NET

Boolean Mcapi.IsStopped(

Int16 axis,

Double timeout

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to wait for the "Trajectory Complete" condition.

Timeout	Time to wait, in seconds, for the Trajectory Complete condition to go true.

Returns

This function returns TRUE if the axis is "Trajectory Complete" or FALSE if the specified axis is not "Trajectory Complete" by the end of timeout. If MC_ALL_AXES is specified for axis TRUE will be returned only if all axes are "Trajectory Complete."

Comment

This function waits for up to timeout seconds for the Trajectory Complete status of the axis to be TRUE. It returns as soon as the status goes TRUE or when timeout expires. Set timeout to zero to check the Trajectory Complete status only once and return immediately (i.e. no wait is performed).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

MCCL Reference

TS

See Also

MCIsAtTarget( )


MCLearnPoint

MCLearnPoint( ) stores the current actual position or target position for the specified axis in point memory at location specified by Index .

long int MCLearnPoint(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int index,	// point memory index

WORD mode 	// type of position to store

);

// .NET

Mcapi.Error Mcapi.LearnPoint(

Int16 axis,

Int32 index,

Learn type

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to store data for.

index	Storage location for point data.

mode	Determines if the actual position or the target position will be stored:

Value	Description

MC_LRN_POSITION	Learns the current actual position for the specified axis.

MC_LRN_TARGET	Learns the current target position for the specified axis.

Returns

For WIN32 MCLearnPoint( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

The actual position of an axis may be stored as it is moved; or, by disabling the axis, position commands may be issued to the axis, and the target positions stored, without actually moving the axis (see second example).

The number of points that may be stored will vary with the number of motor axes installed and the type of controller (see the compatibility section, below, for controller dependent limits). The first storage is location zero (not location 1).

The current position of all axes may be stored by setting the axis parameter to MC_ALL_AXES.

Compatibility

The number of points that can be stored is dependent on the controller type and in some cases on the number of installed axes:

Axes Installed

Controller	1	2	3	4	5	6	7	8

DCX-PCI300	256	256	256	256	256	256	256	256

DCX-PCI100	256	256	256	256	256	256	256	256

DCX-AT300	1536	768	512	384	307	256	n/a	n/a

DCX-AT200	1536	768	512	384	307	256	n/a	n/a

DCX-PC100	4096	2048	1365	1024	819	682	585	512

DC2-PC100	n/a	2048	n/a	n/a	n/a	n/a	n/a	n/a

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

LP, LT

See Also

MCMoveToPoint( )


MCMacroCall

MCMacroCall( ) causes a previously loaded macro to be executed.

void MCMacroCall(

HCTRLR hCtlr,	// controller handle

WORD macro 	// macro number

);

// .NET

void Mcapi.MacroCall(

Int16 macro

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

macro	Macro number to execute.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

Macros are normally downloaded using the pmcputs( ) ASCII interface command, using the DCX Motion  Control Command Language (MCCL); or by converting MCAPI functions to a macro with the MCBlockBegin( ) / MCBlockEnd( ) functions. These controller level macros are often the only efficient way to implement hardware specific sequences, such as special homing routines, initializing encoder positions, etc.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

MC

See Also

MCBlockBegin( ), MCBlockEnd( ), pmcputs( ), Controller hardware manual


MCMoveAbsolute

MCMoveAbsolute( ) initiates an absolute position-mode move for the specified axis.

void MCMoveAbsolute(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new absolute position

);

// .NET

Mcapi.Error Mcapi.MoveAbsolute(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to move.

position	Absolute position to move to.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The axis must be enabled prior to executing a move (an exception to this is when the MCMoveAbsolute( ) is used with MCLearnPoint( ) in target mode).

You may not set the axis parameter to MC_ALL_AXES for this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

MA

See Also

MCMoveRelative( ), MCSetPosition( )


MCMoveRelative

MCMoveRelative( ) initiates a relative position move for the specified axis or all axes.

void MCMoveRelative(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double distance 	// distance to move from current position

);

// .NET

Mcapi.Error Mcapi.MoveRelative(

Int16 axis,

Double distance

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to move.

distance	Amount of distance to move.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The axis must be enabled prior to executing a move (an exception to this is when the MCMoveRelative( ) is used with MCLearnPoint( ) in target mode).

You may not set the axis parameter to MC_ALL_AXES for this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

MR

See Also

MCMoveAbsolute( ), MCSetPosition( )


MCMoveToPoint

MCMoveToPoint( ) initiates an absolute move to a stored location for the specified axis or all axes.

long int MCMoveToPoint(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD index 	// index of point to move to

);

// .NET

Mcapi.Error Mcapi.MoveToPoint(

Int16 axis,

Int32 index

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to move.

index	Index of stored location to move to.

Returns

For Win32 MCMoveToPoint( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

The motor must be enabled prior to executing a MCMoveToPoint( ) and the point specified by index must have been stored by a previous call to MCLearnPoint( ). All axes may be instructed to move by setting the axis parameter to MC_ALL_AXES.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

MP

See Also

MCLearnPoint( )


MCOpen

MCOpen( ) returns a handle to a particular controller for use with subsequent API calls.

HCTRLR MCOpen(

short int nID,	// controller ID

WORD mode,	// open mode - ascii / binary

char* name 	// not used

);

// .NET

Mcapi.Error Mcapi.Open(

Int16 nID,

Mcapi.OpenMode mode,

String name

);

Parameter	Description

nID	Controller ID, selects the controller to open.

mode	I/O mode to open controller in:

Value	Description

MC_OPEN_ASCII	Open controller for ASCII (character) I/O.

MC_OPEN_BINARY	Open the binary command interface of the controller.

MC_OPEN_EXCLUSIVE	May be or'ed with MC_OPEN_ASCII or MC_OPEN_BINARY to request exclusive access to the controller.

name	Should be set to NULL for the present

Returns

For .NET this function returns a Mcapi.Error error status (the controller handle is maintained internally by the Mcapi object).

For WIN32 For Win32 this function returns handle to the specified controller for use in subsequent API calls. The handle will be greater than zero if the open call succeeds, or less than zero if there is an error. Standard error codes (see the file MCAPI.H) will be multiplied by -1 to make their values negative and returned in place of a handle if there is an error:

Value	Description

MCERR_ALLOC_MEM * (-1)	Unable to allocate memory for handle.

MCERR_CONSTANT * (-1)	The constant value supplied for Mode is invalid.

MCERR_INIT_DRIVER * (-1)	Unable to initialize device driver.

MCERR_MODE_UNAVAIL * (-1)	The requested mode (ASCII or binary) is unavailable. Typically due to the fact that another process has an open handle to the controller in the opposite mode.

MCERR_NO_CONTROLLER * (-1)	No controller is installed at this ID, run MCSETUP.

MCERR_NOT_PRESENT * (-1)	The specified controller hardware is missing or not responding.

MCERR_OPEN_EXCLUSIVE * (-1)	Unable to open controller for exclusive use - another process must already have an open handle to this controller.

MCERR_OUT_OF_HANDLES * (-1)	The driver is out of handles, try closing unused handles first.

MCERR_RANGE * (-1)	Specified nID is out of range.

MCERR_UNSUPPORTED_MODE * (-1)	The requested open mode (ASCII or binary) is not supported for this controller.

Comment

Always save the handle returned by MCOpen( ) and use that value in subsequent calls to the API. MCOpen( ) must be called before any other API calls are attempted. If a call is made to any other API function with a bad handle, a handle error message (MCERR_CONTROLLER) will be broadcast to all windows. Everyone is notified in the case of a bad handle because MCAPI normally uses the handle to route error messages, and obviously can't do this if the handle is invalid.

If it is necessary that no one else gains access to a controller while you are using it, you may combine the open mode with MC_OPEN_EXCLUSIVE:

if ((hCtlr = MCOpen( 7, MC_OPEN_ASCII | MC_OPEN_EXCLUSIVE, NULL )) > 0) {

// got an exclusive handle

}

will only return a valid handle if no other process has an open handle to this controller already, and will prevent any one else from opening the controller while the exclusive handle is open.

The name argument in the MCOpen( ) function call is for future enhancements to the API and should be set to NULL for the present.

If you are using an DCX-AT or DCX-PCI configured for multi-interface, you may open binary and ASCII handles simultaneously. Exclusive handles are interface based, not controller based, in this case (i.e. you may have one exclusive ASCII handle and one exclusive binary handle open at the same time).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

None

See Also

MCClose( ), MCErrorNotify( )


MCReopen
MCReopen  (1.3)

MCReopen( ) may be used to change the mode of an existing handle.

long int MCReopen(

HCTRLR hCtlr,	// controller handle

WORD newmode 	// new mode

);

// .NET

Mcapi.Error Mcapi.Reopen(

OpenMode newmode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

newmode	New mode flags

Value	Description

MC_OPEN_ASCII	Open controller for ASCII (character) I/O.

MC_OPEN_BINARY	Open the binary command interface of the controller.

MC_OPEN_EXCLUSIVE	May be combined with MC_OPEN_ASCII or MC_OPEN_BINARY using the binary or operator '|' to request exclusive access.

Returns

For WIN32 MCReopen( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

The most likely cause for failure is that another open handle exists for the same controller. MCReopen( ) cannot change a controller's open mode if there are multiple handles as there is no way to notify the owners of those other handles that a mode switch has occurred. If you plan on using this function in an application, it is suggested that you open the controller in exclusive mode to prevent any additional handles from being opened.

If you are using a MultiFlex, DCX-PCI, or DCX-AT controller the above restrictions do not apply.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

None

See Also

MCClose( ), MCOpen( )


MCRepeat
MCRepeat  (1.3)

MCRepeat( ) inserts a repeat command into a block command - task, compound command, or macro.

long int MCRepeat(

HCTRLR hCtlr,	// controller handle

long int count 	// repeat count

);

// .NET

Mcapi.Error Mcapi.Repeat(

Int32 count

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

count	Repeat count. Commands that precede the MCRepeat( ) in the block command will be repeated Count more times (for a total execution of count + 1).

Returns

For Win32 MCRepeat( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

This function may only be used within an MCBlockBegin( ) / MCBlockEnd( ) command pair.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

RP

See Also

MCBlockBegin( ), MCBlockEnd( )


MCReset

MCReset( ) performs a complete reset of the axis or controller, leaving the specified axis (or axes) in the disabled state.

void MCReset(

HCTRLR hCtlr,	// controller handle

WORD axis 	// axis number

);

// .NET

Mcapi.Error Mcapi.Reset(

Int16 axis

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to reset.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

Setting the axis parameter to MC_ALL_AXES will cause the specified controller to be reset.

Only the Multiflex, DCX-PCI300, DCX-AT200 controller (firmware version 1.2a or higher) and the DCX-AT300 controllers support the resetting of an individual axis. For all other controllers the axis parameter is ignored and a controller reset is performed whenever a MCReset( ) call is made.

If you have enabled the hardware reset feature of the DCX-AT, or DCX-PC100 controllers MCReset( ) will perform a hard reset when axis is equal to MC_ALL_AXES, or a soft reset when axis specifies a particular axis. If this feature is off (the default state), MCReset( ) issues the "RT' command to the board to perform any reset (this is a "soft" reset). On the DCX-AT200 and DCX-AT300 you must set jumper JP2 to connect pins 1 and 2 if Hard Reset is enabled, or connect pins 5 and 6 (factory default) if Hard Reset is disabled. On the DCX-PC100 you must set jumper JP4 to connect pins 1 and 2 if Hard Reset is enabled, or connect pins 5 and 6 (factory default) if Hard Reset is disabled. See the Motion Control Panel online help for how to enable the MCAPI Hardware Reset feature.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

RT

See Also

MCAbort( ), MCStop( )


MCSetAcceleration

The MCSetAcceleration( ) function sets programmed acceleration value for the selected axis to acceleration, where acceleration is specified in the current units for axis.

void MCSetAcceleration(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double acceleration 	// new acceleration rate

);

// .NET

Mcapi.Error Mcapi.SetAcceleration(

Int16 axis,

Double acceleration

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change acceleration value of.

acceleration	New acceleration rate.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The acceleration value for a particular axis may also be set using the MCSetMotionConfigEx( ) function; MCSetAcceleration( ) provides a short-hand method for setting just the acceleration value.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

SA

See Also

MCGetAccelerationEx( ), MCSetMotionConfigEx( )


MCSetAnalogEx
MCSetAnalog

MCSetAnalogEx  (3.4)

MCSetAnalogEx( ) sets the output level of an analog channel.

void MCSetAnalog(

HCTRLR hCtlr,	// controller handle

WORD channel,	// analog channel number

WORD value 	// value for analog channel

);

long int MCSetAnalogEx(

HCTRLR hCtlr,	// controller handle

long int channel,	// analog channel number

DWORD value 	// value for analog channel

);

// .NET

Mcapi.Error Mcapi.SetAnalogEx(

Int32 channel,

Uint32 value

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Analog ouput channel number to set.

value	New output value.

Returns

MCSetAnalog( ) does not return a value. MCSetAnalogEx( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

Analog output ports on MC500 and MC520 Analog Modules accept values in the range of 0 to 4095 counts (12 bits). This range of values corresponds to an output voltage of 0 to 5V or -10 to +10V, depending upon how the output is configured (see your controller's hardware manual). Each digital bit corresponds to a voltage level as follows:

Output Used	Volts per Count

0 to 5V	0.0012V

-10 to +10V	0.0049V

Analog outputs on the Multiflex family of controllers are a factory-installed option, your application program should check the analog output fields in the MCPARAMEX structure for details of how your controller was configured (voltage range, bits of resolution, number of channels).

MCSetAnalogEx( ) should be used for new designs.

Compatibility

Analog output channels are not supported by the DC2-PC100 dedicated 2 axis controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

OA

See Also

MCGetAnalogEx( ), MCPARAMEX structure definition


MCSetAuxEncPos

MCSetAuxEncPos( ) sets the current position of the auxiliary encoder.

void MCSetAuxEncPos(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new position

);

// .NET

Mcapi.Error Mcapi.SetAuxEncPos(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number of auxiliary encoder to set.

position	New encoder position.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

This command sets the current position of the auxiliary encoder to the value given by the position argument. A value of MC_ALL_AXES may be specified for axis to set the auxiliary encoders for all axes installed on a controller.

NOTE: DCX-AT200 firmware version 3.5a or higher, or DCX-PC100 firmware version 4.9a or higher is required if you wish to set the position of the auxiliary encoder to a value other than zero. Earlier firmware versions ignore the value in the position argument and zero the Auxiliary Encoder.

Compatibility

Auxiliary encoders are not supported on the MC100, MC110, and MC150 modules.  Closed-loop steppers do not support auxiliary encoder functions since, in closed-loop mode, the attached encoder is considered to be the primary encoder.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

AH

See Also

MCGetAuxEncPosEx( )


MCSetCommutation

MCSetCommutation( ) sets the commutation settings for the MC320 module.

long int MCSetCommutation(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCCOMMUTATION* commute 	// pointer to commutation structure

);

// .NET

Mcapi.Error Mcapi.SetCommutation(

Int16 axis,

ref Mcapi.Commutation commute

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number of which to set commutation information.

commute	Points to an MCCOMMUTATION structure that contains commutation settings for axis.

Returns

MCSetCommutation( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

See the section on commutation in your DCX-300 Series User’s Guide for details on how to set use the commutation features of the MC320 module.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

LA, LB, LD, LE, LR

See Also

MCCOMMUTATION structure definition


MCSetContourConfig

MCSetContourConfig( ) sets contouring configuration for the specified axis.

short int MCSetContourConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCCONTOUR* contour 	// pointer to contouring structure

);

// .NET

Mcapi.Error Mcapi.SetContourConfig(

Int16 axis,

ref Mcapi.Contour contour

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to set contouring configuration for.

contour	Points to an MCCONTOUR structure that contains contouring configuration information for axis.

Returns

For Win32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

For .NET this function returns a Mcapi.Error error status.

Comment

Contouring configuration data should be setup prior to executing any contour motion. The field CanDoContouring in the MCPARAMEX structure will be set to TRUE if the controller can process contour configuration data.

Compatability

Contouring is not supported on the DCX-PC or the DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

VA, VD, VO, VV

See Also

MCGetContourConfig( ), MCCONTOUR structure definition


MCSetDeceleration

The MCSetDeceleration( ) function sets programmed deceleration value for the selected axis to deceleration, where deceleration is specified in the current units for axis.

void MCSetDeceleration(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double deceleration 	// new deceleration rate

);

// .NET
Mcapi.Error Mcapit.SetDeceleration(

Int16 axis,

Double deceleration

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change deceleration value of.

deceleration	New deceleration rate.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The deceleration value for a particular axis may also be set using the MCSetMotionConfigEx( ) function; MCSetDeceleration( ) provides a short-hand method for setting just the deceleration value. A value of MC_ALL_AXES may be specified for axis to set the deceleration for all axes installed on a controller.

Compatability

A separate value for deceleration is not supported by the MC100, MC110, MC150, or MC160 modules (deceleration is the same as the setting for acceleration).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

DS

See Also

MCGetDecelerationEx( ), MCSetMotionConfigEx( )


MCSetDigitalFilter
MCSetDigitalFilter  (3.1)

MCSetDigitalFilter( ) sets the digital filter coefficients for the specified axis.

long int MCSetDigitalFilter(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double* coeff,	// array of digital filter coefficients

long int num	// number of coefficients

);

// .NET

Mcapi.Error Mcapi.SetDigitalFilter(

Int16 axis,	// axis number

Double[] coeff,	// array of digital filter coefficients

Int32 num	// number of coefficients

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number.

coeff	Array of coefficients, must be num elements long (or longer). If the pointer is NULL the filter will be zeroed (overwriting any previous settings) but no new filter values will be stored.

num	Number of coefficients to retrieve, cannot be larger than the maximum digital filter size supported by the controller.

Returns

MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

This sets zero or more of the digital filter coefficients for the specified axis. The number of coefficients cannot exceed the maximum value supported by the axis, as reported by MCGetCount( ). Calling MCSetDigitalFilter( ) overwrites any filter values previously downloaded to this axis.

Compatability

Digital filtering is not supported on the DCX-PCI100, DCX-AT200, DCX-PC, or the DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.1 or higher

MCCL Reference

FL, ZF

See Also

MCEnableDigitalFilter( ), MCGetCount( ), MCGetDigitalFilter( ), MCIsDigitalFilter( )


MCSetFilterConfig

MCSetFilterConfig( ) sets the PID loop for axis to the configuration pointed to by pFilter. This function has been superseded by MCSetFilterConfigEx( ), which should be used for new designs.

short int MCSetFilterConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCFILTER* filter 	// pointer to PID filter structure

);

// .NET – see MCSetFilterConfigEx()

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number from which to retrieve PID information.

filter	Points to a MCFILTER structure that contains PID filter configuration information for axis.

Returns

The return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

Comment

The easiest way to change filter settings is to first call MCGetFilterConfig( ) to obtain the current PID filter settings for axis, modify the values in the MCFILTER structure, and write the changed settings back to axis with MCSetFilterConfig( ).

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

MCCL Reference

AG, DG, FR, IL, SD, SE, SI, VG

See Also

MCGetFilterConfig( ), MCSetFilterConfigEx( ), MCFILTER structure definition


MCSetFilterConfigEx

MCSetFilterConfigEx( ) configures the PID loop settings for a servo motor or the closed-loop settings for a stepper motor operating in closed-loop mode.

long int MCSetFilterConfigEx(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCFILTEREX* filter 	// pointer to PID filter structure

);

// .NET

Mcapi.Error Mcapi.SetFilterConfigEx(

Int16 axis,

ref Mcapi.FilterEx filter

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number from which to retrieve PID information.

filter	Points to an MCFILTEREX structure that contains PID filter configuration information for axis.

Returns

MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

The easiest way to change filter settings is to first call MCGetFilterConfigEx( ) to obtain the current PID filter settings for axis, modify the values in the MCFILTEREX structure, and write the changed settings back to axis with MCSetFilterConfigEx( ).

Closed-loop stepper operation requires firmware version 2.1a or higher on the DCX-PCI300 and firmware version 2.5a or higher on the DCX-AT300.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

AG, DG, ES, FR, HS, IL, LS, MS, SD, SE, SG, SI, VG

See Also

MCGetFilterConfigEx( ), MCFILTEREX structure definition


MCSetGain
MCSetGain  (1.3)

The MCSetGain( ) function sets the proportional gain of a servo's feedback loop.

long int MCSetGain(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double gain 	// new gain setting

);

// .NET

Mcapi.Error Mcapi.SetGain(

Int16 axis,

Double gain

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change gain of.

gain	New proportional gain.

Returns

MCSetGain( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

The gain value for a particular axis may also be set using the MCSetFilterCongfigEx( ) function; MCSetGain( ) provides a short-hand method for setting just the gain value and for updating gain settings on the fly when operating in gain mode.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

SG

See Also

MCGetGain( ), MCSetFilterConfigEx( )


MCSetJogConfig

MCSetJogConfig( ) sets jog configuration for the specified axis.

short int MCSetJogConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCJOG* jog 	// address of jog configuration structure

);

// .NET

Mcapi.Error MCSetJogConfig(

Int16 axis,

ref Mcapi.Jog jog

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to set jog information.

jog	Points to a MCJOG structure that contains jog configuration information for axis.

Returns

For Win32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function did not find the axis specified (hCtlr or axis incorrect).

For .NET this function returns a Mcapi.Error error status.

Comment

It is important to set the jog configuration before enabling jogging if you will be using non-default parameters for the jog configuration.

Compatability

Hardware jogging is not supported on the DCX-PCI controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

JA, JB, JG, JO, JV

See Also

MCEnableJog( ), MCGetJogConfig( ), MCJOG structure definition


MCSetJogConfigEx
MCSetJogConfigEx  (4.1)

MCSetJogConfigEx( ) sets jog configuration for the specified axis.

long int MCSetJogConfig(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCJOGEX* jog 	// address of jog configuration structure

);

// .NET

Mcapi.Error MCSetJogConfig(

Int16 axis,

ref Mcapi.JogEx jog

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for which to set jog information.

jog	Points to a MCJOGEX structure that contains jog configuration information for axis.

Returns

MCSetJogConfigEx ( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

It is important to set the jog configuration before enabling jogging if you will be using non-default parameters for the jog configuration.

Compatability

Hardware jogging is not supported on the DCX-PCI controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 4.1 or higher

MCCL Reference

JA, JB, JG, JO, JV

See Also

MCEnableJog( ), MCGetJogConfigEx( ), MCJOGEX structure definition


MCSetLimits
MCSetLimits  (1.3)

MCSetLimits( ) sets the current hard and soft limit settings for the specified axis.

long int MCSetLimits(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

short int hardlimitmode,	// hard limit mode flags

short int softlimitmode,	// soft limit mode flags

double softlimitminus,	// soft negative limit value

double softlimitplus 	// soft positive limit value

);

// .NET

Mcapi.Error MCSetLimits(

Int16 axis,

LimitMode hardlimitmode,

LimitMode softlimitmode,

Double softlimitminus,

Double softlimitplus

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to set the limits of.

hardlimitmode	Combination of the following limit mode flags for the hard limits:

Value	Description

MC_LIMIT_PLUS	Enables the positive limit.

MC_LIMIT_MINUS	Enables the negative limit.

MC_LIMIT_BOTH	Enables both the positive and negative limits.

MC_LIMIT_OFF	Sets the limit stopping mode to turn the motor off when a limit is tripped.

MC_LIMIT_ABRUPT	Sets the limit stopping mode to abrupt (target position is set to current position and PID loop stops axis as quickly as possible).

MC_LIMIT_SMOOTH	Sets the limit stopping mode to smooth (axis executes pre-programmed deceleration when limit is tripped).

MC_LIMIT_INVERT	Inverts the polarity of the hardware limit switch inputs. This value may not be used with soft limits.

softlimitmode	Combination of limit mode flags for the soft limits. See the values for HardMode, above.

softlimitminus	Negative limit value for soft limits, if supported by this controller.

softlimitplus	Positive limit value for soft limits, if supported by this controller.

Returns

MCSetLimits( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned and the limit settings will be left in an undetermined state.

Comment

The limit settings are the same as those that may be set by the MCSetMotionConfigEx( ) function, this function provide a short-hand method for setting just the limit settings.

To disable limits (hard or soft) set the corresponding limit mode variable (hardlimitmode and softlimitmode) to zero (0). To disable a particular limit (plus or minus) DO NOT include its corresponding mode flag (MC_LIMIT_PLUS or MC_LIMIT_MINUS, respectively) in the combination of flags that make up the hardlimitmode and softlimitmode values.

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatibility

You cannot read the state of the MC_LIMIT_INVERT flag with MCGetLimits( ) on the DC2-PC controller. Soft limits are not supported by the DCX-PC or the DC2 controllers.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

HL, LF, LL, LM, LN

See Also

MCGetMotionConfigEx( ), MCGetLimits( ), MCSetMotionConfigEx( )


MCSetModuleInputMode
MCSetModuleInputMode  (3.2)

MCSetModuleInputMode( ) sets the current input mode for the specified axis.

long int MCSetModuleInputMode(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

long int mode	// input mode value

);

// .NET

Mcapi.Error Mcapi.SetModuleInputMode(

Int16 axis,

InputMode mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number of which to set input mode.

mode	Input mode for the specified axis:

Value	Description

MC_IM_OPENLOOP	sets stepper motor axis to open-loop mode.

MC_IM_CLOSEDLOOP	sets stepper motor axis to closed-loop mode.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

You must place a stepper motor in closed-loop mode with MCSetModuleInputMode( ) before you can issue the closed loop settings with MCSetFilterConfigEx( ). A stepper motor axis in open loop mode will ignore the MCSetFilterConfigEx( ) settings. After you set the module input mode with this function you must call MCEnableAxis( ) twice, the first time with the state parameter set to FALSE and the second time with the state parameter set to TRUE in order to “set” the mode.

You may not set the axis parameter to MC_ALL_AXES for this command.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

Compatibility

Closed-loop stepper mode is only support for the MC360 stepper module on either the DCX-PCI300 or the DCX-AT300.

See Also

MCGetModuleInputMode( ), MCSetFilterConfigEx( )


MCSetModuleOutputMode

The MCSetModuleOutputMode( ) function configures the output of the specified servo or stepper axis.

void MCSetModuleOutputMode(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD mode 	// output mode selection

);

// .NET

Mcapi.Error Mcapi.SetModuleOutputMode(

Int16 axis,

OutputMode mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to set output mode of.

mode	Output mode, one of the following constants:

Value	Description

MC_OM_BIPOLAR	Sets servo axis to bipolar operation.

MC_OM_UNIPOLAR	Sets servo axis  to unipolar operation.

MC_OM_BI_PWM	Sets servo axis to bipolar PWM operation.

MC_OM_UNI_PWM	Sets servo axis  to unipolar PWM operation.

MC_OM_PULSE_DIR	Sets stepper axis to pulse and direction output.

MC_OM_CW_CCW	Sets stepper axis to clockwise and counter-clockwise operation.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

Note that the function arguments will depend upon the type of axis being addressed - stepper or servo. Output phase settings are normally made at power up (before motors are energized) and then left unchanged. Incorrect settings can lead to unpredictable operation.

Example

Compatibility

The MC100, MC110, MC150, and MC160 modules do not support setting the output mode of the module.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

OM

See Also

MCGetServoOutputPhase( )


MCSetMotionConfig

MCSetMotionConfig( ) configures an axis for motion.

short int MCSetMotionConfig(

HCTRLR hCtlr,	// controller handle number

WORD axis,	// axis number

MCMOTION* motion 	// address of motion configuration structure

);

// .NET – see MCSetMotionConfigEx()

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to configure.

motion	Points to a MCMOTION structure that contains motion configuration information for the specified axis.

Returns

For WIN32 the return value is TRUE if the function is successful. Otherwise it is FALSE, indicating the function could not configure the axis.

Comments

This function provides a way of setting all motion parameters for a given axis with a single function call using an initialized MCMOTION structure. When you need to setup many of the parameters for an axis it is easier to call MCGetMotionConfig( ), update the MCMOTION structure, and write the changes back using MCSetMotionConfig( ), rather than use a Get/Set function call for each parameter.

Note that some less often used parameters will only be accessible from this function and from MCGetMotionConfig( ) - they do not have individual Get/Set functions.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

MCCL Reference

DB, DI, DT, FC, FF, FN, FR, HC, HS, LS, MS, MV, SA, SD, SF, SG, SH, SI, SQ, SV

See Also

MCGetMotionConfig( ), MCMOTION structure definition


MCSetMotionConfigEx
MCSetMotionConfigEx  (3.2)

MCSetMotionConfigEx( ) configures an axis for motion.

long int MCSetMotionConfigEx(

HCTRLR hCtlr,	// controller handle number

WORD axis,	// axis number

MCMOTIONEX* motion 	// address of motion configuration structure

);

// .NET

Mcapi.Error Mcapi.SetMotionConfigEx(

Int16 axis,

ref Mcapi.MotionEx motion

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to configure.

motion	Points to a MCMOTIONEX structure that contains motion configuration information for the specified axis.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comments

This function provides a way of setting all motion parameters for a given axis with a single function call using an initialized MCMOTIONEX structure. When you need to setup many of the parameters for an axis it is easier to call MCGetMotionConfigEx( ), update the MCMOTIONEX structure, and write the changes back using MCSetMotionConfigEx( ), rather than use a Get/Set function call for each parameter.

Note that some less often used parameters will only be accessible from this function and from MCGetMotionConfigEx( ) - they do not have individual Get/Set functions.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.2 or higher

MCCL Reference

DB, DI, DT, FC, FF, FN, FR, HC, MV, SA, SD, SF, SH, SI, SQ, SV

See Also

MCGetMotionConfigEx( ), MCMOTIONEX structure definition


MCSetOperatingMode

The MCSetOperatingMode( ) function sets the controller operating mode for axis.

void MCSetOperatingMode(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD master,	// master contouring axis number

WORD mode 	// new operating mode

);

// .NET

Mcapi.Error Mcapi.SetOperatingMode(

Int16 axis,

Int16 master,

OperatingMode mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to configure.

master	Contouring master axis (used for contour mode only).

mode	New operating mode, can be any of the following:

Value	Description

MC_MODE_CONTOUR	selects contouring mode (must also specify Master).

MC_MODE_GAIN	selects gain mode of operation.

MC_MODE_POSITION	selects the position mode of operation (default).

MC_MODE_TORQUE	selects torque mode operation.

MC_MODE_VELOCITY	selects the velocity mode.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to switch between the main operating modes of the controller. All controllers support all modes except MC_MODE_CONTOURMC_MODE_CONTOURValue. Programs can check the field CanDoContouring of the MCPARAMEX structure for the value TRUE to determine if a controller can operate in MC_MODE_CONTOUR mode.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

CM, GM, PM, QM, VM

See Also

Controller hardware manual


MCSetPosition

The MCSetPosition( ) function sets the current position for axis to Position.

void MCSetPosition(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// new position

);

// .NET

Mcapi.Error Mcapi.SetPosition(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change position of.

position	New position value.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The current position of axis will be immediately updated to the value of Position.

This function may be called with axis set to MC_ALL_AXES set the position of all axes at once. All axes will be set to the same value - position.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

DH

See Also

MCGetPositionEx( )


MCSetProfile

The MCSetProfile( ) function changes the acceleration profile for axis.

void MCSetProfile(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD mode 	// new profile

);

// .NET

Mcapi.Error Mcapi.SetProfile(

Int16 axis,

Profile mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change profile of.

mode	Constant value specifying profile:

Value	Description

MC_PROF_SCURVE	selects the S-curve profile.

MC_PROF_TRAPEZOID	selects trapezoidal profile.

MC_PROF_PARABOLIC	selects parabolic profile.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

Not all controllers can change their acceleration/deceleration profiles. The field CanChangeProfile in the MCPARAMEX data structure will be set to TRUE if the controller can change profiles.

This function may be called with axis set to MC_ALL_AXES to change the profile for all axes at once.

Example

Compatibility

User configurable acceleration profiles are not available on the DCX-PCI100, DCX-PC, and the DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

PP, PS, PT

See Also

MCGetConfiguration( ), MCPARAMEX structure definition


MCSetRegister
MCSetRegister  (2.0)

This function sets the value of the specified general purpose register.

long int MCSetRegister(

HCTRLR hCtlr,	// controller handle

long int reg,	// register number

void* value,	// pointer to variable with new register value

long int type 	// type of variable pointed to by value

);

// .NET (4 overloads)

Mcapi.Error Mcapi.SetRegister(

Int32 reg,

Int32 value,

);

Mcapi.Error Mcapi.SetRegister(

Int32 reg,

Single value,

);

Mcapi.Error Mcapi.SetRegister(

Int32 reg,

Double value,

);

Mcapi.Error Mcapi.SetRegister(

Int32 reg,

void* value,

DataType type

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

reg	Register number to read from (0 to 255).

value	Pointer to a variable that will has the new value for the register.

type	Type of data pointed to by value:

Value	Description

MC_TYPE_LONG	Indicates value points to a variable of type long integer.

MC_TYPE_DOUBLE	Indicates value points to a variable of type double precision floating point.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes.

For .NET this function returns a Mcapi.Error error status.

Comment

MCSetRegister( ) and MCGetRegister( ) allow you to write to and read from, respectively, the general purpose registers on the motion controller. When running background tasks on a multitasking controller the only way to communicate with the background tasks is to pass parameters in the general purpose registers.

You cannot write to the local registers (registers 0 - 9) of a background task. When you need to communicate with a background task you must use one or more of the global registers (10 - 255).

To determine if your controller supports multi-tasking check the MultiTasking field of the MCPARAMEX structure returned by MCGetConfigurationEx( ).

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 20 or higher

MCCL Reference

AL, AR

See Also

MCGetRegister( )


MCSetScale

The MCSetScale( ) function sets scaling for the specified axis to the values contained in the MCSCALE structure.

short int MCSetScale(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

MCSCALE* scale 	// updated scaling settings

);

// .NET

Mcapi.Error Mcapi.SetScale(

Int16 axis,

Mcapi.Scaling scale

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change scale of.

scale	Pointer to structure with new scale values.

Returns

For Win32 this function returns TRUE if the functions completes successfully or FALSE if there is an error (hCtlr or axis is invalid).

For .NET this function returns a Mcapi.Error error status.

Comment

Setting scaling factors allows application programs to talk to the controller in real world units, as opposed to arbitrary "encoder counts". You can determine if a controller can process scaling requests by testing the CanDoScaling flag in the MCPARAMEX structure for the controller.

NOTE: Always turn off (disable) the axis before calling MCSetScale( ), changing the scaling with the axis enabled can lead to unpredictable motor behavior. Scaling impacts an axis’ Velocity, Acceleration, Deceleration, Following Error, and Velocity Gain settings; you will probably need to change these parameters to reflect the new scale factors for an axis.

This function may be called with axis set to MC_ALL_AXES set the scaling of all axes at once. All axes will be set to the same value.

Example

Compatibility

Scaling is not supported on the DCX-PC and DC2 controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

UK, UO, UR, US, UT, UZ

See Also

MCGetConfiguration( ), MCGetScale( ), MCPARAMEX structure definition


MCSetServoOutputPhase

The MCSetServoOutputPhase( ) function sets the output phasing for the specified servo axis.

void MCSetServoOutputPhase(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

WORD phase 	// desired phasing

);

// .NET

Mcapi.Error Mcapi.SetServoOutputPhase(

Int16 axis,

Phase phase

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change servo phase of.

phase	Desired phasing, one of the following:

Value	Description

MC_PHASE_STD	selects standard or normal phasing (default).

MC_PHASE_REV	selects reverse phasing.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

This function may be called with axis set to MC_ALL_AXES set the phase of all axes at once. All axes will be set to the same value - Phase.

Example

Compatibility

Phase reverse is only implemented for the MC200 and MC300 Servo Modules.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

PH

See Also

MCGetServoOutputPhase( )


MCSetTimeoutEx
MCSetTimeoutEx  (1.3)

This function sets the MCAPI function timeout for a controller.

long int MCSetTimeoutEx(

HCTRLR hCtlr,	// controller handle

double timeout,	// new timeout value

double* oldtimeout 	// old timeout value

);

// .NET

Mcapi.Error Mcapi.SetTimeoutEx(

Double timeout,

ref Double oldtimeout

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

timeout	New timeout period, in seconds.

oldtimeout	Pointer to a double precision floating point variable that will hold the old timeout setting for the specified axis (MCSetTimeoutEx( ) only). If this pointer is NULL no value is returned.

Returns

For WIN32 the return value is the previous timeout setting for this controller for MCSetTimeout( ). For the MCSetTimeoutEx( ) version the previous timeout setting is placed in the variable specified by the pointer oldtimeout and MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error and the variable pointed to by oldtimeout is left unchanged. If the pointer oldtimeout is NULL, the old timeout value is not returned.

For .NET this function returns a Mcapi.Error error status.

Comment

The timeout period is the maximum amount of time, in seconds that the MCAPI device driver will wait to send a command and/or receive a reply. The default setting for timeout for all controllers is zero seconds. A timeout setting of zero will cause the controller to wait forever (i.e. no timeout) for I/O to complete.

Note that a timeout value that is acceptable for most functions may fail (i.e. timeout) if the controller is asked to perform a lengthy operation (a long wait, a reset, etc.). One option in these cases is to change the timeout value for the duration of the long operation, then change the timeout value back.

MCSetTimeout( ) is not available in 32-bit versions of the MCAPI (use MCSetTimeoutEx( ) instead).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

None


MCSetTorque
MCSetTorque  (1.3)

The MCSetTorque( ) function sets maximum output level for servos.

long int MCSetTorque(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double torque 	// new torque setting

);

// .NET

Mcapi.Error Mcapi.SetTorque(

Int16 axis,

Double torque

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change torque of.

torque	New torque.

Returns

For WIN32 MCSetTorque( ) returns the value MCERR_NOERROR if the function completed without errors. If there was an error one of the MCERR_xxxx error codes is returned.

For .NET this function returns a Mcapi.Error error status.

Comment

The torque value for a particular axis may also be set using the MCSetMotionConfigEx( ) function; MCSetTorque( ) provides a short-hand method for setting just the torque value and for updating torque settings on the fly when operating in torque mode.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.3 or higher

MCCL Reference

SQ

See Also

MCGetTorque( ), MCSetMotionConfigEx( )


MCSetTrajectoryRate
MCSetTrajectoryRate  (4.1)

MCSetTrajectoryRate( ) sets the current maximum trajectory rate setting.

long int MCSetTrajectoryRate(

HCTRLR hCtlr,	// controller handle

long int rate	// trajectory rate value

);

// .NET

Mcapi.Error Mcapi.GetTrajectoryRate(

RateMode mode

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

mode	Value to set maximum trajectory rate to:

Value	Description

MC_RATE_LOW	lowest maximum update rat.

MC_RATE_MEDIUM	mid-level maximum update rate.

MC_RATE_HIGH	highest maximum update rate.

Returns

For Win32 the return value is MCERR_NOERROR if no errors were detected, or if there was an error the return value is one of the MCERR_xxxx error codes is returned and the variable pointed to by mode is left unchanged.

For .NET this function returns a Mcapi.Error error status.

Comment

You may not set the axis parameter to MC_ALL_AXES for this command.

Compatibility

Only supported by the MultiFlex controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 4.1 or higher

See Also

MCGetTrajectoryRate( )


MCSetVectorVelocity
MCSetVectorVelocity  (2.0)

MCSetVectorVelocity( ) sets the vector velocity for the specified axis, in whatever units the axis is configured for.

long int MCSetVectorVelocity(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double velocity 	// new vector velocity value

);

// .NET

Mcapi.Error Mcapi.SetVectorVelocity(

Int16 axis,

Double velocity

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to set the vector velocity of.

velocity	New vector velocity value for the specified axis.

Returns

For WIN32 MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

The vector velocity value for a particular axis may also be set using MCSetContourConfig( ); MCSetVectorVelocity( ) provides a short-hand method for setting just the vector velocity value and is most useful when updating vector velocity settings on the fly.

Compatability

Vector velocity is not supported on the DCX-PCI100 or the DCX-PC controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

VV

See Also

MCGetVectorVelocity( ), MCSetContourConfig( )


MCSetVelocity

The MCSetVelocity( ) function sets programmed velocity for the selected axis, where velocity is specified in the current units for axis.

void MCSetVelocity(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double velocity 	// new velocity

);

// .NET

Mcapi.Error Mcapi.SetVelocity(

Int16 axis,

Double velocity

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to change velocity of.

velocity	New velocity.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The velocity value for a particular axis may also be set using the MCSetMotionConfigEx( ) function; MCSetVelocity( ) provides a short-hand method for setting just the velocity value and for updating velocity settings on the fly when operating in velocity mode.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

SV

See Also

MCGetVelocityEx( ), MCSetMotionConfigEx( )


MCSetVelocityOverride
MCSetVelocityOverride  (3.5)

MCSetVelocityOverride( ) sets the velocity override for the specified axis.

long int MCSetVelocityOverride(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double override 	// new velocity override value

);

// .NET

Mcapi.Error Mcapi.SetVelocityOverride(

Int16 axis,

Double override

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to set the vector velocity of.

override	New velocity override value for the specified axis.

Returns

For WIN32 MCERR_NOERROR is returned if there were no errors, or one of the MCERR_xxxx error codes is returned if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

The velocity override value for a particular axis may also be set using MCSetContourConfig( ); MCSetVelocityOverride( ) provides a short-hand method for setting just the vector velocity value and is most useful when updating velocity override settings on the fly.

Compatibility

This function is not supported on the DCX-PCI100, DCX-PC100, DC2-PC, or DC2-STN controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 3.5 or higher

MCCL Reference

VO

See Also

MCGetVelocityOverride( ), MCSetContourConfig( ), MCSetVelocityOverride( )


MCStop

The MCStop( ) function stops the specified axis or axes using the pre-programmed deceleration values.

void MCStop(

HCTRLR hCtlr,	// controller handle

WORD axis 	// axis number

);

// .NET

Mcapi.Error Mcapi.Stop(

Int16 axis 	// axis number

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to stop.

Returns

For WIN32 this function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

This function initiates a controlled axis stop, as compared with MCAbort( ) which stops the axis abruptly.

After this command has completed for a stepper motor (the motor has stopped) you should re-enable the motor using MCEnableAxis( ) in order for other commands to work correctly. No special handling is required for a servo motor.

Example

Compatibility

Following a call to MCStop( ), you should wait for the motor to stop and then re-initialize the axis using MCEnableAxis( ) before performing any further motions.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

ST

See Also

MCAbort( ), MCEnableAxis( )


MCTranslateErrorEx
MCTranslateErrorEx  (2.1)

The MCTranslateErrorEx( ) function translates numeric error codes into ASCII text messages.

long int MCTranslateErrorEx(

short int error,	// error code to translate

char* buffer,	// character buffer for message

long int size 	// length of Buffer, in bytes

);

// .NET

Mcapi.Error Mcapi.TranslateErrorEx(

Int32 error,

StringBuilder buffer,

Int32 size

);

Parameter	Description

error	Numeric error code to translate.

buffer	String buffer to hold ASCII error message

size	Length of string buffer (in bytes)

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

Beginning with version 2.1 of the MCAPI this function is included as a native MCAPI function (previously it was contained in a separate module). Incorporating MCTranslateErrorEx( ) into the MCAPI DLL will facilitate future updates, but has required changes from how It previously worked. The string buffer and buffer length have been added to the argument list. These changes make it possible to call MCTranslateErrorEx( ) from a much wider range of programming languages. It will work with error codes returned from MCGetError( ) and MCErrorNotify( ) error messages.

If you are using the native MCTranslateError( ) function from an earlier version of MCAPI you may continue to do so, but it is recommended that you migrate to the new version when possible.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.1 or higher

MCCL Reference

None

See Also

MCErrorNotify( ), MCGetError( )


MCWait

MCWait( ) causes the motion controller to wait the specified number of seconds before executing any additional MCAPI function calls.

void MCWait(

HCTRLR hCtlr,	// controller handle

double period 	// length of delay

);

// .NET

Mcapi.Error Mcapi.Wait(

Double period

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

period	Length of delay, in seconds.

Returns

This function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

The delay is specified in seconds, unless MCSetScale( ) has been called to change the time scale.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

WA

See Also

MCWaitForPosition( ), MCWaitForRelative( ), MCWaitForStop( ), MCWaitForTarget( )


MCWaitForDigitalIO

MCWaitForDigitalIO( ) waits for the specified digital I/O channel to go on or off, depending upon the value of State.

void MCWaitForDigitalIO(

HCTRLR hCtlr,	// controller handle

WORD channel,	// digital I/O channel to watch

short int state 	// state of channel to watch for

);

Mcapi.Error Mcapi.WaitForDigitalIO(

Int16 channel,

short int state 	// state of channel to watch for

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

channel	Digital channel number to wait for.

state	Selects state of channel to wait for:

Value	Description

TRUE	wait for channel to go "on"

FALSE	wait for channel to go "off"

Returns

This function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

Digital channels 1 to 16 are built into each controller. Additional digital channels, beginning with channel 17, may be added in blocks of 16 channels using MC400 Digital I/O Modules. The field DigitalIO in the MCPARAMEX structure contains the total number of digital channels installed on the controller.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

WF, WN

See Also

MCConfigureDigitalIO( ), MCEnableDigitalIO( ), MCGetDigitalIO( ), MCPARAMEX structure definition


MCWaitForEdge
MCWaitForEdge  (2.0)

MCWaitForEdge( ) waits for the coarse home input to go to the specified logic level.

long int MCWaitForEdge(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

short int state 	// selects logic level to wait for

);

// .NET

Mcapi.Error Mcapi.WaitForEdge(

Int16 axis,

Boolean state

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to wait for.

state	Selects the coarse home logic level to wait for:

Value	Description

TRUE	wait for coarse home to go active

FALSE	wait for coarse home to go inactive

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

For .NET this function returns a Mcapi.Error error status.

Comment

This function is used to initialize a motor at a given position. Instruction processing is paused until the coarse home input goes to the specified logic state. See the example code for details of how to use MCWaitForEdge( ).

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.0 or higher

MCCL Reference

WE

See Also

MCFindEdge( ), MCFindIndex( )


MCWaitForIndex
MCWaitForIndex  (3.2)

MCWaitForIndex( ) waits until the index pulse has been observed on a servo axis.

long int MCWaitForIndex(

HCTRLR hCtlr,	// controller handle

WORD axis	// axis number

);

// .NET

Mcapi.Error Mcapi.WaitForIndex(

Int16 axis	// axis number

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number to wait for index of.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was an error.

For .NET this function returns a Mcapi.Error error status.

Comment

Wait until the index pulse has been observed on a servo axis. This function should be used after a call to MCIndexArm( ), even if it is known that the index pulse has already occurred (this function performs internal operations). To complete the indexing function you must call MCEnableAxis( ) re-initialize the modules position registers.

Compatibility

Open-loop steppers do not support this command since the connected encoder is considered an auxiliary encoder, not a primary encoder.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

MCCL Reference

WI

See Also

MCEnableAxis( ), MCFindIndex( ), MCIndexArm( )


MCWaitForPosition

MCWaitForPosition( ) waits for the axis to reach the specified Position before allowing the next command to execute.

void MCWaitForPosition(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double position 	// position to wait for

);

// .NET

Mcapi.Error Mcapi.WaitForPosition(

Int16 axis,

Double position

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number we're to wait on for specified position.

position	Absolute position to wait for.

Returns

This function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

You must start the specified axis moving, and make certain the motion will at least reach the wait position, in order for this function to return to the calling program.

Compatibility

This function is valid only for MC200 / MC210 / MC300 / MC320 servo modules.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

WP

See Also

MCWait( ), MCWaitForRelative( ), MCWaitForStop( ), MCWaitForTarget( )


MCWaitForRelative

MCWaitForRelative( ) waits for the axis to reach a position that is specified relative to the target position.

void MCWaitForRelative(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double distance 	// relative position to wait for

);

// .NET

Mcapi.Error Mcapi.WaitForRelative(

Int16 axis,

Double distance

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number we're to wait on for specified position.

distance	Position, relative to the current target position, to wait for.

Returns

This function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

You must start the specified axis moving, and make certain the motion will at least reach the wait position, in order for this function to return to the calling program. The position argument is specified as a distance from the target position.

Compatibility

This function is valid only for MC200 / MC210 / MC300 / MC320 servo modules.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

WR

See Also

MCWait( ), MCWaitForPosition( ), MCWaitForStop( ), MCWaitForTarget( )


MCWaitForStop

MCWaitForStop( ) waits for the specified axis or all axes to come to a stop. An optional dwell after the stop may be specified within this command to allow the mechanical system to come to rest.

void MCWaitForStop(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double dwell 	// dwell time after stop

);

// .NET

Mcapi.Error Mcapi.WaitForStop(

Int16 axis,

Double dwell

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number we're waiting for to stop.

dwell	Delay time after stop has occurred.

Returns

This function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

MCWaitForStop is necessary for synchronizing motions, and for making certain that a prior motion has completed before beginning a new motion.

It is recommended that application programs use MCIsStopped( ) or MCIsAtTarget( ) instead of MCWaitForStop( ). MCWaitForStop( ) will prevent any MCAPI function calls made after MCWaitForStop( ) from executing until the motion completes.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

WS

See Also

MCIsAtTarget( ), MCIsStopped( ), MCWait( ), MCWaitForPosition( ), MCWaitForRelative( ), MCWaitForTarget( )


MCWaitForTarget

MCWaitForTarget( ) waits for the specified axis to reach its target position. An optional dwell after the stop may be specified within this command to allow the mechanical system to come to rest.

void MCWaitForTarget(

HCTRLR hCtlr,	// controller handle

WORD axis,	// axis number

double dwell 	// dwell time after stop

);

// .NET

Mcapi.Error Mcapi.WaitForTarget(

Int16 axis,

Double dwell

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number we're waiting for to reach the target position.

dwell	Delay time after stop has occurred.

Returns

This function does not return a value.

For .NET this function returns a Mcapi.Error error status.

Comment

For a servo axis to be considered "at target" it must remain within the Deadband region for the DeadbandDelay period. Deadband and DeadbandDelay are specified in the MCMOTIONEX configuration structure.

Compatibility

This function is not supported on the DCX-PC controllers.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

MCCL Reference

WT

See Also

MCGetMotionConfigEx( ), MCSetMotionConfigEx( ), MCWaitForPosition( ), MCWaitForRelative( ), MCWaitForStop( )


pmccmd

The pmccmd( ) function downloads a formatted binary command buffer directly to the PMC controller.  Programmers should use the more advanced pmccmdex( ) instead of this function when possible.

short int pmccmd(

HCTRLR hCtlr,	// controller handle

short int size,	// length of buffer

void* buffer 	// pointer to command buffer

);

// .NET – see pmccmdex()

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

size	Length of buffer, in bytes.

buffer	Pointer to command buffer.

Returns

The return value from this function is the actual number of bytes downloaded. Because of the nature of the binary interface, the return value will be equal to the buffer size (value of the size argument), indicating the command buffer was successfully downloaded, or zero, indicating a problem communicating with the controller.

Comment

The binary interface is described in detail in the hardware manual that accompanied your controller. The user of this function is responsible for correctly formatting the buffer - no checking is performed by the function. To send binary commands to the motion controller the hCtlr handle must have opened in binary mode.

This function may be used within an MCBlockBegin( ) / MCBlockEnd( ) pair to create Macros, Compound commands, or Tasks.

Example

Requirements

Header: include mcapi.h and mccl.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

See Also

pmcrdy( ), pmcrpy( )


pmccmdex
pmccmdex  (2.2)

The pmccmdex( ) function downloads a formatted binary command buffer directly to the PMC controller. Unlike pmccmd( ) this function handles the formatting of the command, axis number, and argument for the user, making this command much easier to use than pmccmd( ).

long int pmccmdex(

HCTRLR hCtlr,	// controller handle

WORD axis,	// Axis number for this command

WORD cmd,	// MCCL command

void* argument,	// pointer to command argument

long int type	// type of argument

);

// .NET (6 overloads)

Mcapi.Error Mcapi.pmccmdex(

Int16 axis,

Int16 cmd,

Int32 argument,

);

Mcapi.Error Mcapi.pmccmdex(

Int16 axis,

Int16 cmd,

Single argument,

);

Mcapi.Error Mcapi.pmccmdex(

Int16 axis,

Int16 cmd,

Double argument,

);

Mcapi.Error Mcapi.pmccmdex(

Int16 axis,

Int16 cmd,

String argument,

);

Mcapi.Error Mcapi.pmccmdex(

Int16 axis,

Int16 cmd,

);

Mcapi.Error Mcapi.pmccmdex(

Int16 axis,

Int16 cmd,

void* argument,

DataType type

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

axis	Axis number for this command.

cmd	MCCL command to execute - see MCCL.H and the User's Manual for your motion controller.

argument	Pointer to a variable that has the argument for this command.

type	Type of data pointed to by Argument:

Value	Description

MC_TYPE_LONG	Indicates argument points to a variable of type long integer.

MC_TYPE_FLOAT	Indicates argument points to a variable of type single precision floating point.

MC_TYPE_DOUBLE	Indicates argument points to a variable of type double precision floating point.

MC_TYPE_STRING	Indicates argument points to a null terminated string.

MC_TYPE_NONE	Indicates  there is no argument.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

Comment

The binary interface is described in detail in the hardware manual that accompanied your controller. Unlike pmccmd( ) this function handles the formatting of the command, axis number, and argument for the user, making this command much easier to use than pmccmd( ). To send binary commands to the motion controller the hCtlr handle must have opened in binary mode.

This function may be used within an MCBlockBegin( ) / MCBlockEnd( ) pair to create Macros, Compound commands, or Tasks. Command buffers are limited to 255 characters in length.

Example

Requirements

Header: include mcapi.h and mccl.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

See Also

pmccmd( ), pmcrdy( ), pmcrpyex( )


pmcgetc

The pmcgetc( ) function reads a single character from the controller ASCII interface.

short int pmcgetc(

HCTRLR hCtlr 	// controller handle

);

// .NET

Int16 Mcapi.pmcgetc();

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

Returns

The return value from this function is the character read from the controller, or zero if no character was available.

Comment

This function will return immediately if there is no character available. Use the string get command, pmcgets( ), if you want to wait for a character, or place pmcgetc( ) in a loop.

You must open the controller in ASCII mode (MC_OPEN_ASCII) in order to use this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

See Also

pmcgetc( ), pmcputc( ), pmcputs( )


pmcgetramex
pmcgetram

pmcgetramex  (3.4)

The pmcgetramex( ) function reads Bytes from controller memory beginning at location Offset.

long int pmcgetramex(

HCTRLR hCtlr,	// controller handle

DWORD offset,	// memory offset to read from

void* buffer,	// buffer to hold ram value

DWORD size	// number of bytes of memory to read

);

void pmcgetram(

HCTRLR hCtlr,

WORD offset,

void* buffer,

short int size

);

// .NET

Mcapi.Error Mcapi.pmcgetramex(

UInt32 offset,

Byte[] buffer,

UInt32 size

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

offset	Starting memory location, relative to the beginning of controller dual ported ram, to read from.

buffer	Buffer to hold read in controller memory, must be at least Bytes long.

size	Number of bytes of memory to read.

Returns

The function pmcgetram( ) does not return a value. For pmcgetramex( ) the return value will be MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

Comment

No range checking is performed on Offset or Bytes - it is the caller's responsibility to supply valid values for these arguments. Consult the controller hardware manual for details on the controller memory map. The extended version of this function supports 32-bit offsets and buffer sizes to better support PMC's newest motion controllers.

These functions use the mccl read commands to access data from the controllers viewpoint. The original version of pmcgetram, pmcgetram( ), applied an internal offset to the caller's offset parameter to make addresses seem more natural (e.g. 1000 hex was added to adresses on ISA-bus controllers so that the addresses matched the dual port ram as seen from the PC).  pmcgetramex( ) does not apply any offset.

Do not use this command within an MCBlockBegin( ) / MCBlockEnd( ) block.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher (version 3.4 or higher for pmcgetramex( ))

See Also

pmcputram( )


pmcgets

The pmcgets( ) function reads a null-terminated ASCII string of up to Bytes characters from the controller ASCII interface.

short int pmcgets(

HCTRLR hCtlr,	// controller handle

void* buffer,	// pointer to buffer

short int size 	// length of buffer

);

// .NET

Int32 Mcapi.pmcgets(

StringBuilder buffer,	// pointer to buffer

Int16 size 	// length of buffer

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

buffer	Pointer to reply buffer.

size	Length of Buffer, in bytes.

Returns

The return value from this function is number of bytes actually read from the controller.

Comment

This function will wait for a reply for as long as the controller is busy processing commands and will only return a zero when the controller is idle and there are no reply characters available unless the controller timeout has been set to a non-zero value. With a non-zero controller timeout the pmcgets( ) can also return with a partial string if the timeout period is exceeded while waiting for an entire line of characters.

You must open the controller in ASCII mode (MC_OPEN_ASCII) in order to use this command.

ASCII command strings are limited to 255 characters in length.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

See Also

pmcgetc( ), pmcputc( ), pmcputs( ), MCSetTimeoutEx( )


pmcputc

The pmcputc( ) function writes a single character to the controller ASCII interface.

short int pmcputc(

HCTRLR hCtlr,	// controller handle

short int character 	// output char

);

Int16 Mcapi.pmcputc(

Int16 character

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

character	character to output.

Returns

For Win32 this function returns a 1 if the character is successfully written, or a zero if it is unable to write to the controller.

Comment

Remember to terminate all command strings with a carriage return "\r" in order for the command to be executed. This command does not wait for the controller - if it is unable to write the character it returns immediately with a return value of zero.

You must open the controller in ASCII mode (MC_OPEN_ASCII) in order to use this command.

This function attempts to write immediately to the motion controller and may not be  used within an MCBlockBegin( ) / MCBlockEnd( ) pair.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

See Also

pmcgetc( ), pmcgets( ), pmcputs( )


pmcputramex
pmcputram

pmcputramex  (3.4)

The pmcputramex( ) function writes Bytes directly into the controller's memory beginning at location Offset.

long int pmcputramex(

HCTRLR hCtlr,	// controller handle

DWORD offset,	// memory offset to write to

void* buffer,	// buffer to hold ram value

DWORD size 	// number of bytes of memory to write

);

void pmcputram(

HCTRLR hCtlr,

WORD offset,

void* buffer,

short int size

);

// .NET

Mcapi.Error Mcapi.pmcputramex(

UInt32 offset,

Byte[] buffer,

UInt32 size

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

offset	Starting memory location, relative to the beginning of controller dual ported ram, to write to.

buffer	Buffer of data to write into controller memory.

size	Number of bytes of memory to write.

Returns

The function pmcputram( ) does not return a value. For pmcputramex( ) the return value will be MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

Comment

No range checking is performed on Offset or Bytes - it is the caller's responsibility to supply valid values for these arguments. Writing directly to dual ported ram can cause unpredictable results - USE THIS FUNCTION WITH EXTREME CAUTION!The extended version of this function supports 32-bit offsets and buffer sizes to better support PMC's newest motion controllers.

These functions use the mccl write commands to access data from the controllers viewpoint. The original version of pmcputram, pmcputram( ), applied an internal offset to the caller's offset parameter to make addresses seem more natural (e.g. 1000 hex was added to adresses on ISA-bus controllers so that the addresses matched the dual port ram as seen from the PC).  pmcputramex( ) does not apply any offset.

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher (version 3.4 or higher for pmcputramex( ))

See Also

pmcgetram( )


pmcputs

The pmcputs( ) function writes a NULL terminated command string to the controller ASCII interface.

short int pmcputs(

HCTRLR hCtlr,	// controller handle

char* buffer 	// output string

);

// .NET

Int16 Mcapi.pmcputs(

String buffer

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

buffer	Output string.

Returns

For Win32 this function returns the number of characters actually written to the controller. This number may be less than the length of the string if the controller becomes busy and stops accepting characters.

Comment

Remember to terminate all command strings with a carriage return "\r" in order for the command to be executed. This function consumes any reply characters from the controller while it is writing (this may change in future implementations).

You must open the controller in ASCII mode (MC_OPEN_ASCII) in order to use this command.

Most controllers cannot accept ASCII command strings longer than 255 characters in length.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

See Also

pmcgetc( ), pmcgets( ), pmcputs( )


pmcrdy

The pmcrdy( ) function checks the specified controller to see if it is ready to accept a binary command buffer.

short int pmcrdy(

HCTRLR hCtlr 	// controller handle

);

// .NET

Int16 Mcapi.pmcrdy();

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

Returns

The return value from this function is TRUE (+1) if the controller is ready to accept commands, and FALSE if it is busy. For the AT200 controller, a value of -1 is returned if the controller is ready to accept data in file download mode.

Comment

Basic language users are cautioned that Visual Basic defines TRUE as -1, while Windows defines TRUE to be +1 (the API uses the Windows value for TRUE and returns a +1 if the controller is ready). Therefore, code such as:

if pmcrdy( hCtlr ) = True then

will not work as expected in Visual Basic.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 1.0 or higher

See Also

pmccmd( ), pmcrpy( )


pmcrpy

The pmcrpy( ) function reads a binary reply of up to size bytes from the controller. Programmers should use the more advanced pmcrpyex( ) instead of this function when possible.

short int pmcrpy(

HCTRLR hCtlr,	// controller handle

short int size,	// length of buffer

void* buffer 	// pointer to buffer

);

// .NET – see pmcrpyex

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

size	Length of buffer, in bytes.

buffer	Pointer to reply buffer.

Returns

The return value from this function is the actual number of bytes read. This value may be less than the argument size, but will never exceed size. If the controller has no reply ready the return value will be zero.

Comment

This function waits for a reply for as long as the controller is busy - it returns with a return value of zero if no reply is (or will be) available.

You must open the controller in Binary mode (MC_OPEN_BINARY) in order to use this command.

Example

Requirements

Header: include mcapi.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Version: MCAPI version 1.0 or higher

See Also

pmccmd( ), pmcrdy( ), pmcrpyex( )


pmcrpyex
pmcrpyex  (2.2)

The pmcrpyex( ) function reads a binary  from the controller. Unlike pmcrpy( ) this function handles the formatting of the reply for the user, making this command much easier to use than pmcrpy( ).

long int pmcrpyex(

HCTRLR hCtlr,	// controller handle

void* reply,	// pointer to command reply

long int type	// type of argument

);

// .NET (4 overloads)

Mcapi.Error Mcapi.pmcrpyex(

ref Int32 reply,

);

Mcapi.Error Mcapi.pmcrpyex(

ref Single reply,

);

Mcapi.Error Mcapi.pmcrpyex(

ref Double reply,

);

Mcapi.Error Mcapi.pmcrpyex(

void* reply,

DataType type

);

Parameter	Description

hCtlr	Controller handle, returned by a successful call to MCOpen( ).

reply	Pointer to a variable to hold the reply value

type	Type of data pointed to by pReply:

Value	Description

MC_TYPE_LONG	Indicates pReply points to a variable of type long integer.

MC_TYPE_DOUBLE	Indicates pReply points to a variable of type double precision floating point.

Returns

For Win32 this function returns MCERR_NOERROR if there were no errors, or one of the MCERR_xxxx defined error codes if there was a problem.

Comment

The binary interface is described in detail in the hardware manual that accompanied your controller. Unlike pmcrpy( ) this function handles the formatting of the reply for the user, making this command much easier to use than pmcrpy( ). To read binary replies from the motion controller the hCtlr handle must have opened in binary mode.

Example

Requirements

Header: include mcapi.h and mccl.h, mcapi.pas, or mcapi32.bas

Library: use mcapi32.lib

Assembly: Mcapi (in McapiNet.dll)

Version: MCAPI version 2.2 or higher

See Also

pmccmdex( ), pmcrdy( ), pmcrpy( )


Constants

The symbolic constants described in this section provide a safe, descriptive way of accessing MCAPI features. The actual numeric value of these constants may change in future versions of the API, however the constant names will remain fixed. Use of these symbolic values will help to insure that future changes to the API won't break existing code. The constant values also help to produce more readable code.

The current numeric value for any of these constants may be viewed by clicking the mouse pointer on the highlighted constant name. Most constants are displayed as decimal numbers. A few constants are given in hexadecimal (base 16); these constants have their value specified using the standard 'C' language syntax that prefaces the value with the characters '0x', as in 0x8000.

DC2PC100	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DC2 PC100 controller is installed.

DC2STN	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DC2 STN controller is installed.

DC2SERVO	Identifies an axis as one of the dedicated servo axes on a DC2PC100 controller.

DC2STEPPER	Identifies an axis as one of the optional stepper axes on a DC2PC100 controller.

DCXPC100	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DCX series PC100 controller is installed.

DCXAT100	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DCX series AT100 controller is installed.

DCXAT200	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DCX series AT200 controller is installed.

DCXAT300	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DCX series AT300 controller is installed.

DCXPCI100	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DCX series PCI100 controller is installed.

DCXPCI300	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a DCX series PCI300 controller is installed.

MC100	Identifies a DC Servo axis with analog signal output.

MC110	Identifies a DC Servo axis with motor output.

MC150	Identifies a stepper motor axis.

MC160	Identifies a stepper motor with encoder axis.

MC200	Identifies an Advanced Servo axis with analog signal output.

MC210	Identifies an Advanced Servo axis with PWM motor output.

MC260	Identifies an Advanced Stepper axis.

MC300	Identifies a DSP-Based Servo axis with analog signal output.

MC302	Identifies a DSP-Based Dual-Servo axis with analog signal output.

MC320	Identifies a DSP-Based Brushless-AC Servo axis with analog signal output.

MC360	Identifies a DSP-Based Stepper axis.

MC362	Identifies a DSP-Based Dual-Stepper axis.

MC400	Identifies this axis as providing additional digital I/O channels (16).

MC500	Identifies this axis as providing additional analog channels.

MC_ABSOLUTE	Specifies that a position is in absolute units.

MC_ALL_AXES	When used in place of an axis number this constant implies that the command be performed on all installed axes. This option is not generally permitted on get type commands, ie to get the current position for all installed axes you should issue an individual MCGetPositionEx( ) callfor each axis.

MC_BLOCK_CANCEL	Argument to MCBlockBegin( ) function canceling any commands queued (but not yet executed) as a result of a previous call to MCBlockBegin( ).

MC_BLOCK_COMPOUND	Argument to MCBlockBegin( ) function specifying this block as a compound command block. Commands will not be executed until the MCBlockEnd( ) command is issued.

MC_BLOCK_CONTR_CCW	Argument to MCBlockBegin( ) function specifying this block as a contour path counter-clockwise arc (valid only for controllers that support contouring).

MC_BLOCK_CONTR_CW	Argument to MCBlockBegin( ) function specifying this block as a contour path clockwise arc (valid only for controllers that support contouring).

MC_BLOCK_CONTR_LIN	Argument to MCBlockBegin( ) function specifying this block as a contour path linear motion (valid only for controllers that support contouring).

MC_BLOCK_CONTR_USER	Argument to MCBlockBegin( ) function specifying this block as a contour path user defined motion (valid only for controllers that support contouring).

MC_BLOCK_MACRO	Argument to MCBlockBegin( ) function specifying this block as a macro command. All commands up to the MCBlockEnd( ) will be included in the macro.

MC_BLOCK_RESETM	Argument to MCBlockBegin( ) function that will cause macro storage to be cleared.

MC_BLOCK_TASK	Argument to MCBlockBegin( ) function specifying this block as separate task (valid only for controllers that support multi-tasking).

MC_CAPTURE_ACTUAL	Used to select the actual position data from the data capture functions.

MC_CAPTURE_ADVANCED	Returned as one of the flags in the CaptureModes member of the MCAXISCONFIG data structure to indicate that the axis supports the Delay and Period settings of data capture.

MC_CAPTURE_ERROR	Used to select the following error data from the data capture functions.

MC_CAPTURE_OPTIMAL	Used to select the optimal position data from the data capture functions.

MC_CAPTURE_TORQUE	Used to select the torque data from the data capture functions.

MC_CAPTURE_AUXILIARY	Used to select the auxiliary encoder data from the data capture functions.

MC_CAPTURE_STATUS	Used to select the status word data from the data capture functions.

MC_CIRC_CW	Constant supplied to MCContourPath( ) to select clockwise circular contouring mode.

MC_CIRC_CCW	Constant supplied to MCContourPath( ) to select counter-clockwise circular contouring mode.

MC_COMPARE_DISABLE	Disable position compare mode, also used to disable compare output on position match.

MC_COMPARE_ENABLE	Enable position compare mode.

MC_COMPARE_INVERT	Sets the compare output mode on position match.

MC_COMPARE_ONESHOT	Sets the compare output mode on position match.

MC_COMPARE_STATIC	Sets the compare output mode on position match.

MC_COMPARE_STROBE	Sets the compare output mode on position match to strobe.

MC_COMPARE_TOGGLE	Sets the compare output mode on position match.

MC_COUNT_CAPTURE	Return the current captured position count.

MC_COUNT_COMPARE	Return the current compare position count.

MC_COUNT_CONTOUR	Return the current contour position count.

MC_COUNT_FILTER	Return the current digital filter coefficient count.

MC_COUNT_FILTERMAX	Return the maximum digital filter size supported.

MC_CURRENT_FULL	Restores a stepper motor current to full power. Commonly used to restore full power, prior to driving, following a reduced current setting while a stepper motor was idle. This constant is used to set the value of the Current member of a MCMOTION structure.

MC_CURRENT_HALF	Reduces stepper motor current to half power. Commonly used to reduce heating when a stepper motor is not driving. This constant is used to set the value of the Current member of a MCMOTION structure.

MC_DATA_ACTUAL	see MC_CAPTURE_ACTUAL.

MC_DATA_ERROR	see MC_CAPTURE_ERROR.

MC_DATA_OPTIMAL	see MC_CAPTURE_OPTIMAL.

MC_DIO_FIXED	Indicates that a digital I/O channel's I/O state (i.e. input or output)  is fixed, and may not be changed with MCConfigureDigitalIO( ).

MC_DIO_HIGH	Configures a digital I/O channel for high true logic level when used as an argument to MCConfigureDigitalIO( ).

MC_DIO_INPUT	Configures a digital I/O channel for input when used as an argument to MCConfigureDigitalIO( ).

MC_DIO_LATCH	Configures a digital input channel for input latching when used as an argument to MCConfigureDigitalIO( ).

MC_DIO_LATCHABLE	Indicates that a digital I/O channel may be configured for latched input using MCConfigureDigitalIO( ).

MC_DIO_STEPPER	Indicates that a digital I/O channel is configured for driving a stepper motor on a DC2-PC or DC2-STN controller

MC_DIO_LOW	Configures a digital I/O channel for low true logic level when used as an argument to MCConfigureDigitalIO( ).

MC_DIO_OUTPUT	Configures a digital I/O channel for output when used as an argument to MCConfigureDigitalIO( ).

MC_DIR_POSITIVE	When operating in velocity mode this constant may be used as argument to MCDirection( ) to select the positive travel direction. The physical relationship of MC_DIR_POSITIVE to the actual direction of travel (or rotation) will depend upon your mechanical setup.

MC_DIR_NEGATIVE	When operating in velocity mode this constant may be used as argument to MCDirection( ) to select the negative travel direction. The physical relationship of MC_DIR_NEGATIVE to the actual direction of travel (or rotation) will depend upon your mechanical setup.

MC_ENC_FAULT_PRI	Enable encoder fault detection for the primary encoder.

MC_ENC_FAULT_AUX	Enable encoder fault detection for the auxiliary encoder.

MC_IM_OPENLOOP	Selects the normal (open loop) input mode for MC360 Stepper Modules.

MC_IM_CLOSEDLOOP	Selects the closed-loop input mode for MC360 Stepper Modules.

MC_INT_FREEZE	Selects the wait until move complete mode for the integral term option.

MC_INT_NORMAL	Selects the normal (always active) mode for the integral term option.

MC_INT_ZERO	Selects the zero and wait until move complete mode for the integral term option.

MC_LIMIT_ABRUPT	Selects abrupt stop mode when a limit is tripped.

MC_LIMIT_INVERT	Inverts limit logic mode for hard limits.

MC_LIMIT_MINUS	Enables the low limit for hard and soft limits.

MC_LIMIT_OFF	Selects axis off mode when a limit is tripped.

MC_LIMIT_PLUS	Enables the high limit for hard and soft limits.

MC_LIMIT_SMOOTH	Selects smooth stop mode when a limit is tripped.

MC_LINEAR	Constant supplied to MCContourPath( ) to select linear contouring mode.

MC_LRN_POSITION	When used as an argument to the MCLearnPoint( ) function, this mode will cause the actual position of the axis to be stored in point memory.

MC_LRN_TARGET	When used as an argument to the MCLearnPoint( ) function, this mode will cause the current target position of the axis to be stored in point memory.

MC_MAX_ID	Specifies the maximum allowable value for the ID parameter to the MCOpen( ) call, where 0 <= nID <= MC_MAX_ID.

MC_MODE_CONTOUR	Selects the contouring mode of operation for an axis when used as an argument to MCSetOperatingMode( ).

MC_MODE_GAIN	Selects the gain mode of operation for an axis when used as an argument to MCSetOperatingMode( ).

MC_MODE_POSITION	Selects the position mode of operation for an axis when used as an argument to MCSetOperatingMode( ).

MC_MODE_TORQUE	Selects the torque mode of operation for an axis when used as an argument to MCSetOperatingMode( ).

MC_MODE_UNKNOWN	Return value from MCGetOperatingMode( ) when it is unable to determine the current operating mode.

MC_MODE_VELOCITY	Selects the velocity mode of operation for an axis when used as an argument to MCSetOperatingMode( ).

MC_OM_BIPOLAR	Selects the bipolar output mode for MC200, MC300, and MultiFlex servo axes.

MC_OM_BI_PWM	Selects bipolar PWM output mode for MC200, MC300, and MultiFlex servo axes.

MC_OM_CW_CCW	Selects clockwise - counterclockwise output mode for MC260, MC360, and MultiFlex stepper axes.

MC_OM_PULSE_DIR	Selects pulse and direction output mode for MC260, MC360, and MultiFlex stepper axes.

MC_OM_UNIPOLAR	Selects unipolar output mode for MC200, MC300, and MultiFlex servo axes.

MC_OM_UNI_PWM	Selects unipolar PWM output mode for MC200, MC300, and MultiFlex servo axes.

MC_OPEN_ASCII	When used as an argument to the MCOpen( ) function it specifies that a controller is to be open for ASCII (character) based communication.

MC_OPEN_BINARY	When used as an argument to the MCOpen( ) function it specifies that a controller is to be open for binary communication.

MC_OPEN_EXCLUSIVE	This constant may be combined with either MC_OPEN_ASCII or MC_OPEN_BINARY for calls to MCOpen( ) to prevent other applications from gaining access to the controller while it is open with an exclusive handle.

MC_PHASE_REV	Selects reverse phasing for the servo module output when used as an argument to MCSetServoOutputPhase( ).

MC_PHASE_STD	Selects standard phasing for the servo module output when used as an argument to MCSetServoOutputPhase( ).

MC_PROF_PARABOLIC	This constant may be used as the value of the mode argument to the MCSetProfile( ) API function. It selects the parabolic profile for acceleration and deceleration.

MC_PROF_SCURVE	This constant may be used as the value of the mode argument to the MCSetProfile( ) API function. It selects the S-Curve profile for acceleration and deceleration.

MC_PROF_TRAPEZOID	This constant may be used as the value of the mode argument to the MCSetProfile( ) API function. It selects the trapezoidal profile for acceleration and deceleration.

MC_PROF_UNKNOWN	This constant is returned by the MCGetProfile( ) API function if it is unable to determine the present profile setting. The most likely cause is older firmware, contact PMC for information on firmware updates.

MC_RATE_LOW	This constant is used as an argument to the Rate member of an MCMOTION structure. For servo motors, setting Rate to this value sets the feedback loop update rate to 1KHz. When used for a stepper motor, it sets the maximum pulse rate to 19.5 thousand pulses/sec.

MC_RATE_MEDIUM	This constant is used as an argument to the Rate member of an MCMOTION structure. For servo motors, setting Rate to this value sets the feedback loop update rate to 2KHz. When used for a stepper motor, it sets the maximum pulse rate to 156 thousand pulses/sec.

MC_RATE_HIGH	This constant is used as an argument to the Rate member of an MCMOTION structure. For servo motors, setting Rate to this value sets the feedback loop update rate to 4KHz. When used for a stepper motor, it sets the maximum pulse rate to 1.25 million pulses/sec.

MC_RATE_UNKNOWN	Returned by MCGetTrajectoryRate() if the controller’s maximum trajectory rate cannot be determined.

MC_RELATIVE	Specifies that a position supplied is relative to the current axis position.

MC_STAT_ACCEL	Selects the Accelerating status bit (DC2 PC100 only).

MC_STAT_AMP_ENABLE	Selects the Amp Falut Enabled status bit (DCX controllers only).

MC_STAT_AMP_FAULT	Selects the Amp Fault status bit (DCX controllers only).

MC_STAT_AT_TARGET	Selects the At Target status bit (DC2 PC100 controllers only).

MC_STAT_AUX_ENC_FAULT	Selects the Auxiliary Encoder Fault status bit (DC4 controllers only).

MC_STAT_AUX_IDX_FND	Selects the Auxiliary Encoder Index Found status bit (DC4 controllers only).

MC_STAT_BREAKPOINT	Selects the Breakpoint status bit.

MC_STAT_BUSY	Selects the Busy status bit (DCX controllers only). When set indicates that dual port memory is being refreshed.

MC_STAT_CAPTURE	Selects the Position Capture status bit (DC2 PC100 controllers only).

MC_STAT_DIR	Selects the Direction status bit.

MC_STAT_EDGE_FOUND	Selects the Edge Found status bit (DCX PCI controllers only).

MC_STAT_ERROR	Selects the Motor Error status bit.

MC_STAT_FOLLOWING	Selects the Following Error status bit (DCX controllers only).

MC_STAT_FULL_STEP	Selects the Full Step status bit (DCX controllers only).

MC_STAT_HALF_STEP	Selects the Half Step status bit (DCX controllers only).

MC_STAT_HOMED	Selects the Motor Homed status bit.

MC_STAT_INDEX_FOUND	Selects the Index Found status bit (DCX PCI controllers only).

MC_STAT_INP_AMP	Selects the Amp Fault Input status bit (DCX controllers only).

MC_STAT_INP_AUX	Selects the Auxiliary Encoder Index Input status bit (DCX AT200, DCX AT300, DCX PCI controllers only).

MC_STAT_INP_INDEX	Selects the Index Input status bit (DCX controllers only).

MC_STAT_INP_HOME	Selects the Home Input status bit (DCX controllers only).

MC_STAT_INP_MJOG	Selects the Minus Jog Input status bit (DCX PC100 / DCX AT100 controllers only).

MC_STAT_INP_MLIM	Selects the Minus Limit Input status bit (DCX controllers only).

MC_STAT_INP_PJOG	Selects the Plus Jog Input status bit (DCX PC100 / DCX AT100 controllers only).

MC_STAT_INP_PLIM	Selects the Plus Limit Input status bit (DCX controllers only).

MC_STAT_INP_USER1	Selects the User #1 Input status bit (DCX AT200, DCX AT300 controllers only).

MC_STAT_INP_USER2	Selects the User #2 Input status bit (DCX AT200, DCX AT300 controllers only).

MC_STAT_JOG_ENAB	Selects the Jogging Enabled status bit (DCX AT200, DCX AT300 controllers only).

MC_STAT_JOGGING	Selects the Motor Jogging status bit (DCX PC100 / DCX AT100 controllers only).

MC_STAT_LMT_ABORT	Selects the Abort Limit Mode status bit (DC2 PC100 controllers only).

MC_STAT_LMT_STOP	Selects the Stop Limit Mode status bit (DC2 PC100 controllers only).

MC_STAT_LOOK_AUX_IDX	Selects the Looking for Auxiliary Encoder Index status bit (DC4-PCI6XX controllers only).

MC_STAT_LOOK_EDGE	Selects the Looking for Edge status bit.

MC_STAT_LOOK_INDEX	Selects the Looking for Index status bit.

MC_STAT_MJOG_ENAB	Selects the Minus Jog Enable status bit (DCX PC100 / DCX AT100 controllers only).

MC_STAT_MJOG_ON	Selects the Minus Jog On status bit (DCX PC100 / DCX AT100 controllers only).

MC_STAT_MLIM_ENAB	Selects the Minus Hard Limit Enable status bit.

MC_STAT_MLIM_TRIP	Selects the Minus Hard Limit Tripped status bit.

MC_STAT_MODE_ARC	Selects the Arc Mode status bit (DC2 PC100 controllers only).

MC_STAT_MODE_CNTR	Selects the Contouring Mode status bit (DC2 PC100 controllers only).

MC_STAT_MODE_LIN	Selects the Linear Mode status bit (DC2 PC100 controllers only).

MC_STAT_MODE_POS	Selects the Position Mode status bit (DC2 PC100 controllers only).

MC_STAT_MODE_SLAVE	Selects the Slave Mode status bit (DC2 PC100 controllers only).

MC_STAT_MODE_TRQE	Selects the Torque Mode status bit (DC2 PC100 controllers only).

MC_STAT_MODE_VEL	Selects the Velocity Mode status bit.

MC_STAT_MSOFT_ENAB	Selects the Minus Soft Limit Enable status bit (DCX AT200, DCX AT300, DCX PCI controllers only).

MC_STAT_MSOFT_TRIP	Selects the Minus Soft Limit Tripped status bit (DCX AT200, DCX AT300, DCX PCI controllers only).

MC_STAT_MTR_ENABLE	Selects the Motor On status bit.

MC_STAT_NULL	Selects the NULL Stepper Position status bit (DCX PCI300 controllers only).

MC_STAT_PHASE	Selects the Phase Reversed status bit.

MC_STAT_PJOG_ENAB	Selects the Plus Jog Enable status bit  (DCX PC100 / DCX AT100 controllers only).

MC_STAT_PJOG_ON	Selects the Plus Jog On status bit  (DCX PC100 / DCX AT100 controllers only).

MC_STAT_PLIM_ENAB	Selects the Plus Hard Limit Enable status bit.

MC_STAT_PLIM_TRIP	Selects the Plus Hard Limit Tripped status bit.

MC_STAT_POS_CAPT	Selects the Position Captured status bit (DCX PCI300 controllers only).

MC_STAT_PRI_ENC_FAULT	Selects the Primary Encoder Fault status bit (DC4 controllers only).

MC_STAT_PROG_DIR	Selects the Programmed Direction status bit (DC2 PC100 controllers only).

MC_STAT_PSOFT_ENAB	Selects the Plus Soft Limit Enable status bit (DCX AT200, DCX AT300, DCX PCI controllers only).

MC_STAT_PSOFT_TRIP	Selects the Plus Soft Limit Tripped status bit (DCX AT200, DCX AT300, DCX PCI controllers only).

MC_STAT_RECORD	Selects the Position Position status bit (DC2 PC100 controllers only).

MC_STAT_STOPPING	Selects the Stopping status bit (DC2 PC100 controllers only).

MC_STAT_SYNC	Selects the Synchronize status bit (DC2 PC100 controllers only).

MC_STAT_TRAJ	Selects the Trajectory Complete status bit.

MC_STEP_FULL	Selects stepper motor full step operation.

MC_STEP_HALF	Selects stepper motor half step operation.

MC_TYPE_DOUBLE	Used with pmccmdex() and register get/set functions to select a double precision floating point data type.

MC_TYPE_FLOAT	Used with pmccmdex() and register get/set functions to select a single precision floating point data type.

MC_TYPE_LONG	Used with pmccmdex() and register get/set functions to select a long integer (32-bit) data type.

MC_TYPE_NONE	Used with pmccmdex() to specify no argument.

MC_TYPE_REG	Used with pmccmdex() to select a register based argument.

MC_TYPE_STRING	Used with pmccmdex() and register get/set functions to select a string data type.

MC_TYPE_SERVO	Indicates the axis is a servo motor – used with the.MCAXISCONFIG structure.

MC_TYPE_STEPPER	Indicates the axis is a stepper motor – used with the.MCAXISCONFIG structure.

MCERR_ALL_AXES	Error code indicating you may not use the constant MC_ALL_AXES with this function.

MCERR_ALLOC_MEM	There was a memory allocation error during a call to MCOpen( ). Try closing other Windows programs to free memory.

MCERR_AXIS_NUMBER	Error code indicating that the specified axis number is out of range.

MCERR_AXIS_TYPE	Error code indicating that the function does not apply to the axis specified .

MCERR_COMM_PORT	Error code indicating and invalid constant value was given as the argument to a function.

MCERR_CONSTANT	Error code indicating and invalid constant value was given as the argument to a function.

MCERR_CONTROLLER	Error code indicating the controller handle is invalid.

MCERR_INIT_DRIVER	MCOpen( ) was unable to initialize the device driver for this controller.

MCERR_MODE_UNAVAIL	The requested open mode for MCOpen( ) was unavailable. This can occur when a non-multitasking controller is already open in a mode that is different from the requested mode.

MCERR_NOERROR	Error code return value indicating that no errors have occurred.

MCERR_NO_CONTROLLER	returned by MCOpen( ) when no controller has been configured for this ID number.

MCERR_NO_REPLY	Error code indicating a controller failed to reply.

MCERR_NOT_INITIALIZED	An attempt was made to use a controller feature before that feature had been initialized.

MCERR_NOT_PRESENT	The controller hardware was not found during a call to MCOpen( ). Check the MCAPI settings with the setup program.

MCERR_NOTSUPPORTED	Error code indicating function is not supported by this controller. The MCAPI will handle this condition by ignoring requests to set this parameter and by returning a fixed default value for the parameter. You may, therefore, safely ignore this error.

MCERR_OBSOLETE	Error code indicating function is obsolete. See manual for updated function.

MCERR_OPEN_EXCLUSIVE	returned by MCOpen( ) when it is unable to satisfy a request for an exclusive handle. You cannot obtain an exclusive handle to a controller if there are other open handles for the controller at the time of your request.

MCERR_OUT_OF_HANDLES	returned by MCOpen( ) when the device driver has no more free handles it can assign to this request.

MCERR_RANGE	Error code indicating a parameter was out of range.

MCERR_REPLY_AXIS	Error code indicating the wrong axis number replied to a function.

MCERR_REPLY_COMMAND	Error code indicating the controller reply does not match the command.

MCERR_REPLY_SIZE	Error code indicating the length of a reply was incorrect (too many or too few bytes).

MCERR_TIMEOUT	A timeout occured while attempting to send a command or read a reply from the controller.

MCERR_UNKNOWN_REPLY	Error code indicating an unknown or unexpected reply was received from a controller.

MCERR_UNSUPPORTED_MODE	Return value from MCOpen( ) when the requested mode is not supported for this controller/interface combination.

MCERR_WINDOW	Error code indicating a window handle is invalid.

MCERRMASK_AXIS	Error mask value for MCErrorNotify( ) to enable error messages for out of range axis numbers and invalid usage of MC_ALL_AXES.

MCERRMASK_HANDLE	Error mask value for MCErrorNotify( ) to enable error messages for invalid controller or window handles.

MCERRMASK_IO	Error mask value for MCErrorNotify( ) to enable error messages for controller communication errors.

MCERRMASK_PARAMETER	Error mask value for MCErrorNotify( ) to enable error messages for invalid or out of range parameters to MCAPI functions.

MCERRMASK_STANDARD	Collection of most common error mask values for MCErrorNotify( ) (includes all errors except MCERRMASK_UNSUPPORTED) .

MCERRMASK_UNSUPPORTED	Error mask value for MCErrorNotify( ) that enables error notification when a function is called that is not supported by the controller.

MF300	Identifies this axis as an RS-232 communications module. This module is not normally used with a controller installed in a PC adapter slot.

MF310	Identifies this axis as an IEEE-488 (GPIB) communications module. This module is not normally used with a controller installed in a PC adapter slot.

MFXPCI1000	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a MultiFlex PCI series 1000 controller is installed.

MFXETH1000	Value for the ControllerType member of an MCPARAMEX structure, it indicates that a MultiFlex ETH series 1000 controller is installed.

MFXSERVO	Identifies an axis as one of the dedicated servo axes on a MultiFlex controller.

MFXSTEPPER	Identifies an axis as one of the dedicated stepper axes on a MultiFlex controller.

NO_CONTROLLER	One setting for the ControllerType member of an MCPARAM structure, it indicates that no controller is installed at this ID.

NO_MODULE	Identifies this axis as having no module installed.

NONE	One setting for the ControllerType member of a MCPARAM structure, it indicates that no controller is installed at this ID. This is an old constant - it is recommended that you use NO_CONTROLLER insteadof NONE.


DC2PC100

Value = 4


DC2STN

Value = 5


DC2SERVO

Value = 254


DC2STEPPER

Value = 255


DCXPC100

Value = 1


DCXAT100

Value = 2


DCXAT200

Value = 3


DCXAT300

Value = 6


DCXPCI100

Value = 8


DCXPCI300

Value = 7


MC100

Value = 5


MC110

Value = 4


MC150

Value = 6


MC160

Value = 7


MC200

Value = 0


MC210

Value = 16


MC260

Value = 1


MC300

Value = 2


MC302

Value = 22


MC320

Value = 162


MC360

Value = 3


MC362

Value = 23


MC400

Value = 8


MC500

Value = 12


MC_ABSOLUTE

Value = 0


MC_ALL_AXES

Value = 0


MC_BLOCK_CANCEL

Value = 4


MC_BLOCK_COMPOUND

Value = 0


MC_BLOCK_CONTR_CCW

Value = 8


MC_BLOCK_CONTR_CW

Value = 7


MC_BLOCK_CONTR_LIN

Value = 6


MC_BLOCK_CONTR_USER

Value = 5


MC_BLOCK_MACRO

Value = 2


MC_BLOCK_RESETM

Value = 3


MC_BLOCK_TASK

Value = 1


MC_CAPTURE_ACTUAL

Value = 16


MC_CAPTURE_ADVANCED

Value = 256


MC_CAPTURE_ERROR

Value = 32


MC_CAPTURE_OPTIMAL

Value = 64


MC_CAPTURE_TORQUE

Value = 128


MC_CAPTURE_AUXILIARY

Value = 512


MC_CAPTURE_STATUS

Value = 1024


MC_CIRC_CW

Value = 2


MC_CIRC_CCW

Value = 3


MC_COMPARE_DISABLE

Value = 0


MC_COMPARE_ENABLE

Value = 1


MC_COMPARE_INVERT

Value = 0x0080


MC_COMPARE_ONESHOT

Value = 3


MC_COMPARE_STATIC

Value = 1


MC_COMPARE_STROBE

Value = 5


MC_COMPARE_TOGGLE

Value = 2


MC_COUNT_CAPTURE

Value = 1


MC_COUNT_COMPARE

Value = 2


MC_COUNT_CONTOUR

Value = 4


MC_COUNT_FILTER

Value = 8


MC_COUNT_FILTERMAX

Value = 16


MC_CURRENT_FULL

Value = 1


MC_CURRENT_HALF

Value = 2


MC_DATA_ACTUAL

Value = 0


MC_DATA_ERROR

Value = 2


MC_DATA_OPTIMAL

Value = 1


MC_DIO_FIXED

Value = 256


MC_DIO_HIGH

Value = 4


MC_DIO_INPUT

Value = 1


MC_DIO_LATCH

Value = 16


MC_DIO_LATCHABLE

Value = 512


MC_DIO_STEPPER

Value =1024


MC_DIO_LOW

Value = 8


MC_DIO_OUTPUT

Value = 2


MC_DIR_POSITIVE

Value = 1


MC_DIR_NEGATIVE

Value = 2


MC_ENC_FAULT_PRI

Value = 1


MC_ENC_FAULT_AUX

Value = 2


MC_IM_OPENLOOP

Value = 0


MC_IM_CLOSEDLOOP

Value = 1


MC_INT_FREEZE

Value = 1


MC_INT_NORMAL

Value = 0


MC_INT_ZERO

Value = 2


MC_LIMIT_ABRUPT

Value = 4


MC_LIMIT_INVERT

Value = 0x80


MC_LIMIT_MINUS

Value = 2


MC_LIMIT_OFF

Value = 0


MC_LIMIT_PLUS

Value = 1


MC_LIMIT_SMOOTH

Value = 8


MC_LINEAR

Value = 1


MC_LRN_POSITION

Value = 1


MC_LRN_TARGET

Value = 2


MC_MAX_ID

Value = 15


MC_MODE_CONTOUR

Value = 0


MC_MODE_GAIN

Value = 1


MC_MODE_POSITION

Value = 2


MC_MODE_TORQUE

Value = 3


MC_MODE_UNKNOWN

Value = 5


MC_MODE_VELOCITY

Value = 4


MC_OM_BIPOLAR

Value = 0


MC_OM_BIP_PWM
MC_OM_BI_PWM

Value = 2


MC_OM_CW_CCW

Value = 1


MC_OM_PULSE_DIR

Value = 0


MC_OM_UNIPOLAR

Value = 1


MC_OM_UNI_PWM

Value = 3


MC_OPEN_ASCII

Value = 1


MC_OPEN_BINARY

Value = 2


MC_OPEN_EXCLUSIVE

Value = 0x8000


MC_PHASE_REV

Value = 1


MC_PHASE_STD

Value = 0


MC_PROF_PARABOLIC

Value = 4


MC_PROF_SCURVE

Value = 2


MC_PROF_TRAPEZOID

Value = 1


MC_PROF_UNKNOWN

Value = 0


MC_RATE_HIGH

Value = 4


MC_RATE_LOW

Value = 1


MC_RATE_MEDIUM

Value = 2


MC_RATE_UNKNOWN

Value = 0


MC_RELATIVE

Value = 1


MC_STAT_ACCEL

Value = 43


MC_STAT_AMP_ENABLE

Value = 12


MC_STAT_AMP_FAULT

Value = 13


MC_STAT_AUX_ENC_FAULT

Value = 60


MC_STAT_AUX_IDX_FND

Value = 62


MC_STAT_BREAKPOINT

Value = 10


MC_STAT_BUSY

Value = 0


MC_STAT_CAPTURE

Value = 51


MC_STAT_DIR

Value = 4


MC_STAT_EDGE_FOUND

Value = 58


MC_STAT_ERROR

Value = 7


MC_STAT_FOLLOWING

Value = 11


MC_STAT_FULL_STEP

Value = 31


MC_STAT_HALF_STEP

Value = 32


MC_STAT_HOMED

Value = 6


MC_STAT_INDEX_FOUND

Value = 55


MC_STAT_INP_AMP

Value = 24


MC_STAT_INP_AUX

Value = 25


MC_STAT_INP_INDEX

Value = 22


MC_STAT_INP_HOME

Value = 23


MC_STAT_INP_MJOG

Value =39


MC_STAT_INP_MLIM

Value = 27


MC_STAT_INP_PJOG

Value = 38


MC_STAT_INP_PLIM

Value = 26


MC_STAT_INP_USER1

Value = 28


MC_STAT_INP_USER2

Value = 29


MC_STAT_JOG_ENAB

Value = 5


MC_STAT_JOGGING

Value = 33


MC_STAT_LMT_ABORT

Value = 49


MC_STAT_LMT_STOP

Value = 50


MC_STAT_LOOK_AUX_IDX

Value = 61


MC_STAT_LOOK_EDGE

Value = 9


MC_STAT_LOOK_INDEX

Value = 8


MC_STAT_MJOG_ENAB

Value = 36


MC_STAT_MJOG_ON

Value = 37


MC_STAT_MLIM_ENAB

Value = 16


MC_STAT_MLIM_TRIP

Value = 17


MC_STAT_MSOFT_ENAB

Value =20


MC_STAT_MSOFT_TRIP

Value = 21


MC_STAT_MODE_ARC

Value = 46


MC_STAT_MODE_CNTR

Value = 47


MC_STAT_MODE_LIN

Value = 54


MC_STAT_MODE_POS

Value = 44


MC_STAT_MODE_SLAVE

Value = 48


MC_STAT_MODE_TRQE

Value = 45


MC_STAT_MODE_VEL

Value = 2


MC_STAT_MTR_ENABLE

Value = 1


MC_STAT_NULL

Value = 57


MC_STAT_PHASE

Value = 30


MC_STAT_PJOG_ENAB

Value =34


MC_STAT_PJOG_ON

Value = 35


MC_STAT_PLIM_ENAB

Value = 14


MC_STAT_PLIM_TRIP

Value = 15


MC_STAT_POS_CAPT

Value = 56


MC_STAT_PRI_ENC_FAULT
MC_STAT_PRI__ENC_FAULT

Value = 59


MC_STAT_PROG_DIR

Value = 41


MC_STAT_PSOFT_ENAB

Value = 18


MC_STAT_PSOFT_TRIP

Value = 19


MC_STAT_AT_TARGET

Value = 42


MC_STAT_RECORD

Value = 52


MC_STAT_STOPPING

Value = 40


MC_STAT_SYNC

Value = 53


MC_STAT_TRAJ

Value = 3


MC_STEP_FULL

Value = 1


MC_STEP_HALF

Value = 2


MC_TYPE_DOUBLE

Value = 4


MC_TYPE_FLOAT

Value = 3


MC_TYPE_LONG

Value = 2


MC_TYPE_NONE

Value = 0


MC_TYPE_REG

Value = 1


MC_TYPE_STRING

Value = 5


MC_TYPE_SERVO

Value = 1


MC_TYPE_STEPPER

Value = 2


MCERR_ALL_AXES

Value = 17


MCERR_ALLOC_MEM

Value = 8


MCERR_AXIS_NUMBER

Value = 15


MCERR_AXIS_TYPE

Value = 16


MCERR_COMM_PORT

Value = 27


MCERR_CONSTANT

Value = 19


MCERR_CONTROLLER

Value = 13


MCERR_INIT_DRIVER

Value = 6


MCERR_MODE_UNAVAIL

Value = 4


MCERR_NOERROR

Value = 0


MCERR_NO_CONTROLLER

Value = 1


MCERR_NO_REPLY

Value = 21


MCERR_NOT_INITIALIZED

Value = 29


MCERR_NOT_PRESENT

Value = 7


MCERR_NOTSUPPORTED

Value = 11


MCERR_OBSOLETE

Value = 12


MCERR_OPEN_EXCLUSIVE

Value = 3


MCERR_OUT_OF_HANDLES

Value = 2


MCERR_RANGE

Value = 18


MCERR_REPLY_AXIS

Value = 23


MCERR_REPLY_COMMAND

Value = 24


MCERR_REPLY_SIZE

Value = 22


MCERR_TIMEOUT

Value = 25


MCERR_UNKNOWN_REPLY

Value = 20


MCERR_UNSUPPORTED_MODE

Value = 5


MCERR_WINDOW

Value = 14


MCERRMASK_AXIS

Value = 0x00000004


MCERRMASK_HANDLE

Value = 0x00000002


MCERRMASK_IO

Value = 0x00000010


MCERRMASK_PARAMETER

Value = 0x00000008


MCERRMASK_STANDARD

Value = 0xFFFFFFFE


MCERRMASK_UNSUPPORTED

Value = 0x00000001


MF300

Value = 10


MF310

Value = 9


MFXPCI1000

Value = 9


MFXETH1000

Value = 10


MFXSERVO

Value = 252


MFXSTEPPER

Value = 253


NO_CONTROLLER

Value = 0


NO_MODULE

Value = 15


NONE

Value = 0


MCAXISCONFIG Structure
MCAXISCONFIG Structure  (3.0)

The MCAXISCONFIG structure provides basic information about the type and configuration of a single motor axis.

typedef struct {

long int	cbSize;

long int	ModuleType;

long int	ModuleLocation;

long int	MotorType;

long int	CaptureModes;

long int	CapturePoints;

long int	CaptureAndCompare;

double	HighRate;

double	MediumRate;

double	LowRate;

double	HighStepMin;

double	HighStepMax;

double	MediumStepMin;

double	MediumStepMax;

double	LowStepMin;

double	LowStepMax;

long int    AuxEncoder;	// added in version 3.4

} MCAXISCONFIG;

Member	Description

cbSize	size of the MCAXISCONFIG data structure, in bytes.

ModuleType	Axis type specifier:

Value	Description

DC2SERVO	Identifies the dedicated servo output of a DC2 controller.

DC2STEPPER	Identifies the optional stepper output of a DC2 controller.

MC100	Identifies a DC Servo axis with analog signal output.

MC110	Identifies a DC Servo axis with motor output.

MC150	Identifies a stepper motor axis.

MC160	Identifies a stepper motor with encoder axis.

MC200	Identifies an Advanced Servo axis with analog signal output.

MC210	Identifies an Advanced Servo axis with PWM motor output.

MC260	Identifies an Advanced Stepper axis.

MC300	Identifies a DSP-Based Servo axis with analog signal output.

MC302	Identifies a DSP-Based Dual-Servo axis with analog signal output.

MC320	Identifies an DSP-Based Brushless AC Servo axis with analog signal output.

MC360	Identifies a DSP-Based Stepper axis.

MC362	Identifies a DSP-Based Dual-Stepper axis.

MF300	Identifies this axis as an RS-232 communications module. This module is not normally used with a controller installed in a PC adapter slot.

MF310	Identifies this axis as an IEEE-488 (GPIB) communications module. This module is not normally used with a controller installed in a PC adapter slot.

MC400	Identifies this axis as providing additional digital I/O channels (16).

MC500	Identifies this axis as providing additional analog channels.

MFXSERVO	Identifies the dedicated servo output of a MultiFlex controller.

MFXSTEPPER	Identifies the dedicated stepper output of a MultiFlex controller.

MotorType	Provides a simplified type identifier for the motor type (bit flags):

Value	Description

MC_TYPE_SERVO	Axis is a servo motor.

MC_TYPE_STEPPER	Axis is a stepper motor.

CaptureModes	Supported data cpature modes for this axis (bit flags). One or more of the following values may be OR'ed together:

Value	Description

MC_CAPTURE_ACTUAL	Axis can capture actual position data.

MC_CAPTURE_ADVANCED	Axis supports the Delay and Period settings of MCCaptureData( ).

MC_CAPTURE_ERROR	Axis can capture error position data.

MC_CAPTURE_OPTIMAL	Axis can capture optimal position data.

MC_CAPTURE_TORQUE	Axis can capture torque data.

CapturePoints	Maximum number of data points that may be captured.

CaptureAndCompare	High speed position capture and compare:

Value	Description

TRUE	Feature is supported.

FALSE	Feature isn’t supported.

HighRate	Servo update period, in seconds, for High Speed mode (valid only for servo modules).

MediumRate	Servo update period, in seconds, for Medium Speed mode (valid only for servo modules).

LowRate	Servo update period, in seconds, for Low  Speed mode (valid only for servo modules).

HighStepMin	Minimum step rate for High Speed mode (valid only for stepper modules).

HighStepMax	Maximum step rate for High Speed mode (valid only for stepper modules).

MediumStepMin	Minimum step rate for Medium Speed mode (valid only for stepper modules).

MediumStepMax	Maximum step rate for Medium Speed mode (valid only for stepper modules).

LowStepMin	Minimum step rate for Low Speed mode (valid only for stepper modules).

LowStepMax	Maximum step rate for Low Speed mode (valid only for stepper modules).

AuxEncoder	Auxiliary encoder support (added in rev 3.4 of the MCAPI):

Value	Description

TRUE	Auxiliary encoder supported.

FALSE	Auxiliary encoder not supported.

Comments

Unlike the other MCAPI structures, the values in this structure are fixed by the hardware configuration and may not be changed.

Before you call MCGetAxisConfiguration( ) you must set the cbSize member to the size of this data structure. C/C++ programmers may use sizeof( ), Visual Basic and Delphi programmers will find current sizes for these data structures in the appropriate MCAPI.XXX header file.

Visual Basic users please note that the value used for TRUE in the MCPARAM structure is the Windows standard of 1, not the Basic value of -1. Direct comparisons, such as:

If (Param.CanDoScaling = True) Then

will fail. To get correct results use the constant WinTrue, declared in the MCAPI.BAS include file:

If (Param.CanDoScaling = WinTrue) Then

See Also

MCGetAxisConfiguration( )


MCCOMMUTATION Structure
MCCOMMUTATION Structure  (3.2)

The MCCOMMUTATION structure contains commutation parameters for an axis.

typedef struct {

long int	cbSize;

double	PhaseA;

double	PhaseB;

long int	Divisor;

long int	PreScale;

long int	Repeat;

} MCCCOMMUTATION;

Member	Description

cbSize	size of the MCCOMMUTATION data structure, in bytes.

PhaseA	Phase A setting, in degrees.

PhaseB	Phase B setting, in degrees.

Divisor	Commutation divisor.

PreScale	Commutation prescale factor.

Repeat	Commutation repeat count.

Comments

Setting Divisor, PreScale, or Repeat to negative one (-1) will cause MCSetCommutation( ) to skip setting that value.

See your DCX-PCI300 or DCX-AT300 User’s Guide for information on configuring commutation.

Compatibility

Commutation is only supported for the MC320 module on the DCX-PCI300 or DCX-AT300 controller.

See Also

MCSetCommutation( )


MCCONTOUR Structure

The MCCONTOUR structure contains contouring parameters for an axis.

typedef struct {

double	VectorAccel;

double	VectorDecel;

double	VectorVelocity;

double	VelocityOverride;

} MCCONTOUR;

Member	Description

VectorAccel	Acceleration value for motion along a contour path.

VectorDecel	Deceleration value for motion along a contour path.

VectorVelocity	Maximum velocity for motion along a contour path.

VelocityOverride	Proportional scaling factor for vector velocity, may be changed while axes are in motion.

Comments

The vector velocity parameter must be set prior to starting a contour path motion and can not be changed once the motion has begun. To change velocity on the fly, set the velocity override to a value other than 1.0. This value is used to proportionally scale the velocities.

Compatibility

Contouring is only supported on the MultiFlex, DCX-PCI300, DCX-AT300, and DCX-AT200 controllers.

See Also

MCGetContourConfig( ), MCSetContourConfig( )


MCFILTER Structure

The MCFILTER structure contains the PID filter parameters for an axis. This structure has been superseded by the newer MCFILTEREX, which should be used for new designs.

typedef struct {

double	DerivativeGain;

double	DerSamplePeriod;

double	IntegralGain;

double	IntegrationLimit;

double	VelocityGain;

double	AccelGain;

double	DecelGain;

double	FollowingError;

} MCFILTER;

Member	Description

DerivativeGain	Gain setting for the derivative term of the PID loop.

DerSamplePeriod	Time interval, in seconds, between derivative samples.

IntegralGain	Gain setting for the integral term of the PID loop.

IntegrationLimit	Limit value for the integral term, limits the power the integral gain can use to reduce error to zero.

VelocityGain	Gain setting for the feed-forward gain of the PID loop, volts per encoder count per second.

AccelGain	Feed-forward acceleration gain setting.

DecelGain	Feed-forward deceleration gain setting.

FollowingError	Maximum position error, default units are encoder counts.

Comments

The servo tuning utility program offers a convenient, interactive format for determining appropriate filter settings for your servo/amplifier combination.

See Also

MCFILTEREX, MCGetFilterConfig( ), MCSetFilterConfig( )


MCFILTEREX Structure
MCFILTEREX Structure  (3.2)

The MCFILTEREX structure contains the PID filter parameters for a servo axis, or the closed-loop parameters for a stepper axis operating in closed-loop mode.

typedef struct {

long int	cbSize;

double	Gain;

double	IntegralGain;

double	IntegrationLimit;

long int	IntegralOption;

double	DerivativeGain;

double	DerSamplePeriod;

double	FollowingError;

double	VelocityGain;

double	AccelGain;

double	DecelGain;

double	EncoderScaling;

long int	UpdateRate;

double	PositionDeadband;	// added in version 3.5

double	DelayAtTarget; 	// added in version 3.5

double	OutputOffset; 	// added in version 3.5

double	OutputDeadband; 	// added in version 3.5

} MCFILTEREX;

Member	Description

cbSize	size of the MCFILTEREX data structure, in bytes.

Gain	Proportional Gain setting of the PID loop.

IntegralGain	Gain setting for the integral term of the PID loop.

IntegrationLimit	Limit value for the integral term, limits the power the integral gain can use to reduce error to zero.

IntegralOption	Operating mode for the integral term of the PID loop:

Value	Description

MC_INT_NORMAL	Selects the normal (always on) operation of the integral term.

MC_INT_FREEZE	Freeze the integral term while moving, re-enable after move is complete.

MC_INT_ZERO	Zero and freeze the integral term while moving, re-enable after move is complete.

DerivativeGain	Gain setting for the derivative term of the PID loop.

DerSamplePeriod	Time interval, in seconds, between derivative samples.

FollowingError	Maximum position error, default units are encoder counts.

VelocityGain	Gain setting for the feed-forward gain of the PID loop, volts per encoder count per second (ignored for closed-loop steppers).

AccelGain	Feed-forward acceleration gain setting.

DecelGain	Feed-forward deceleration gain setting.

EncoderScaling	Encoder counts per step scaling factor for closed-loop steppers (ignored for servos).

UpdateRate	This parameter is used to select the feedback loop rate for servo motors, or the maximum stepper pulse rate for stepper motor axes:

Value	Description

MC_RATE_UNKNOWN	Returned if MCAPI cannot determine the current rate.

MC_RATE_LOW	Selects the low range for feedback/step rate.

MC_RATE_MEDIUM	Selects the medium range for feedback/step rate.

MC_RATE_HIGH	Selects the high range for feedback/step rate.

PositionDeadband	Sets the position deadband used by the controller to determine when an axis is “At Target.”

DelayAtTarget	Sets the time period during which an axis must remain within the position deadband in order to be considered “At Target.”

OutputOffset	Provides software programmability of the zero point of a servo output.

OutputDeadband	This parameter may be used to created a deadband around the zero point of a servo ouput.

Comments

The servo tuning utility program offers a convenient, interactive format for determining appropriate filter settings for your servo/amplifier or closed-loop stepper.

Compatibility

PositionDeadband, DelayAtTarget, OutputOffset, OutputDeadband are only supported on the MuultiFlex family of motion controllers.

See Also

MCGetFilterConfigEx( ), MCSetFilterConfigEx( )


MCJOG Structure

The MCJOG structure defines jog parameters for an axis.

typedef struct {

double	Acceleration;

double	MinVelocity;

double	Deadband;

double	Gain;

double	Offset;

} MCJOG;

Member	Description

Acceleration	Acceleration rate for use with jogging.

MinVelocity	Stepper motor jog minimum velocity (this parameter has no effect for servo motors).

Deadband	Deadband specifies a threshold value about the center position of the joystick below which motion of the joystick will not effect motor position. This prevents undesirable drifting of the motor due to mechanical and electrical variations in the joystick.

Gain	Gain value for jogging. This parameter is effectively multiplied by the current joystick position to produce a velocity. To increase the maximum velocity, set Gain to a larger value. To reverse the direction of motor travel with respect to joystick direction Gain may be set to a negative value.

Offset	Specifies the center position of the joystick, in volts.

Comments

The jog settings determine the performance of an axis  when the jogging inputs are active and jogging has been enabled.

See Also

MCEnableJog( ), MCGetJogConfig( ), MCSetJogConfig( )


MCJOGEX Structure
MCJOGEX Structure  (4.1)

The MCJOGEX structure defines jog parameters for an axis.

typedef struct {

int	cbSize;

double	Acceleration;

double	MinVelocity;

double	Deadband;

double	Gain;

double	Offset;

int	Channel;

} MCJOGEX;

Member	Description

cbSize	size of the MCJOGEX data structure, in bytes.

Acceleration	Acceleration rate for use with jogging.

MinVelocity	Stepper motor jog minimum velocity (this parameter has no effect for servo motors).

Deadband	Deadband specifies a threshold value about the center position of the joystick below which motion of the joystick will not effect motor position. This prevents undesirable drifting of the motor due to mechanical and electrical variations in the joystick.

Gain	Gain value for jogging. This parameter is effectively multiplied by the current joystick position to produce a velocity. To increase the maximum velocity, set Gain to a larger value. To reverse the direction of motor travel with respect to joystick direction Gain may be set to a negative value.

Offset	Specifies the center position of the joystick, in volts.

Channel	Analog input channel to read joystick from (MultiFlex only)..

Comments

The jog settings determine the performance of an axis when the jogging inputs are active and jogging has been enabled.

See Also

MCEnableJog( ), MCGetJogConfigEx( ), MCSetJogConfigEx( )


MCMOTION Structure

The MCMOTION structure defines basic motion parameters for an axis. This structure has been superseded by the newer MCMOTIONEX, which should be used for new designs.

typedef struct {

double	Acceleration;

double	Deceleration;

double	Velocity;

double	MinVelocity;

short int	Direction;

double	Gain;

double	Torque;

double	Deadband;

double	DeadbandDelay;

short int	StepSize;

short int	Current;

WORD	HardLimitMode;

WORD	SoftLimitMode;

double	SoftLimitLow;

double	SoftLimitHigh;

short int	EnableAmpFault;

short int	Rate;

} MCMOTION;

Member	Description

Acceleration	Acceleration rate for motion.

Deceleration	Deceleration rate for motion.

Velocity	Velocity for motion.

MinVelocity	Stepper motor jog minimum velocity (this parameter has no effect for servo motors).

Direction	Sets the direction of travel for velocity mode operation. Note that the interpretation of positive and negative will depend upon your hardware configuration:

Value	Description

MC_DIR_POSITIVE	Selects the positive travel direction.

MC_DIR_NEGATIVE	Selects the negative travel direction.

Gain	Gain value for motion.

Torque	Sets the maximum output torque level for servos. When a servo is operated in torque mode this value represents the continuous output level. The default output units are volts, but this may be scaled using the Constant member of the MCSCALE structure.

Deadband	Sets the position deadband value.

DeadbandDelay	Time limit that an axis must remain within the deadband area to qualify as "in range". If this value cannot be read back from the controller the Motion Control API function MCGetMotionConfig( ) will set this value to -1. MCSetMotionConfig( ) ignores this parameter if the value is equal to -1.

StepSize	Sets the stepsize output for stepper motor operation:

Value	Description

MC_STEP_FULL	Selects full step operation.

MC_STEP_HALF	Selects half step operation.

Current	Selects full or reduced current operation for for stepper motors. Reduced current is typically used with stepper motors when they are stopped in a single position for an extended time to reduce motor heating.

Value	Description

MC_CURRENT_FULL	Selects full current (normal) operation.

MC_CURRENT_HALF	Selects half current (idle) operation.

HardLimitMode	Enables hard (physical) limit switches and selects stopping mode. One or more of the following values may be OR'ed together:

Value	Description

MC_LIMIT_MINUS	Enables lower limit.

MC_LIMIT_PLUS	Enables upper limit.

MC_LIMIT_ABRUPT	Selects abrupt stopping mode when a limit is encountered.

MC_LIMIT_SMOOTH	Selects smooth stopping mode when a limit is encountered.

MC_LIMIT_INVERT	Inverts the polarity of the harware limit switch inputs. This value may not be used with soft limits.

SoftLimitMode	Enables soft (software) limit switches and selects stopping mode. See the description of HardLimitMode for details.

SoftLimitLow	Sets "position" of low soft limit.

SoftLimitHigh	Sets "position" of high soft limit.

EnableAmpFault	Controls the amplifier fault input for servo motor axes:

Value	Description

TRUE	Enables amplifier fault input.

FALSE	Disables amplifier fault input.

Rate	This parameter is used to set the feedback loop rate for servo motors, or the maximum stepper pulse rate for stepper motor axes:

Value	Description

MC_RATE_UNKNOWN	Returned if MCAPI cannot determine the current rate.

MC_RATE_LOW	Selects the low range for feedback/step rate.

MC_RATE_MEDIUM	Selects the medium range for feedback/step rate.

MC_RATE_HIGH	Selects the high range for feedback/step rate.

Comments

All of the basic motion parameters are stored in the MCMOTION structure. Many of these parameters also have their own Get/Set functions, to permit setting on the fly.

When used with the DCX-PC100 and MC2xx series modules it is not always possible to read the RATE parameter from the motion controller (requires recent firmware). If MCAPI cannot read back this parameter it will return the value MC_RATE_UNKNOWN. If Rate is set to MC_RATE_UNKNOWN and a call is made to MCSetMotionConfig( ) the controller's Rate value will not be changed.

Compatibility

Soft limits (SoftLimitMode, SoftLimitLow, and SoftLimitHigh) and DeadbandDelay are supported only on the DCX-PCI and DCX-AT controllers. Deadband is supported only on the DCX-PCI300, DCX-AT, and the DC2-PC controllers.

See Also

MCGetMotionConfig( ), MCMOTIONEX, MCSetMotionConfig( )


MCMOTIONEX Structure
MCMOTIONEX Structure  (3.2)

The MCMOTIONEX structure defines basic motion parameters for an axis.

typedef struct {

int	cbSize;

double	Acceleration;

double	Deceleration;

double	Velocity;

double	MinVelocity;

int	Direction;

double	Torque;

double	Deadband;

double	DeadbandDelay;

int	StepSize;

int	Current;

int	HardLimitMode;

int	SoftLimitMode;

double	SoftLimitLow;

double	SoftLimitHigh;

int	EnableAmpFault;

} MCMOTION;

Member	Description

cbSize	size of the MCMOTIONEX data structure, in bytes.

Acceleration	Acceleration rate for motion.

Deceleration	Deceleration rate for motion.

Velocity	Velocity for motion.

MinVelocity	Stepper motor jog minimum velocity (this parameter has no effect for servo motors).

Direction	Sets the direction of travel for velocity mode operation. Note that the interpretation of positive and negative will depend upon your hardware configuration:

Value	Description

MC_DIR_POSITIVE	Selects the positive travel direction.

MC_DIR_NEGATIVE	Selects the negative travel direction.

Torque	Sets the maximum output torque level for servos. When a servo is operated in torque mode this value represents the continuous output level. The default output units are volts, but this may be scaled using the Constant member of the MCSCALE structure.

Deadband	Sets the position deadband value.

DeadbandDelay	Time limit that an axis must remain within the deadband area to qualify as "in range". If this value cannot be read back from the controller the Motion Control API function MCGetMotionConfigEx( ) will set this value to -1. MCSetMotionConfigEx( ) ignores this parameter if the value is equal to -1.

StepSize	Sets the stepsize output for stepper motor operation:

Value	Description

MC_STEP_FULL	Selects full step operation.

MC_STEP_HALF	Selects half step operation.

Current	Selects full or reduced current operation for for stepper motors. Reduced current is typically used with stepper motors when they are stopped in a single position for an extended time to reduce motor heating.

Value	Description

MC_CURRENT_FULL	Selects full current (normal) operation.

MC_CURRENT_HALF	Selects half current (idle) operation.

HardLimitMode	Enables hard (physical) limit switches and selects stopping mode. One or more of the following values may be OR'ed together:

Value	Description

MC_LIMIT_MINUS	Enables lower limit.

MC_LIMIT_PLUS	Enables upper limit.

MC_LIMIT_ABRUPT	Selects abrupt stopping mode when a limit is encountered.

MC_LIMIT_SMOOTH	Selects smooth stopping mode when a limit is encountered.

MC_LIMIT_INVERT	Inverts the polarity of the harware limit switch inputs. This value may not be used with soft limits.

SoftLimitMode	Enables soft (software) limit switches and selects stopping mode. See the description of HardLimitMode for details.

SoftLimitLow	Sets "position" of low soft limit.

SoftLimitHigh	Sets "position" of high soft limit.

EnableAmpFault	Controls the amplifier fault input for servo motor axes:

Value	Description

TRUE	Enables amplifier fault input.

FALSE	Disables amplifier fault input.

Comments

All of the basic motion parameters are stored in the MCMOTION structure. Many of these parameters also have their own Get/Set functions, to permit setting on the fly.

When used with the DCX-PC100 and MC2xx series modules it is not always possible to read the RATE parameter from the motion controller (requires recent firmware). If MCAPI cannot read back this parameter it will return the value MC_RATE_UNKNOWN. If Rate is set to MC_RATE_UNKNOWN and a call is made to MCSetMotionConfig( ) the controller's Rate value will not be changed.

Compatibility

Soft limits (SoftLimitMode, SoftLimitLow, and SoftLimitHigh) and DeadbandDelay are supported only on the DCX-PCI and DCX-AT controllers. Deadband is supported only on the DCX-PCI300, DCX-AT, and the DC2-PC controllers.

See Also

MCGetMotionConfigEx( ), MCSetMotionConfigEx( )


MCPARAM Structure

The MCPARAM structure provides basic information about the type and configuration of a controller, including the number and types of axes supported. New programs should use the MCPARAMEX structure instead of MCPARAM.

typedef struct {

short int	ID;

short int	ControllerType;

short int	NumberAxes;

short int	DigitalIO

short int	AnalogInput;

short int	AnalogOutput;

short int	AxisType[8];

short int	CanDoScaling;

short int	CanDoContouring;

short int	CanChangeProfile;

short int	CanChangeRates;

short int	SoftLimits;

short int	MultiTasking;

short int	AmpFault;

} MCPARAM;

Member	Description

ID	ID number given this controller during driver setup, permits easy translation of a controller handle back to an ID.

ControllerType	OEM controller type identifier. It can be one of the following values:

Value	Description

DCXPC100	DCX series PC100 controller.

DCXAT100	DCX series AT100 controller.

DCXAT200	DCX series AT200 controller.

DC2PC100	DC2 series controller.

DC2STN	DC2 stand-alone series controller.

DCXAT300	DCX series AT300 controller.

DCXPCI300	DCX series PCI300 controller.

DCXPCI100	DCX series PCI100 controller.

MFXPCI1000	MultiFlex PCI series 1000 controller.

MFXETH1000	MultiFlex ETH series 1000 controller.

NumberAxes	Number of axes this controller is currently configured for.

DigitalIO	Contains the number of digital IO channels installed.

AnalogInput	The number of installed analog input channels.

AnalogOutput	The number of analog output channels.

AxisType	Array of OEM axis type specifiers, one per axis. This array of values supports a maximum of eight axes – new programs should use MCAXISCONFIG for axis specific information.

Value	Description

DC2SERVO	Identifies the dedicated servo output of a DC2 controller.

DC2STEPPER	Identifies the optional stepper output of a DC2 controller.

MC100	Identifies a DC Servo axis with analog signal output.

MC110	Identifies a DC Servo axis with motor output.

MC150	Identifies a stepper motor axis.

MC160	Identifies a stepper motor with encoder axis.

MC200	Identifies an Advanced Servo axis with analog signal output.

MC210	Identifies an Advanced Servo axis with PWM motor output.

MC260	Identifies an Advanced Stepper axis.

MC300	Identifies a DSP-Based Servo axis with analog signal output.

MC302	Identifies a DSP-Based Dual-Servo axis with analog signal output.

MC320	Identifies an DSP-Based Brushless AC Servo axis with analog signal output.

MC360	Identifies a DSP-Based Stepper axis.

MC362	Identifies a DSP-Based Dual-Stepper axis.

MF300	Identifies this axis as an RS-232 communications module. This module is not normally used with a controller installed in a PC adapter slot.

MF310	Identifies this axis as an IEEE-488 (GPIB) communications module. This module is not normally used with a controller installed in a PC adapter slot.

MC400	Identifies this axis as providing additional digital I/O channels (16).

MC500	Identifies this axis as providing additional analog channels.

MFXSERVO	Identifies the dedicated servo output of a MultiFlex controller.

MFXSTEPPER	Identifies the dedicated stepper output of a MultiFlex controller.

CanDoScaling	Controller support for scaling (see MCSCALE structure) flag:

Value	Description

TRUE	Scaling is supported.

FALSE	Scaling isn’t supported.

CanDoContouring	Controller support for contouring (see MCCONTOUR structure) flag:

Value	Description

TRUE	Contouring is supported.

FALSE	Contouring not supported.

CanChangeProfile	Controller can change acceleration/deceleration profile:

Value	Description

TRUE	Profile change is supported.

FALSE	Profile change not supported.

CanChangeRates	Controller support for selectable rates (see MCMOTION structure) flag:

Value	Description

TRUE	Rate changing is supported.

FALSE	Rate changing isn’t supported.

SoftLimits	Controller supports soft limits (see MCMOTION structure) flag:

Value	Description

TRUE	Soft Limits are supported.

FALSE	Soft Limits are not supported.

MultiTasking	Controller supports multitasking flag:

Value	Description

TRUE	Multitasking is supported.

FALSE	Multitasking is not supported.

AmpFault	Controller supports amplifier fault flag:

Value	Description

TRUE	Amplifier fault input is supported.

FALSE	Amplifier fault input is not supported.

Comments

New programs should use the MCPARAMEX structure instead of MCPARAM.

See Also

MCGetConfiguration( )


MCPARAMEX Structure
MCPARAMEX Structure  (3.0)

The MCPARAMEX structure provides basic information about the type and configuration of a controller, including the number of axes, amount of I/O, and the range of I/O.

typedef struct {

long int	cbSize;

long int	ID;

long int	ControllerType;

long int	NumberAxes;

long int	MaximumAxes;

long int	MaximumModules;

long int	Precision;

long int	DigitalIO

long int	AnalogInput;

long int	AnalogOutput;

long int	PointStorage;

long int	CanDoScaling;

long int	CanDoContouring;

long int	CanChangeProfile;

long int	CanChangeRates;

long int	SoftLimits;

long int	MultiTasking;

long int	AmpFault;

double      AnalogInpMin;	// added in version 3.4

double      AnalogInpMax;	// added in version 3.4

long int    AnalogInpRes;	// added in version 3.4

double      AnalogOutMin;	// added in version 3.4

double      AnalogOutMax;	// added in version 3.4

long int    AnalogOutRes;	// added in version 3.4

long int    OutputMode;	// added in version 3.4

long int    AtTarget;	// added in version 3.4

long int    OutputControl;	// added in version 3.4

} MCPARAMEX;

Member	Description

cbSize	size of the MCPARAMEX data structure, in bytes.

ID	ID number given this controller during driver setup, permits easy translation of a controller handle back to an ID.

ControllerType	OEM controller type identifier. It can be one of the following values:

Value	Description

DCXPC100	DCX series PC100 controller.

DCXAT100	DCX series AT100 controller.

DCXAT200	DCX series AT200 controller.

DC2PC100	DC2 series controller.

DC2STN	DC2 stand-alone series controller.

DCXAT300	DCX series AT300 controller.

DCXPCI300	DCX series PCI300 controller.

DCXPCI100	DCX series PCI100 controller.

MFXPCI1000	MultiFlex PCI series 1000 controller.

MFXETH1000	MultiFlex ETH series 1000 controller.

NumberAxes	Number of axes this controller is currently configured for.

MaximumAxes	Maximum number of axes this controller supports.

MaximumModules	Maximum number of modules this controller supports.

Precision	Best numerical precision of controller:

Value	Description

MC_TYPE_LONG	32-bit integer precision.

MC_TYPE_DOUBLE	64-bit floating point precision.

DigitalIO	Contains the number of digital IO channels installed.

AnalogInput	The number of installed analog input channels.

AnalogOutput	The number of analog output channels.

PointStorage	Number of learned points that may be stored using MCLearnPoint( )

CanDoScaling	Controller support for scaling (see MCSCALE structure) flag:

Value	Description

TRUE	Scaling is supported.

FALSE	Scaling isn’t supported.

CanDoContouring	Controller support for contouring (see MCCONTOUR structure) flag:

Value	Description

TRUE	Contouring is supported.

FALSE	Contouring not supported.

CanChangeProfile	Controller can change acceleration/deceleration profile:

Value	Description

TRUE	Profile change is supported.

FALSE	Profile change not supported.

CanChangeRates	Controller support for selectable rates (see MCMOTION structure) flag:

Value	Description

TRUE	Rate changing is supported.

FALSE	Rate changing isn’t supported.

SoftLimits	Controller supports soft limits (see MCMOTION structure) flag:

Value	Description

TRUE	Soft Limits are supported.

FALSE	Soft Limits are not supported.

MultiTasking	Controller supports multitasking flag:

Value	Description

TRUE	Multitasking is supported.

FALSE	Multitasking is not supported.

AmpFault	Controller supports amplifier fault flag:

Value	Description

TRUE	Amplifier fault input is supported.

FALSE	Amplifier fault input is not supported.

AnalogInpMin	Motherboard analog inputs minimum voltage (added in MCAPI version 3.4).

AnalogInpMax	Motherboard analog inputs minimum voltage (added in MCAPI version 3.4).

AnalogInpRes	Motherboard analog inputs resolution in bits (added in MCAPI version 3.4).

AnalogOutMin	Motherboard analog outputs minimum voltage (added in MCAPI version 3.4).

AnalogOutMax	Motherboard analog outputs minimum voltage (added in MCAPI version 3.4).

AnalogOutRes	Motherboard analog outputs resolution in bits (added in MCAPI version 3.4).

OutputMode	Controller supports the MCGetModuleOutputMode( ) MCAPI function (added in MCAPI version 3.5).

AtTarget	Controller supports the PositionDeadband and DelayAtTarget members of the MCFILTEREX structure (added in MCAPI version 3.5).

OutputControl	Controller supports the OutputOffset and OutputDeadband members of the MCFILTEREX structure (added in MCAPI version 3.5).

Comments

Unlike the other MCAPI structures, the values in this structure are fixed by the hardware configuration and may not be changed. The axis type information that existed in the old MCPARAM structure may now be found in the MCAXISCONFIG structure.

Before you call MCGetConfigurationEx( ) you must set the cbSize member to the size of this data structure. C/C++ programmers may use sizeof( ), Visual Basic and Delphi programmers will find current sizes for these data structures in the appropriate MCAPI.XXX header file.

Visual Basic users please note that the value used for TRUE in the MCPARAM structure is the Windows standard of 1, not the Basic value of -1. Direct comparisons, such as:

If (Param.CanDoScaling = True) Then

will fail. To get correct results use the constant WinTrue, declared in the MCAPI.BAS include file:

If (Param.CanDoScaling = WinTrue) Then

See Also

MCGetConfigurationEx( )


MCSCALE Structure

The MCSCALE structure defines basic scaling parameters for an axis.

typedef struct {

double	Constant;

double	Offset;

double	Rate;

double	Scale;

double	Zero;

double	Time;

} MCSCALE;

Member	Description

Constant	This factor acts as a scale factor for servo analog outputs. By calibrating your motor/amplifier combination, it is possible to scale the output with Constant so that torque settings may be specified directly in ft-lbs.

Offset	This offset represents an offset from a servo encoder’ index pulse to a zero position.

Rate	This factor acts as a multiplier for motion commands time values. The base controller time unit is the second, to convert this to minutes set the rate to 60.0, to convert to milliseconds rate should be set to 0.001.

Scale	This scaling factor is applied to motion parameters to convert from encoder counts to real world units.

Zero	Specifies that a soft zero should be located this distance from actual zero. By moving the soft zero around it is possible to have a series of position commands repeated at various spots in the range of travel without modifying the position commands. The actual zero position is not changed by this command.

Time	This is the time factor for controller level wait commands. See the discussion of the Rate parameter above for more information on setting this value. Note that a single Time value is maintained per controller (ie Time is axis independent).

Comments

The scale factors provide a consistent, easy method of relating motion values to the actual physical system being controlled.

See Also

MCGetScale( ), MCSetScale( )


MCTATUSEX Structure
MCSSTATUSEX Structure  (3.3)

The MCSTATUSEX structure defines basic status word information for an axis.

typedef struct {

int	cbSize;

DWORD	Status;

DWORD	AuxStatus;

DWORD	ProfileStatus;

DWORD	ModeStatus;

} MCSTATUSEX;

Member	Description

cbSize	size of the MCSTATUSEX data structure, in bytes.

Status	Controller's primary status word.

AuxStatus	Controller's auxiliary status word.

ProfileStatus	Controller's profile status word.

ModeStatus	Controller's mode status word.

Comments

With the introduction of the DC4-PCI6XX series of motion controllers it became necessary to reorganize the controller status words. The new status word interrupt feature allows the application to receive an asynchronous notification when any of the bits in the primary status word go true. Thus it was important that the primary status word of the DC4-PCI6XX controllers contain the critical status information that an application might want to be notified of. As a result some commonly used but non-critical status bits were moved to other status words. The new functions MCDecodeStatusEx( ) and MCGetStatusEx( ), together with the MCSTATUSEX data structure allow application programs to operate on all of thestatus words as though they were a single entity.

See Also

MCDecodeStatusEx( ), MCGetStatusEx( )


C / C++ Abort Sample

This example checks the status of a flag, and performs either an emergency stop or a normal stop for axis 3. The axis is sent to the home position after the stop. Note that the call to MCEnableAxis() is only required following the call to MCAbort().

if (AbortFlag == true) 	// if TRUE we abort motion

{

MCAbort(hCtlr, 3);	// stop the axis

MCEnableAxis(hCtlr, 3, true);	// must turn it back on

MCGoHome(hCtlr, 3);	// home axis 3

}

else

{

MCStop(hCtlr, 3);	// stop the axis

if (MCIsStopped(hCtlr, 3, 4.0))	// shouldn’t take more than 4 secs

{

MCGoHome(hCtlr, 3);	// home axis 3

}

}


Delphi Abort Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    AbortButtonClick - front panel button press event handler            }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called when the user clicks the Abort Button   }

{    on the front panel.                                                  }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TMain.AbortButtonClick(Sender: TObject);

begin

  MCAbort(hCtlr, wAxis);

end;


C# / .NET Abort Sample

This example checks the status of a flag, and performs either an emergency stop or a normal stop for axis 3. The axis is sent to the home position after the stop. Note that the call to EnableAxis() is only required following the call to Abort().

if (AbortFlag == true) 	// if TRUE we abort motion

{

Controller.Abort(3);	// stop the axis

Controller.EnableAxis(3, true);	// must turn it back on

Controller.GoHome(3);	// return axis to home position

}

else

{

Controller.Stop(3);	// stop the axis

if (ControllerIsStopped(3, 4.0))	// shouldn’t take more than 4 secs

{

Controller.GoHome(3);	// home axis 3

}

else

// error, didn’t stop in time, code to handle goes here

}


C / C++ Acceleration Sample

This example waits for a motion to complete, reads the current acceleration from the controller, doubles the acceleration, and starts another motion.

double Accel;

if (MCIsStopped(hCtlr, 3, 10.0) 	// should finish in <10 secs

{

if (MCGetAccelerationEx(hCtlr, 3, &Accel) == MCERR_NOERROR)

{

MCSetAcceleration(hCtlr, 3, Accel * 2);	// new acceleration

}

MCMoveRelative(hCtlr, 3, 1000.0);	// go...

}

else

{

// error code goes here, motor didn’t stop when it should have

}


Basic Analog I/O Sample

Sample analog input channel 3 and set analog output channel 5 to three times its value.

Dim value As Integer

value = MCGetAnalog(Controller, 3)

value = value * 3#

Call MCSetAnalog(Controller, 5, value)

Ramp the output of channel 5 from 0.0V up to 1.0V (using the 0-5V output) over ten seconds. The maximum A/D output of 4095 counts (or 5 volts) is divided by 5 volts to obtain a value of counts per volt. This 1 volt value is further divided into 100 steps (ten increments a second for ten seconds), to obtain a value in counts for each step increment.

Dim step As Integer

Dim i As Integer

step = (4095 / 5#) / 100 ' calculate step

For i = 0 To 100

Call MCSetAnalog(Controller, 5, i * step)	' voltage step

Call Sleep(100) 	' wait 0.1s

Next


C / C++ Analog I/O Sample

Sample analog input channel 3 and set analog output channel 5 to three times its value.

WORD wValue

wValue = MCGetAnalog(hCtlr, 3);

wValue *= 3.0;

MCSetAnalog(hCtlr, 5, wValue);

Ramp the output of channel 5 from 0.0V up to 1.0V (using the 0-5V output) over ten seconds. The maximum A/D output of 4095 counts (or 5 volts) is divided by 5 volts to obtain a value of counts per volt. This 1-volt value is further divided into 100 steps (ten increments a second for ten seconds), to obtain a value in counts for each step increment.

step = (4095 / 5.0) / 100;	// calculate step

for (i = 0; i < 100; i++)

{

MCSetAnalog(hCtlr, 5, i * step);	// voltage step

MCWait(hCtlr, 0.1);	// wait 0.1s

}


C / C++ Auxiliary Encoder Sample

Home axis 4 and zero the auxiliary encoder if it is not zero at the home position.

double Position;

MCGoHome(hCtlr, 4);	// send to zero

MCWaitForStop(hCtlr, 4, 0.1);	// wait till we're there

if (MCGetAuxEncPosEx(hCtlr, 4, &Position) == MCERR_NOERROR)

{

if (Position != 0.0)

{

SetAuxEncPos(hCtlr, 4, 0.0);	// set to zero

}

}


C / C++ Backlash Sample

Assume that we've determined a system has 200 encoder counts of backlash. This example moves the system to the middle of the backlash range and enables compensation. Note that the compensation value (in encoder counts) used with MCEnableBacklash() is half of the total amount of backlash.

MCMoveRelative(hCtlr, 1, -100.0);	// move to midle of backlash

if (MCIsStopped(hCtlr, 1, 20.0))	// should finish in <20 secs

{

MCEnableBacklash(hCtlr, 1, 100.0, true);	// enable backlash compensation

}


C / C++ Block Command Sample

This example defines a macro that cycles axis 2 back and forth 1000.0 counts with a half second delay at each end point:

if (MCBlockBegin(hCtlr, MC_BLOCK_MACRO, 10) == MCERR_NOERROR)

{

MCMoveRelative(hCtlr, 2, 1000.0);	// move plus 1000.0

MCWaitForStop(hCtlr, 2, 0.50);	// half second pause

MCMoveRelative(hCtlr, 2, -1000.0);	// move back 1000.0

MCWaitForStop(hCtlr, 2, 0.50);	// half second pause

MCRepeat(hCtlr, 30);	// repeat 30 more times

MCBlockEnd(hCtlr, NULL);	// end macro

}

MCMacroCall(hCtlr, 10);	// execute the macro


C / C++ High-Speed Capture Sample

This example enables the high-speed capture of 10 points on axis 1, waits for the data, and then retrieves the data from the controller.

long int count;

double   data[10];

MCEnableCapture(hCtlr, 1, 10);	// enable capture

do 	// wait for 10 points

{

MCGetCount(hCtlr, 1, MC_COUNT_CAPTURE, &count);

} while (count < 10);

MCGetCaptureData(hCtlr, 1, MC_CAPTURE_ACTUAL, 0, 10, &data);


C /C++ Capture Data Sample

This example captures 1000 data points from axis 3 and reads the captured data into an array for further processing.

double Data[1000];

MCBlockBegin(hCtlr, MC_BLOCK_COMPOUND, 0);

MCCaptureData(hCtlr, 3, 1000, 0.001, 0.0);

MCMoveRelative(hCtlr, 3, 1000.0);

MCWaitForStop(hCtlr, 3, 0.0);

MCBlockEnd(hCtlr, NULL);

//

//  Retrieve captured actual position data into local array

//

if (MCGetCaptureData(hCtlr, 3, MC_DATA_ACTUAL, 0, 1000, Data)

{

. . . 	// process data

}


C / C++ Close API Sample

This example closes an MCAPI handle in response to a Windows WM_DESTROY message.

case WM_DESTROY:	// from standard windows message loop

if (MCClose(hCtlr))	// non-zero means there was a problem

{

MessageBox(hWnd, "Error closing handle", "Sample Program", MB_OK);

}

PostQuitMessage(0);

return 0;


C / C++ High-Speed Compare Sample

This example sets the controller up for doing high-speed compare of 10 separate positions for axis 1.

long int count;

double   data[] = { 2.0, 3.0, 5.0, 7.0, 11.0 };

//

//  Enter the first five prime numbers as compare test points, download

//  them, begin the compare and wait for all five to occur.

//  For each valid compare the output is toggled. Note the first call to

//  MCConfigureCompare() is used to force the output to the off state.

//

MCConfigureCompare(hCtlr, 1, NULL, 0, 0.0, MC_COMPARE_DISABLE, 0.0);

MCConfigureCompare(hCtlr, 1, data, 5, 0.0, MC_COMPARE_TOGGLE, 0.0);

MCEnableCompare(hCtlr, 1, 5);	// enable compare

MCMoveRelative(hCtlr, 1, 100.0);

do 	// wait for 5 compares

{

MCGetCount(hCtlr, 1, MC_COUNT_COMPARE, &count);

} while (count < 5);

//

//  Use positions equally spaced 5 units apart (fixed compare), beginning

//  at 10.0 as compare  positions. Toggle the output pin on valid

//  compares. Wait for 20 compares to complete and turn off.

//

data[0] = 10.0;	// starting point

MCConfigureCompare(hCtlr, 1, data, 1, 5.0, MC_COMPARE_TOGGLE, 0.0);

MCEnableCompare(hCtlr, 1, 0);	// enable fixed compare

MCMoveRelative(hCtlr, 1, 100.0);

do 	// wait for 20 compares

{

MCGetCount(hCtlr, 1, MC_COUNT_COMPARE, &count);

} while (count < 20);

MCEnableCompare(hCtlr, 1, -1);	// turn off fixed compare


Basic Configuration Sample

This example reads motion and PID filter settings from dialog box controls and uses the settings to reconfigure an axis using MCSetMotionConfigEx() and MCSetFilterConfigEx(). Note that we call the appropriate MCGetxxx function first to fill the data structure in with the current axis settings.

Sub OKButton_Click ()

    Dim Motion As MCMotionEx	' object to hold motion configuration

    Dim Filter As MCFilterEx	' object to hold PID filter configuration

    Dim dmy As Integer	' for unused return value

'

'  Copy configuration from our dialog box edit controls

'

    Motion.cbSize = 100	‘ check MCAPI.BAS for current size

    dmy = MCSetMotionConfigEx(Controller, Axis, Motion)

    Motion.Torque = Torque.Text

    Motion.Velocity = Velocity.Text

    Motion.Acceleration = Accel.Text

    Motion.Deceleration = Decel.Text

    dmy = MCSetMotionConfigEx(Controller, Axis, Motion)

    Filter.cbSize = 92	‘ check MCAPI.BAS for current size

    dmy = MCGetFilterConfigEx(Controller, Axis, Filter)

    Filter.Gain = Gain.Text

    Filter.IntegralGain = IntGain.Text

    Filter.DerivativeGain = DerGain.Text

    Filter.IntegrationLimit = IntLimit.Text

    Filter.DerSamplePeriod = DerSample.Text

    Filter.VelocityGain = VelGain.Text

    Filter.FollowingError = FollowErr.Text

    dmy = MCSetFilterConfigEx(Controller, Axis, Filter)

End Sub


C / C++ Configuration Sample

This example reads motion and PID filter settings from dialog box controls in response to an OK button push and uses the settings to reconfigure the axis settings using MCSetMotionConfig() and MCSetFilterConfigEx().

//

//  Motion settings (GetDlgItemDouble() is a helper function defined

//  elsewhere)

//

case IDOK:

Motion.cbSize = sizeof(Motion);

MCGetMotionConfigEx(hCtrlr, iAxis, &Motion);

Motion.Acceleration     = GetDlgItemDouble(hDlg, IDC_TXT_ACCEL);

Motion.Deceleration     = GetDlgItemDouble(hDlg, IDC_TXT_DECEL);

Motion.Velocity         = GetDlgItemDouble(hDlg, IDC_TXT_VELOCITY);

Motion.Torque           = GetDlgItemDouble(hDlg, IDC_TXT_MAX_TORQUE);

Motion.EnableAmpFault   = IsDlgButtonChecked(hDlg, IDC_CHK_AMP);

MCSetMotionConfigEx(hCtrlr, iAxis, &Motion);

//

//  PID filter settings

//

Filter.cbSize = sizeof(Filter);

MCGetFilterConfigEx(hCtrlr, iAxis, &Filter);

Filter.Gain             = GetDlgItemDouble(hDlg, IDC_TXT_PROP_GAIN);

Filter.IntegralGain     = GetDlgItemDouble(hDlg, IDC_TXT_INT_GAIN);

Filter.DerivativeGain   = GetDlgItemDouble(hDlg, IDC_TXT_DER_GAIN);

Filter.IntegrationLimit = GetDlgItemDouble(hDlg, IDC_TXT_INT_LIMIT);

Filter.DerSamplePeriod  = GetDlgItemDouble(hDlg, IDC_TXT_DER_SAMPLE);

Filter.FollowingError   = GetDlgItemDouble(hDlg, IDC_TXT_FOLLOW_ERR);

Filter.VelocityGain     = GetDlgItemDouble(hDlg, IDC_TXT_VEL_GAIN);

MCSetFilterConfigEx(hCtrlr, iAxis, &Filter);


Delphi Configuration Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    OKBtnClick - front panel button event handler                        }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called when the user selects the OK Button     }

{    from the ServoDialog form. The form is closed and all changes        }

{    are sent to the controller.                                          }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TServoDialog.OKBtnClick(Sender: TObject);

var

  Motion: MCMOTIONEX;

  Filter: MCFILTEREX;

begin

  Motion.cbSize := SizeOf(Motion);

  Motion.Acceleration := StrToFloat(AccEdit.Text);

  Motion.Deceleration := StrToFloat(DecEdit.Text);

  Motion.Velocity := StrToFloat(MaxEdit.Text);

  Motion.Torque := StrToFloat(TorqueEdit.Text);

  MCSetMotionConfigEx(hCtlr, wAxis, Motion);

  Filter.cbSize := SizeOf(Filter);

  Filter.Gain := StrToFloat(GainEdit.Text);

  Filter.IntegralGain := StrToFloat(IntGainEdit.Text);

  Filter.IntegrationLimit := StrToFloat(LimitEdit.Text);

  Filter.DerivativeGain := StrToFloat(DerivEdit.Text);

  Filter.DerSamplePeriod := StrToFloat(SampleEdit.Text);

  Filter.FollowingError := StrToFloat(FollowEdit.Text);

  Filter.VelocityGain := StrToFloat(VelGainEdit.Text);

  MCSetFilterConfigEx(hCtlr, wAxis, Filter);

  Close;

end;


C / C++ Contouring Sample

This example examines gets the contouring configuration for axis 1, halves the vector acceleration, reconfigures the axis, and then performs a series of contour moves.

MCCONTOUR Contour;

if (MCGetContourConfig(hCtlr, 1, &Contour))

{

Contour.VectorAccel = Contour.VectorAccel / 2.0;

MCSetContourConfig(hCtlr, 1, &Contour);

}

MCSetOperatingMode(hCtlr, 1, 1, MC_MODE_CONTOUR);

MCSetOperatingMode(hCtlr, 2, 1, MC_MODE_CONTOUR);

MCSetOperatingMode(hCtlr, 3, 1, MC_MODE_CONTOUR);

//

//  Home all axes with a vector velocity of 60000.0

//

MCBlockBegin(hCtlr, MC_BLOCK_CONTR_LIN, 1);

MCGoHome(hCtlr, 1);

MCGoHome(hCtlr, 2);

MCGoHome(hCtlr, 3);

MCSetVectorVelocity(hCtlr, 1, 60000.0);

MCBlockEnd(hCtlr, NULL);

//

//  Linear move

//

MCBlockBegin(hCtlr, MC_BLOCK_CONTR_LIN, 1);

MCMoveAbsolute(hCtlr, 1, 10000.0);

MCMoveAbsolute(hCtlr, 2, 20000.0);

MCMoveRelative(hCtlr, 3, -5000.0);

MCBlockEnd(hCtlr, NULL);

//

//  Clockwise arc w/ MCArcCenter() and MCMoveAbsolute()

//

MCBlockBegin(hCtlr, MC_BLOCK_CONTR_CW, 1);

MCArcCenter(hCtlr, 1, MC_ABSOLUTE, 20000.0);

MCArcCenter(hCtlr, 2, MC_ABSOLUTE, 0.0);

MCMoveAbsolute(hCtlr, 1, 40000.0);

MCMoveAbsolute(hCtlr, 2, 0.0);

MCBlockEnd(hCtlr, NULL);

//

//  Clockwise arc w/ MCArcCenter() and MCArcEndAngle()

//

MCBlockBegin(hCtlr, MC_BLOCK_CONTR_CW, 1);

MCArcCenter(hCtlr, 1, MC_ABSOLUTE, 20000.0);

MCArcCenter(hCtlr, 2, MC_ABSOLUTE, 0.0);

MCArcEndAngle(hCtlr, 1, MC_ABSOLUTE, 0.0);

MCBlockEnd(hCtlr, NULL);

//

//  Clockwise arc w/ MCArcRadius() and MCMoveRelative()

//

MCBlockBegin(hCtlr, MC_BLOCK_CONTR_CW, 1);

MCMoveRelative(hCtlr, 1, 10000.0);

MCMoveRelative (hCtlr, 2, 10000.0);

MCArcRadius(hCtlr, 1, MC_ABSOLUTE, 10000.0);

MCBlockEnd(hCtlr, NULL);


C / C++ Deceleration Sample

Slow the deceleration of axis 4 if the setting is too abrupt.

double Decel;

if (MCGetDecelerationEx(hCtlr, 4, &Decel) == MCERR_NOERROR)

{

if (Decel > 500.0)

{

MCSetDeceleration(hCtlr, 4, 500.0);

}

}


Basic Digital I/O Sample

This example configures all the digital I/O channels on a controller for output, and then turns each channel on (in order) for a half second. Note: Not all I/O can be configured for Input or Output. Please check your user's manual.

Dim Param As MCParamEx

Dim i As Integer

Dim Val As Boolean

Param.cbSize = Len(Param)

Call MCGetConfigurationEx(Controller, Param)

For i = 1 To Param.DigitalIO

Call MCConfigureDigitalIO(Controller, i, MC_DIO_OUTPUT Or MC_DIO_HIGH)

Next

For i = 1 To Param.DigitalIO

Call MCEnableDigitalIO(Controller, i, True)

Call Sleep(500)	' (WIN32 API function)

Call MCEnableDigitalIO(Controller, i, False)

Next

'

' Next re-configure channel 3 for input, and put up a message

' box based on the input state

'

If MCConfigureDigitalIO(Controller, 3, MC_DIO_INPUT Or MC_DIO_HIGH) Then

Val = MCGetDigitalIO(Controller, 3)

If (Val = True) Then

MsgBox "Channel 3 input voltage high (>2.4VDC)", vbOKOnly, "Input State"

Else

MsgBox "Channel 3 input voltage low (<0.4VDC)", vbOKOnly, "Input State"

End If

End If


C / C++ Digital I/O Sample

This example configures all the digital I/O channels on a controller for output, and then turns each channel on (in order) for a half second.

MCPARAMEX Param;

Param.cbSize = sizeof(Param);

MCGetConfigurationEx(hCtlr, &Param);

for (i = 1; i <= Param.DigitalIO; i++)

{

MCConfigureDigitalIO(hCtlr, i, MC_DIO_OUTPUT | MC_DIO_HIGH);

}

for (i = 1; i <= Param.DigitalIO; i++)

{

MCEnableDigitalIO(hCtlr, i, true);

MCWait(hCtlr, 0.5);

MCEnableDigitalIO(hCtlr, i, false);

}

//

//  Next re-configure channel 3 for input, and put up a message

//  box based on the input state

//

if (MCConfigureDigitalIO(hCtlr, 3, MC_DIO_INPUT | MC_DIO_HIGH))

{

val = MCGetDigitalIO(hCtlr, 3);

if (val)	// MessageBox is a Windows API function

{

MessageBox(hParent, "Channel 3 input voltage high (>2.4VDC)",

  "MCAPI Sample", MB_ICONINFORMATION);

}

else

{

MessageBox(hParent, "Channel 3 input voltage low (<0.4VDC)",

  "MCAPI Sample", MB_ICONINFORMATION);

}

}


Basic Enable Axis Sample

This example shows how to use MCEnableAxis() to enable an axis for motion in response to a user clicking on a window button.

Sub On_Click ()

Call MCEnableAxis(Controller, Axis, True)

End Sub


Delphi Enable Axis Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    OnButtonClick - front panel button press event handler               }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called when the user clicks the On Button      }

{    on the front panel. Note the type conversion required to use the     }

{    pascal boolean value of True with the MCAPI.                         }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TMain.OnButtonClick(Sender: TObject);

begin

  MCEnableAxis(hCtlr, wAxis, SmallInt(True));

end;


C / C++ Error Notify Sample

In the following code fragment an application attempts to “hook” the error notification loop for a controller it has open. If it succeeds it gets the “MCErrorNotify” message value from Windows.

if ((hCtlr = MCOpen(3, MC_OPEN_BINARY, NULL)) >= 0)

{

MCErrorNotify(hWnd, hCtlr, MCERRMASK_STANDARD);

ErrorMessage = RegisterWindowMessage("MCErrorNotify");	// windows func

}

else

...	// unable to open controller processing goes here

To process the error messages, the following code is added to the main message processing loop for the windows specified by hWnd:

case WM_DESTROY:	// standard windows message

PostQuitMessage(0);

break;

default:	// look for an error message

if (uMsg == ErrorMessage)

{

strcpy(buffer, "Module ");

strcat(buffer, (LPSTR)lParam);

strcat(buffer, " reported the following error:\n\n");

strcat(buffer, MCTranslateError(wParam));

MessageBox(hWnd, buffer, gszAppName, MB_ICONEXCLAMATION | MB_OK);

return true;

}

else

DefWindowProc(hWnd, uMsg, wParam, lParam);

break;


C / C++ Digital Filter Sample

This example read the digital filter coefficients from axis #3 and downloads them to axis #2.

long int count, actual;

double   coeff[100];	// big enough for any filter

//

//  Retrieve the digital filter coefficients from axis #3

//

MCGetCount(hCtlr, 3, MC_COUNT_FILTERMAX, &count);

MCGetDigitalFilter(hCtlr, 3, coeff, count, &actual);

//

//  Download the coefficients to axis #2 and enable the filter

//

MCSetDigitalFilter(hCtlr, 2, coeff, actual);

MCEnableDigitalFilter(hCtlr, 2, true);


C / C++ Following Error Sample

This example starts axis 2 moving, and displays a message if the following error exceeds a limit value.

double Error;

MCMoveRelative(hCtlr, 2, 50000.0);

while (MCDecodeStatus(hCtlr, MCGetStatus(hCtlr, 2), MC_STAT_TRAJ) == false)

{

if (MCGetFollowingError(hCtlr, 2, &Error) == MCERRR_NOERROR)

{

if (Error > LIMIT_VALUE)

{

MessageBox(NULL, "Following Error",

 "Limit Exceeded", MB_ICONINFORMATION);

}

}

...	// additional processing

}


C / C++ Gearing Example

Set up axis 2 to reproduce the motions of axis 1 at 1/2 scale.

MCEnableGearing(hCtlr, 2, 1, 0.5, true);

MCMoveRelative(hCtlr, 1, 100.0);	// axis 2 moves 50.0


C / C++ Interrupt Sample

Configure axis one to notify the application if the following error is exceeded or a limit is tripped.

//

//  Configure axis #1 to notifuy us of following errors and tripped limits

//

unsigned int mask = 0x00000C00;	// MFX bits 10 and 11 (limits tripped)

MCEnableInterrupt(hWnd, hCtlr, 1, mask, IntCallback);

The callback function would look something like the following. Note that since the status value passed to the callback function has the same layout as the controller status word returned by MCGetStatus() we can use MCDecodeStatus() to test individual bits.

//

//  Callback function. Note how messages to window controls are posted rather

//  than sent in order to keep processing time short and prevent re-entrancy

//  problems with the window procedure

//

void CALLBACK IntCallback(HWND hWnd, HCTRLR hCtlr, WORD wAxis, DWORD Status)

{

//

//  Turn on GUI error indicators for each specific event

//

if (MCDecodeStatus(hCtlr, Status, MC_STAT_ERROR))

PostMessage(h_Error, BM_SETCHECK, WPARAM(BST_CHECKED), LPARAM(0));

if (MCDecodeStatus(hCtlr, Status, MC_STAT_PLIM_TRIP))

PostMessage(h_PLim, BM_SETCHECK, WPARAM(BST_CHECKED), LPARAM(0));

if (MCDecodeStatus(hCtlr, Status, MC_STAT_MLIM_TRIP))

PostMessage(h_MLim, BM_SETCHECK, WPARAM(BST_CHECKED), LPARAM(0));

}


C# / .NET Interrupt Sample

This example shows how to use a delegate in C# with the status interrupt function of the Motion Control API.

//

//  Hook the interrupt, set mask to notify us if limits are tripped. Note the

//  use of a GCHandle to lock the callback function in place (i.e. turn off

//  garbage collection).

//

private GCHandle gch;

. . .

Mcapi.InterruptCallback IntDelegate = new Mcapi.InterruptCallback(this.IntHandler);

gch = GCHandle.Alloc(IntDelegate);

UInt32 mask = 0x00000C00;	// MFX bits 10, and 11 (limits tripped)

Controller.EnableInterrupt(Axis, mask, IntDelegate);.

//

//  Interrupt handler function. Don’t attempt to mess with the GUI here as

//  we’re being called from a background thread. This example sets some

//  global status variables and returns.

//

public void IntHandler(Int32 hWnd, Int16 hCtlr, Int16 axis, UInt32 status)

{

if (Controller.DecodeStatus(status, Mcapi.StatusBit.PlusLimitTripped))

plus_limit = true;

if (Controller.DecodeStatus(status, Mcapi.StatusBit.MinusLimitTripped))

minus_limit = true;

}


C / C++ Open-Loop Stepper Homing

This example homes an open-loop stepper using the HOME input and the positive limit switch.

//

// Clear any previously latched home bit

//

MCEnableAxis(hCtlr, 1, false);

MCEnableAxis(hCtlr, 1, true);

//

// Enable limit switches, start velocity mode move

//

MCSetVelocity(hCtlr, 1, 10000.0);

MCSetAcceleration(hCtlr, 1, 100000.0);

MCSetDeceleration(hCtlr, 1, 100000.0);

MCSetLimits(hCtlr, 1, MC_LIMIT_SMOOTH | MC_LIMIT_BOTH, 0, 0, 0);

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_VELOCITY);

MCDirection(hCtlr, 1, MC_DIR_POSITIVE);

MCGoEx(hCtlr, 1, 0.0));

//

// Wait for Home or positive limit inputs

//

DWORD dwStatus = MCGetStatus(hCtlr, 1);

while (!MCDecodeStatus(hCtlr, dwStatus, MC_STAT_INP_INDEX) ||

               !MCDecodeStatus(hCtlr, dwStatus, MC_STAT_PLIM_TRIP))

{

    dwStatus = MCGetStatus(hCtlr, 1);

}

// If positive limit switch tripped

//

if (MCDecodeStatus(hCtlr, dwStatus, MC_STAT_PLIM_TRIP))

{

    MCEnableAxis(hCtlr, 1, true);

    MCDirection(hCtlr, 1, MC_DIR_NEGATIVE);

    MCSetVelocity(hCtlr, 1, 5000.0);

    MCGoEx(hCtlr, 1, 0.0);

}

//

// If Home sensor active, loop until sensor inactive

//

while (MCDecodeStatus(hCtlr, dwStatus, MC_STAT_INP_INDEX)

{

dwStatus = MCGetStatus(hCtlr, 1);

}

MCStop(hCtlr, 1);

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

MCDirection(hCtlr, 1, MC_DIR_NEGATIVE);

MCSetVelocity(hCtlr, 1, 5000.0);

MCGoEx(hCtlr, 1, 0.0);

//

//  Capture Home Sensor edge position

//

MCEdgeArm(hCtlr, 1, 1000.0);

if (!MCIsEdgeFound(hCtlr, 1, 10.0))

{

// Index not found within time limit (10 seconds),

// error handling code goes here

}

//

// Process edge and stop motor

//

MCWaitForEdge(hCtlr, 1, false);	// controller 'processes' index data

MCStop(hCtlr, 1);	// stop

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

Sleep(100);	// let settle 100 msec (WIN32 API)

//

// Move back to location of Home sensor edge

//

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_POSITION);

MCEnableAxis(hCtlr, 1, true);

MCMoveAbsolute(hCtlr, 1, -100.0);

MCIsStopped(hCtlr, 1, 2.0);

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

Sleep(100);


Basic Open-Loop Stepper Homing
Basic Stepper Homing

This example uses MCIndexArm() and MCWaitForIndex() to home a servo motor.

Dim lret As Long

'

' MCAPI rotary axis homing sequence - configure axis, start homing

'

Call MCSetOperatingMode(Controller, axis, 0, MC_MODE_VELOCITY)

Call MCDirection(Controller, axis, MC_DIR_POSITIVE)

Call MCSetVelocity(Controller, axis, 5000#)

Call MCGo(Controller, axis)

'

' Arm index and wait for index to be found

'

lret = MCIndexArm(Controller, axis, 0#)

If (MCIsIndexFound(Controller, axis, 10#) = False) Then

' Index not found within time limit (10 seconds),

' error handling code goes here, for example:

MsgBox "Unable to capture the index mark in 10 seconds.", vbOKOnly, "VBDemo"

Exit Sub

End If

'

' Process index and stop motor

'

lret = MCWaitForIndex(Controller, axis) ' controller 'processes' index data

Call MCStop(Controller, axis) ' stop motor

If (MCIsStopped(Controller, axis, 2#) = False) Then

' Motor failed to stop within time limit (2 seconds),

' error handling code goes here, for example:

MsgBox "Motor failed to settle in 2 seconds.", vbOKOnly, "VBDemo"

Exit Sub

End If

Call Sleep(100)	' let motor settle 100 msec (WIN32 API function)

'

' Move back to location of index mark

'

Call MCSetOperatingMode(Controller, axis, 0, MC_MODE_POSITION)

Call MCEnableAxis(Controller, axis, True)

Call MCMoveAbsolute(Controller, axis, 0#)	' move to where index was captured

If (MCIsStopped(Controller, axis, 2#) = False) Then

' Motor failed to stop within time limit (2 seconds),

' error handling code goes here, for example:

MsgBox "Motor failed to settle in 2 seconds.", vbOKOnly, "VBDemo"

Exit Sub

End If

Call Sleep(100)	' let motor settle 100 msec (WIN32 API function)


C / C++ Open-Loop Stepper Homing
C / C++ Stepper Homing

This example homes a stepper motor using just the positive limit switch.

//

// Enable limit switches, start velocity mode move

//

MCSetLimits(hCtlr, 1, MC_LIMIT_SMOOTH | MC_LIMIT_BOTH, 0, 0, 0);

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_VELOCITY);

MCSetVelocity(hCtlr, 1, 10000.0);

MCDirection(hCtlr, 1, MC_DIR_POSITIVE);

MCGoEx(hCtlr, 1, 0.0);

// Wait for positive limit inputs

//

DWORD dwStatus = MCGetStatus(hCtlr, 1);

while (!MCDecodeStatus(hCtlr, dwStatus, MC_STAT_PLIM_TRIP))

{

dwStatus = MCGetStatus(hCtlr, 1);

}

// Once positive limit is active move negative until inactive

//

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

MCEnableAxis(hCtlr, 1, true) ;

MCDirection(hCtlr, 1, MC_DIR_NEGATIVE);

MCSetVelocity(hCtlr, 1, 1000.0);

MCGoEx(hCtlr, 1, 0.0);

if (!MCDecodeStatus(hCtlr, dwStatus, MC_STAT_INP_PLIM))

{

dwStatus = MCGetStatus(hCtlr, 1);

}

// Stop axis and define leading edge of the limit as position 0

//

MCAbort(hCtlr, 1);

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

MCSetPosition(hCtlr, 1, 0.0);

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_POSITION);

MCEnableAxis(hCtlr, 1, true);

MCMoveAbsolute(hCtlr, 1, -100.0);


C / C++ Closed-Loop Stepper Homing

This example homes a closed-loop stepper motor using a coarse home, the positive limit switch, and an index mark.

//

// Enable hard limit switches, start velocity mode move

//

MCSetVelocity(hCtlr, 1, 50000.0);

MCSetAcceleration(hCtlr, 1, 100000.0);

MCSetDeceleration(hCtlr, 1, 100000.0);

MCSetLimits(hCtlr, 1, MC_LIMIT_SMOOTH | MC_LIMIT_BOTH, 0, 0, 0);

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_VELOCITY);

MCDirection(hCtlr, 1, MC_DIR_POSITIVE);

MCGoEx(hCtlr, 1, 0.0);

//

// Wait for coarse home or positive limit inputs

//

DWORD dwStatus = MCGetStatus(hCtlr, 1);

while (!MCDecodeStatus(hCtlr, dwStatus, MC_STAT_INP_HOME) &&

!MCDecodeStatus(hCtlr, dwStatus, MC_STAT_PLIM_TRIP))

{

dwStatus = MCGetStatus(hCtlr, 1);

}

//

// If positive limit switch active

//

if (MCDecodeStatus(hCtlr, dwStatus, MC_STAT_PLIM_TRIP))

{

MCEnableAxis(hCtlr, 1, true);

MCDirection(hCtlr, 1, MC_DIR_NEGATIVE);

MCGoEx(hCtlr, 1, 0.0);

//

// Wait for coarse home input true

//

while (!MCDecodeStatus(hCtlr, dwStatus, MC_STAT_INP_HOME))

{

dwStatus = MCGetStatus(hCtlr, 1);

}

}

//  Once within Coarse Home sensor range stop, move until Coarse Home sensor

//  is no longer active

//

MCStop(hCtlr, 1);

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

MCDirection(hCtlr, 1, MC_DIR_NEGATIVE);

MCGoEx(hCtlr, 1, 0.0);

while (MCDecodeStatus(hCtlr, dwStatus, MC_STAT_INP_HOME))

{

dwStatus = MCGetStatus(hCtlr, 1);

}

MCStop(hCtlr, 1);

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

//

// When Coarse Home no longer is active, move back towards coarse home

// until index mark is captured

//

MCSetVelocity(hCtlr, 1, 10000.0);

MCDirection(hCtlr, 1, MC_DIR_POSITIVE);

MCGoEx(hCtlr, 1, 0.0);

while (!MCDecodeStatus(hCtlr, dwStatus, MC_STAT_INP_HOME))

{

dwStatus = MCGetStatus(hCtlr, 1);

}

MCIndexArm(hCtlr, 1, 1000.0);

if (!MCIsIndexFound(hCtlr, 1, 10.0))

{

// Index not found within time limit (10 seconds),

// error handling code goes here

}

// Process index and stop motor

MCWaitForIndex(hCtlr, 1, 0);	// controller 'processes' index data

MCStop(hCtlr, 1);	// stop

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

Sleep(100);	// let settle 100 msec (WIN32 API)

//

// Move back to location of index mark

//

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_POSITION);

MCEnableAxis(hCtlr, 1, true);

MCMoveAbsolute(hCtlr, 1, 0.0);

MCIsStopped(hCtlr, 1, 2.0);

if (!MCIsStopped(hCtlr, 1, 2.0))

{

// Motor failed to stop within time limit (2 seconds),

// error handling code goes here

}

Sleep(100);


Delphi Home Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    HomeButtonClick - front panel button press event handler             }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called when the user clicks the Home Button    }

{    on the front panel.                                                  }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TMain.HomeButtonClick(Sender: TObject);

begin

   MCGoHome(hCtlr, wAxis);

end;


C / C++ Jog Configuration Sample

This example configures axis 6 with a new values for jog Acceleration and jog Deadband, then enables the axis for jogging.

MCJOG Jog;

if (MCGetJogConfig(hCtlr, 6, &Jog))

{

Jog.Acceleration = 1000.0;

Jog.Deadband = 0.06;

MCSetJogConfig(hCtlr, 6, &Jog);

MCEnableJog(hCtlr, 6, true);

}


C / C++ Limits Sample

Set the both hard limits of axis 1 to stop smoothly when tripped, ignore soft limits:

MCSetLimits(hCtlr, 1, MC_LIMIT_BOTH | MC_LIMIT_SMOOTH, 0, 0.0, 0.0);

Set the positive hard limit of axis 2 to stop by turning the motor off. Because axis 2 uses normally closed limit switches we must also invert the polarity of the limit switch. Soft limits are ignored.

MCSetLimits(hCtlr, 2, MC_LIMIT_PLUS | MC_LIMIT_OFF | MC_LIMIT_INVERT, 0, 0.0, 0.0);

Assume axis 3 is a linear motion with 500 units of travel. Set the both hard limits of this axis to stop abruptly. Set up soft limits that will stop the motor smoothly 10 units from the end of travel (i.e. at 10 and 490).

MCSetLimits(hCtlr, 3, MC_LIMIT_BOTH | MC_LIMIT_ABRUPT, MC_LIMIT_BOTH | MC_LIMIT_SMOOTH, 10.0, 490.0);


C / C++ Miscellaneous Config Sample

Loop through all axes on a controller and set the servo modules to unipolar operation with reversed phasing.

MCPARAMEX Param;

Param.cbSize = sizeof(Param);

MCGetConfigurationEx(hCtlr, &Param);

for (iAxis = 1; iAxis <= Param.NumberAxes; iAxis++)

{

if (Param.AxisType[iAxis - 1] == MC200)

{

MCSetModuleOutputMode(hCtlr, iAxis, MC_OM_UNIPOLAR);

MCSetServoOutputPhase(hCtlr, iAxis, MC_PHASE_REV);

}

}


Basic Move Sample

This example homes all axes, then draws a rectangle using absolute coordinates for axis 1 and relative coordinates for axis 2.

Dim lret As Long	' for function call error-code return value

Call MCEnableAxis(Controller, MC_ALL_AXES, True)	' enable all axes

Call MCGoHome(Controller, 1) ' send axis 1 home

Call MCGoHome(Controller, 2) ' send axis 2 home

lret = MCIsStopped(Controller, MC_ALL_AXES, 250#)	' wait till we're there

Call MCMoveAbsolute(Controller, 1, 1000#)	' bottom edge (out to 1000.0)

lret = MCIsStopped(Controller, 1, 250#)	' wait till we're there

Call MCMoveRelative(Controller, 2, 500#)	' right side (up by 500)

lret = MCIsStopped(Controller, 2, 250#)	' wait till we're there

Call MCMoveAbsolute(Controller, 1, 0#)	' top edge (back to zero)

lret = MCIsStopped(Controller, 1, 250#)	' wait till we're there

Call MCMoveRelative(Controller, 2, -500#)	' left side (down by 500)

lret = MCIsStopped(Controller, 2, 250#)	' wait till we're there

Similar to above, this sample uses MCIsAtTarget() in place of MCIsStopped(). It requires a motion controller that supports the At Target status bit and that the Deadband and DeadbandDelay parameters of the axis be configured.

Dim lret As Long	' for function call error-code return value

Dim Param As MCMOTIONEX	' setup deadband & deadband delay

Param.cbSize = Len(Param)	' initialize structure size

lret = MCGetMotionConfigEx(Controller, 1, Param)	' get axis1 info

Param.Deadband = 100#	' 100 encoder counts

Param.DeadbandDelay = 0.02	' 0.02 seconds

lret = MCSetMotionConfigEx(Controller, 1, Param)	' set axis1 info

lret = MCGetMotionConfigEx(Controller, 2, Param)	' get axis2 info

Param.Deadband = 100#	' 100 encoder counts

Param.DeadbandDelay = 0.02	' 0.02 seconds

lret = MCSetMotionConfigEx(Controller, 2, Param)	' set axis2 info

Call MCEnableAxis(Controller, MC_ALL_AXES, True)	' enable all axes

Call MCGoHome(Controller, 1)	' send axis 1 home

Call MCGoHome(Controller, 2)	' send axis 2 home

lret = MCIsAtTarget(Controller, MC_ALL_AXES, 250#

Call MCMoveAbsolute(Controller, 1, 1000#)	' bottom edge (out to 1000.0)

lret = MCIsAtTarget(Controller, 1, 250#)	' wait till we're there

Call MCMoveRelative(Controller, 2, 500#)	' right side (up by 500)

lret = MCIsAtTarget(Controller, 2, 250#)	' wait till we're there

Call MCMoveAbsolute(Controller, 1, 0#)	' top edge (back to zero)

lret = MCIsAtTarget(Controller, 1, 250#)	' wait till we're there

Call MCMoveRelative(Controller, 2, -500#)	' left side (down by 500)

lret = MCIsAtTarget(Controller, 2, 250#)	' wait till we're there


C / C++ Move Sample

This example homes all axes, then draws a rectangle using absolute coordinates for axis 1 and relative coordinates for axis 2.

MCEnableAxis(hCtlr, MC_ALL_AXES);	// enable all axes

MCGoHome(hCtlr, 1);	// send axis 1 home

MCGoHome(hCtlr, 2);	// send axis 2 home

MCIsStopped(hCtlr, MC_ALL_AXES, 250.0);	// wait till we're there

MCMoveAbsolute(hCtlr, 1, 1000.0);	// bottom edge (out to 1000.0)

MCIsStopped(hCtlr, 1, 250.0);	// wait till we're there

MCMoveRelative(hCtlr, 2, 500.0);	// right side (up by 500)

MCIsStopped(hCtlr, 2, 250.0);	// wait till we're there

MCMoveAbsolute(hCtlr, 1, 0.0);	// top edge (back to zero)

MCIsStopped(hCtlr, 1, 250.0);	// wait till we're there

MCMoveRelative(hCtlr, 2, -500.0);	// left side (down by 500)

MCIsStopped(hCtlr, 2, 250.0);	// wait till we're there

Similar to above, this sample uses MCIsAtTarget() in place of MCIsStopped(). It requires a motion controller that supports the At Target status bit and that the Deadband and DeadbandDelay parameters of the axis be configured.

MCEnableAxis(hCtlr, MC_ALL_AXES);	// enable all axes

MCGoHome(hCtlr, 1);	// send axis 1 home

MCGoHome(hCtlr, 2);	// send axis 2 home

MCIsAtTarget(hCtlr, MC_ALL_AXES, 250.0);	// wait till we're there

MCMoveAbsolute(hCtlr, 1, 1000.0);	// bottom edge (out to 1000.0)

MCIsAtTarget(hCtlr, 1, 250.0);	// wait till we're there

MCMoveRelative(hCtlr, 2, 500.0);	// right side (up by 500)

MCIsAtTarget(hCtlr, 2, 250.0);	// wait till we're there

MCMoveAbsolute(hCtlr, 1, 0.0);	// top edge (back to zero)

MCIsAtTarget(hCtlr, 1, 250.0);	// wait till we're there

MCMoveRelative(hCtlr, 2, -500.0);	// left side (down by 500)

MCIsAtTarget(hCtlr, 2, 250.0);	// wait till we're there


C# / .NET Move Sample

This example a rectangle using absolute coordinates for axis 1 and relative coordinates for axis 2.

Controller.EnableAxis(Mcapi.AllAxes, true);	// enable all axes

Controller.MoveAbsolute(1, 1000.0);	// bottom edge (out to 1000.0)

Controller.IsStopped(1, 250.0);	// wait till we're there

Controller.MoveRelative(2, 500.0);	// right side (up by 500)

Controller.IsStopped(2, 250.0);	// wait till we're there

Controller.MoveAbsolute(1, 0.0);	// top edge (back to zero)

Controller.IsStopped(1, 250.0);	// wait till we're there

Controller.MoveRelative(2, -500.0);	// left side (down by 500)

Controller.IsStopped(2, 250.0);	// wait till we're there


Delphi Move Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    MoveButtonClick - front panel button press event handler             }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called when the user clicks the Move Button    }

{    on the front panel. We read the state of the Absolute/Relative       }

{    radio buttons and select a move function based upon their state. The }

{    distance value is read directly from the front panel edit control.   }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TMain.MoveButtonClick(Sender: TObject);

begin

   if AbsRadio.Checked = True then

      MCMoveAbsolute(hCtlr, wAxis, StrToFloat(Distance.Text))

   else

      MCMoveRelative(hCtlr, wAxis, StrToFloat(Distance.Text));

end;


C / C++ Open Controller Sample

This sample scans through all possible ID's and opens the first controller it finds. If we are unable to open any controller, give the user a message describing the problem.

HCTRLR handles[MC_MAX_ID + 1];	// storage for error messages

int    i, count = 0;

char   szText[1536], szTemp[64];	// string message buffers

for (i = 0; i <= MC_MAX_ID; i++)	// loop through all possible IDs

{

if ((hCtlr = MCOpen(i, MC_OPEN_BINARY, NULL)) > 0)

{

break;	// got one, break out of loop

}

else

{

handles[i] = hCtlr;	// record any errrors

if (hCtlr != MCERR_NO_CONTROLLER)

{

count++;	// count errors

}

}

}

if (hCtlr < 0)	// hCtlr negative if we couldn't open anyone

{

//

// if count is non-zero we had errors, otherwise we just couldn't find any

// installed controllers

//

if (count) 	// it was one or more errors

{

lstrcpy(szText, "Unable to open for the following reasons:\n");

for (i = 0; i <= MC_MAX_ID; i++)

{

if (handles[i] != -1 * MCERR_NO_CONTROLLER)

{

char szBuffer[64];

MCTranslateError(handles[i], szBuffer, sizeof(szBuffer));

wsprintf(szTemp, "ID %2d: %s\n", i, szBuffer);

lstrcat(szText, szTemp);

}

}

MessageBox(hDlg, szText, gszAppName, MB_ICONEXCLAMATION | MB_OK);

}

else	// couldn't find any installed controllers

{

Message/Box(hDlg, "No controllers are configured for use. Run PMCSetup\n"

  "and configure at least 1 controller first.",

  gszAppName, MB_ICONEXCLAMATION | MB_OK);

}

}


C / C++ Open Controller Sample
C# / .NET Open Controller Sample

This sample attempts to open the controller at ID 0, if not successful it allow the user to select an available controller using the MCDLG SelectController dialog. See the C#Demo supplied with the MCAPI for a more complete example.

Controller = new Mcapi();

short id = 0;

while (true)

{

if (Controller.Open(id, Mcapi.OpenMode.Binary, null) == Mcapi.Error.NoError)

break;	// Success!

else

{

if ((id = Mcdlg.SelectController(null, id, Mcdlg.Flags.None, null)) >= 0)

continue;	// user selected another controller, try again

Application.Exit();	// user hit Cancel, exit app

}

}


C / C++ Optimal Position Sample

Obtain the optimal position for axis 5 (assumes axis 5 is moving already).

double Optimal;

if (MCGetOptimalEx(hCtlr, 5, &Optimal) == MCERR_NOERROR)

{

...	// process optimal reading

}


C / C++ Parameter Sample

This example examines the controller configuration to determine controller type.

MCPARAMEX Param;

Param.cbSize = sizeof(Param);

if (MCGetConfigurationEx(hCtlr, &Param))

{

switch (Param.ControllerType)

{

case DCXPC100:

...

break;

case DCXAT100:

...

break;

}

}


Basic Point Memory Sample

Move axis 1 and store position in consecutive next storage locations.

Dim index As Integer

Dim ret As Long

Call MCEnableAxis(Controller, 1, True)	' motor on

Call MCGoHome(Controller, 1)	' start from absolute zero

ret = MCIsStopped(Controller, 1, 60#)	' wait <= 60 secs

For index = 0 To 4

Call MCMoveRelative(Controller, 1, 1234#)	' move

ret = MCIsStopped(Controller, 1, 20#) 	' are we there (wait <= 20 secs)

Call MCLearnPoint(Controller, 1, index, MC_LRN_POSITION)

Next

Store several positions for axis 1 without actually moving the axis. Note that axis is disabled with MCEnableAxis() prior to storing positions

Call MCEnableAxis(Controller, 1, False)	' motor off

For index = 5 To 9

Call MCMoveRelative(Controller, 1, 2468#)	' nothing actually moves

Call MCLearnPoint(Controller, 1, index, MC_LRN_TARGET)

Next

This example moves to the stored positions, dwelling for 0.2 seconds at each point.

Call MCEnableAxis(Controller, 1, True)	' enable axis

For index = 0 To 9

Call MCMoveToPoint(Controller, 1, index)	' move to next point

ret = MCIsStopped(Controller, 1, 20#)

Sleep (200)	' WIN32 func, time in msec

Next


C / C++ Point Memory Sample

Move axis 1 and store position in consecutive next storage locations.

WORD wIndex;

MCEnableAxis(hCtlr, 1, true);	// motor on

MCGoHome(hCtlr, 1);	// start from absolute zero

MCIsStopped(hCtlr, 1, 60.0);	// shouldn’t take more than 60 secs

for (wIndex = 0; wIndex < 5; wIndex++)

{

MCMoveRelative(hCtlr, 1, 1234.0);	// move

MCIsStopped(hCtlr, 1, 20.0);	// are we there (wait up to 20 secs)

MCLearnPoint(hCtlr, 1, wIndex, MC_LRN_POSITION);

}

Store several positions for axis 4 without actually moving the axis. Note that axis is disabled with MCEnableAxis() prior to storing positions

WORD wIndex;

MCEnableAxis(hCtlr, 4, false);	// motor off

for (wIndex = 0; wIndex < 5; wIndex++)

{

MCMoveRelative(hCtlr, 4, 2468.0);	// nothing actually moves

MCLearnPoint(hCtlr, 4, wIndex, MC_LRN_TARGET);

}

This example moves to the stored positions, dwelling for 0.2 seconds at each point.

WORD wIndex;

MCEnableAxis(hCtlr, 4, true);	// enable axis

for (wIndex = 0; wIndex < 5; wIndex++)

{

MCMoveToPoint(hCtlr, 4, wIndex);	// move to next point

MCIsStopped(hCtlr, 1, 20.0);

Sleep(200);	// WIN32 function, time in msec

}


C / C++ Position Example

Read the position of axis 5, change the position using MCSetPosition(), and print the old and new positions.

OldPosit = MCGetPosition(hCtlr, 5);

MCSetPosition(hCtlr, 5, 333.0);

NewPosit = MCGetPosition(hCtlr, 5);

printf("Old = %lf    New = %lf\n", OldPosit, NewPosit);


C / C++ Profile Sample

This sample positions axis 1 in a while loop, alternating between parabolic and s-curve profiles.

WORD wProfile;

while (true)

{

if (MCGetProfile(hCtlr, 1, &wProfile))

{

if (wProfile == MC_PROF_SCURVE)	// flip profile

{

MCSetProfile(hCtlr, 1, MC_PROF_PARABOLIC);

}

else

{

MCSetProfile(hCtlr, 1, MC_PROF_SCURVE);

}

}

MCMoveRelative(hCtlr, 1, 1000.0);

...	// do additional processing

}


Basic Readout / Status Sample

Process timer messages by updating position displays, and decoding status bit into a series of LED front panel indicators.

Sub Timer1_Timer ()

Const NoColor = &H808080

Const Green = &HFF00&

Const Red = &HFF&

Const Yellow = &HFFFF&

Dim status, retval As Long

Dim Value As Double

Dim status As MCStatusEx

'

'  Update readouts first

'

retval = MCGetPositionEx(Controller, Axis, Value)

PositionBox.Caption = Format$(Value, ScaleFormat(Axis))

retval = MCGetOptimalEx(Controller, Axis, Value)

OptimalBox.Caption = Format$(Value, ScaleFormat(Axis))

retval = MCGetTargetEx(Controller, Axis, Value)

TargetBox.Caption = Format$(Value, ScaleFormat(Axis))

retval = MCGetFollowingError(Controller, Axis, Value)

FollowBox.Caption = Format$(Value, ScaleFormat(Axis))

'

'  Process status word for 'LED' settings. Each LED represents a status bit.

'

status.cbsize = Len(status)

status = MCGetStatusEx(Controller, Axis, status)

If (MCDecodeStatusEx(Controller, status, MC_STAT_TRAJ)) Then

TrajLED.FillColor = Green

Else

TrajLED.FillColor = NoColor

End If

If (MCDecodeStatusEx(Controller, status, MC_STAT_DIR)) Then

DirLED.FillColor = Yellow

Else

DirLED.FillColor = NoColor

End If

If (MCDecodeStatusEx(Controller, status, MC_STAT_INP_HOME)) Then

HomeLED.FillColor = Yellow

Else

HomeLED.FillColor = NoColor

End If

End Sub


Delphi Readout Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    DisplayTimer - front panel timer event handler                       }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called for each front panel timer event.       }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TMain.DisplayTimer(Sender: TObject);

var

  retVal: Longint;

  Value: Double;

  Status: MCSTATUSEX;

begin

{ First we update the position readouts }

  retVal := MCGetPositionEx(hCtlr, wAxis, Value);

  ActualPos.Caption := FormatFloat('0', Value);

  retVal := MCGetOptimalEx(hCtlr, wAxis, Value);

  OptimalPos.Caption := FormatFloat('0', Value);

  retVal := MCGetTargetEx(hCtlr, wAxis, Value);

  TargetPos.Caption := FormatFloat('0', Value);

  retVal := MCGetFollowingError(hCtlr, wAxis, Value);

  FollowError.Caption := FormatFloat('0', Value);

{ Next process status bits }

  Status.cbSize = SizeOf(Status);

  retVal := MCGetStatusEx(hCtlr, wAxis, Status);

  if (MCDecodeStatusEx(hCtlr, Status, MC_STAT_MTR_ENABLE) = Longint(True)) then

    OnLed.Brush.Color := clLime

  else

    OnLed.Brush.Color := clGray;

  if (MCDecodeStatusEx(hCtlr, Status, MC_STAT_TRAJ) = Longint(True)) then

    TrajLed.Brush.Color := clLime

  else

    TrajLed.Brush.Color := clGray;

end;


C# ? .NET Readout & Status Sample
C# / .NET Readout & Status Sample

Process timer messages by updating position displays, and decoding status bit into a series of LED front panel indicators.

private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)

{

Double temp = 0;

Controller.GetPositionEx(Axis, ref temp);

ActualReadout.Text = temp.ToString("F" + format);

Controller.GetOptimalEx(Axis, ref temp);

OptimalReadout.Text = temp.ToString("F" + format);

Controller.GetTargetEx(Axis, ref temp);

TargetReadout.Text = temp.ToString("F" + format);

Controller.GetFollowingError(Axis, ref temp);

FollowingErrorReadout.Text = temp.ToString("F" + format);

Mcapi.StatusEx status = new Mcapi.StatusEx();

status.cbSize = Marshal.SizeOf(status);

Controller.GetStatusEx(Axis, ref status);

TrajectoryLed.Checked = Controller.DecodeStatusEx(ref status, Mcapi.StatusBit.TrajectoryComplete);

DirectionLed.Checked = Controller.DecodeStatusEx(ref status, Mcapi.StatusBit.DirectionNeg);

CHomeLed.Checked = Controller.DecodeStatusEx(ref status, Mcapi.StatusBit.InputHome);

IndexLed.Checked = Controller.DecodeStatusEx(ref status, Mcapi.StatusBit.InputIndex);

}


C / C++ Reset Sample

Open and reset the controller before we do anything else; an error message is displayed if we can't open the controller.

HCTRLR  hCtlr;

if ((hCtlr = MCOpen(0, MC_OPEN_BINARY, NULL)) > 0)

{

MCReset(hCtlr, MC_ALL_AXES);	// reset!

}

else	// process MCOpen() error

{

MessageBox(NULL, MCTranslateError(hCtlr), "Demo", MB_ICONINFORMATION);

}


Delphi Reset Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    ResetControllerClick - menu option selection event                   }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called when the user selects the Reset menu    }

{    option. Current PMC controllers do not support reset of individual   }

{    axes (only MC_ALL_AXES supported).                                   }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TMain.ResetControllerClick(Sender: TObject);

begin

  MCReset(hCtlr, MC_ALL_AXES);

end;


C / C++ Scaling Sample

Set up scaling for axis 3 (time in milliseconds, moves in inches). If the axis is currently enabled we disable it before we change the scaling.

MCSCALE Scaling;

if (MCDecodeStatus(hctlr, MCGetStatus(hCtlr, 3), MC_STAT_MTR_ENABLE))

{

    MCEnableAxis(hCtlr, 3, false);	// turn off before we scale!

}

MCGetScale(hCtlr, 3, &Scaling);

Scaling.Rate = 0.001;	// time in milliseconds

Scaling.Scale = 1000.0;	// 1000 encoder counts/inch

MCSetScale(hCtlr, 3, &Scaling);


C / C++ Servo Homing Sample
C / C++ Servo Homing Sample (Old)

This example homes a servo axis. The homing commands are issued as a block using the MCBlockBegin() / MCBlockEnd() functions to "wrap" the homing commands. The block commands could also be used to convert this code to a macro (MC_BLOCK_MACRO) or to run this code as a separate task (MC_BLOCK_TASK).

Note that this sample has been superceded by a new sample that simplifies the task of homing a servo using functions release in MCAPI version 3.2.

MCBlockBegin(hCtlr, MC_BLOCK_COMPOUND, 0);

//

//  Enable the axis, place it in velocity mode, and move out of the

//  coarse home region.

//

MCEnableAxis(hCtlr, 1, true);

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_VELOCITY);

MCSetVelocity(hCtlr, 1, 1000.0);

MCDirection(hCtlr, 1, MC_DIR_POSITIVE);

MCGo(hCtlr, 1);

MCWaitForEdge(hCtlr, 1, false);

MCStop(hCtlr, 1);

MCWaitForStop(hCtlr, 1, 0.1);

//

//  Next move back into the coarse home region.

//

MCDirection(hCtlr, 1, MC_DIR_NEGATIVE);

MCGo(hCtlr, 1);

MCWaitForEdge(hCtlr, 1, true);

MCFindIndex(hCtlr, 1, 0.0);

MCStop(hCtlr, 1);

MCWaitForStop(hCtlr, 1, 0.1);

//

//  Return the axis to position mode and move back to the

//  "home" position.

//

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_POSITION);

MCEnableAxis(hCtlr, 1, true);

MCMoveAbsolute(hCtlr, 1, 0.0);

MCWaitForStop(hCtlr, 1, 0.1);

MCBlockEnd(hCtlr, NULL);


C / C++ Servo Homing Sample

This example uses MCIndexArm() and MCWaitForIndex() to home a servo motor.

//

// MCAPI rotary axis homing sequence

//

// Configure axis, start homing

//

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_VELOCITY);

MCDirection(hCtlr, 1, MC_DIR_POSITIVE);

MCSetVelocity(hCtlr, 1, 5000.0);

MCGo(hCtlr, 3);

//

// Arm index and wait for index to be found

//

MCIndexArm(hCtlr, 1, 0.0);

if (!MCIsIndexFound(hCtlr, 1, 10.0))

{

    // Index not found within time limit (10 seconds),

    // error handling code goes here

}

//

// Process index and stop motor

//

MCWaitForIndex(hCtlr, 1);       // controller 'processes' index data

MCStop(hCtlr, 1);               // stop

if (!MCIsStopped(hCtlr, 1, 2.0))

{

    // Motor failed to stop within time limit (2 seconds),

    // error handling code goes here

}

Sleep(100);     // let motor settle 100 msec (WIN32 API function)

//

// Move back to location of index mark

//

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_POSITION);

MCEnableAxis(hCtlr, 1, true);

MCMoveAbsolute(hCtlr, 1, 0.0);

MCIsStopped(hCtlr, 1, 2.0);

Sleep(100);


C / C++ Status Sample

The following example tests a status word for the trajectory complete condition. Depending upon the state of the status bit a front panel control is either enabled or disabled.

MCSTATUSEX Status;

MCGetStatusEx(hCtlr, 1, &Status);

if (MCDecodeStatusEx(hCtlr, &Status, MC_STAT_TRAJ))

{

SendMessage(hLEDTraj, LEDM_ON, NULL, NULL);

}

else

{

SendMessage(hLEDTraj, LEDM_OFF, NULL, NULL);

}


C / C++ Stepper Homing Sample

This example homes a stepper axis. The homing commands are issued as a block using the MCBlockBegin() / MCBlockEnd() functions to "wrap" the homing commands. The block commands could also be used to convert this code to a macro (MC_BLOCK_MACRO) or to run this code as a separate task (MC_BLOCK_TASK).

MCBlockBegin(hCtlr, MC_BLOCK_COMPOUND, 0);

//

//  Enable the axis, place it in velocity mode, and move in the

//  positive direction until the edge input is inactive

//

MCEnableAxis(hCtlr, 1, true);

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_VELOCITY);

MCSetVelocity(hCtlr, 1, 1000.0);

MCDirection(hCtlr, 1, MC_DIR_POSITIVE);

MCGo(hCtlr, 1);

MCWaitForEdge(hCtlr, 1, false);

MCStop(hCtlr, 1);

MCWaitForStop(hCtlr, 1, 0.1);

//

//  Next move in the negative direction until the edge input

//  goes active and set the position to zero.

//

MCDirection(hCtlr, 1, MC_DIR_NEGATIVE);

MCGo(hCtlr, 1);

MCFindEdge(hCtlr, 1, 0.0);

MCStop(hCtlr, 1);

MCWaitForStop(hCtlr, 1, 0.1);

//

//  Return the axis to position mode and move back to the

//  "home" position.

//

MCSetOperatingMode(hCtlr, 1, 0, MC_MODE_POSITION);

MCEnableAxis(hCtlr, 1, true);

MCMoveAbsolute(hCtlr, 1, 0.0);

MCWaitForStop(hCtlr, 1, 0.1);

MCBlockEnd(hCtlr, NULL);


Delphi Stop Sample

{-------------------------------------------------------------------------}

{                                                                         }

{  NAME                                                                   }

{    StopButtonClick - front panel button press event handler             }

{                                                                         }

{  DESCRIPTION                                                            }

{    This event handler is called when the user clicks the Stop Button    }

{    on the front panel.                                                  }

{                                                                         }

{-------------------------------------------------------------------------}

procedure TMain.StopButtonClick(Sender: TObject);

begin

   MCStop(hCtlr, wAxis);

end;


C / C++ Target Position Sample

This example updates the target position several times in quick succession, then reads back the new target.

double Target;

MCMoveAbsolute(hCtlr, 2, 0.0);	// target should be 0.0

MCMoveRelative(hCtlr, 2, 1234.0);	// target should be 1234.0

MCMoveRelative(hCtlr, 2, 1234.0);	// target should be 2468.0

if (MCGetTargetEx(hCtlr, 2, &Target) == MCERR_NOERROR)

{

if (Target != 2468.0)

{

... 	// print error message

}

}


C / C++ Timeout Sample

Temporarily change the timeout value of a controller to cover a long MCWait command, then change the timeout value back to its previous setting:

double OldTimeout;	// to save the previous setting

if (MCSetTimeoutEx(hCtlr, 35.0, &OldTimeout) == MCERR_NOERROR)

{

MCWait(hCtlr, 30.0);	// long wait (30 sec)

MCSetTimeoutEx(hCtlr, OldTimeout, NULL);	// won't change until wait completes

}


C / C++ Velocity Sample

This example checks to make sure the programmed velocity of an axis has not been set above a limiting value, reduces the velocity if necessary, before beginning a series of motions.

double Velocity;

if (MCGetVelocityEx(hCtlr, 3, &Velocity) == MCERR_NOERROR)

{

if (Velocity > 10000.0)	// is velocity above limit?

{

MCSetVelocity(hCtlr, 3, 10000.0);	// reduce velocity

}

MCMoveRelative(hCtlr, 3, 1234.0);	// move . . .

MCWaitForStop(hCtlr, 3, 0.1);

. . .

}


C / C++ Velocity Mode Sample

This sample places axis 3 in velocity mode, sets the direction based upon the sign of the newVelocity variable, programs the velocity and starts the axis moving.

MCSetOperatingMode(hCtlr, 3, 0, MC_MODE_VELOCITY);

MCDirection(hCtlr, 3, newVelocity < 0.0 ? MC_DIR_NEGATIVE : MC_DIR_POSITIVE);

MCSetVelocity(hCtlr, 3, fabs(newVelocity));

MCGo(hCtlr, 3);


C / C++ Version Sample

Assume we are using version 1.3a (version = 1 / release = 3 / revision = 0) of the MCAPI. The low level device driver for controller 3 happens to be version 1.4d (version 1 / release 4 / revision 3) of the driver.

char  szBuf[80];

DWORD dwVersion;

int   len;

if (hCtlr = MCOpen(3, MC_OPEN_BINARY) > 0)

{

dwVersion = MCGetVersion(hCtlr);

len = sprintf(szBuf, "DLL version %d.%d\n",

 LOBYTE(LOWORD(dwVersion)),

 HIBYTE(LOWORD(dwVersion)));

sprintf(szBuf + len, "Device driver version %d.%d",

 LOBYTE(HIWORD(dwVersion)),

 HIBYTE(HIWORD(dwVersion)));

MessageBox(NULL, szBuf, "Get Version", MB_ICONINFORMATION);

}

will display the following in a Windows message box:


C / C++ OEM Character I/O Sample

Get the current status from axis 6 and display it on the screen.

HCTLR hCtlr;

char  buffer[ ] = "1TS\r",	// note carriage return!

      *bp;

if (hCtlr = MCOpen(0, MC_OPEN_ASCII, NULL) > 0)

{

bp = buffer;	// pointer to our command string

while (*bp)	// process up to null terminator

{

pmcputc(hCtlr, *(bp++));	// send a character at a time

}

while ((c = pmcgetc(hCtlr)) != 0)	// process all reply chars

{

putchar(c);	// display it

}

}


C / C++ OEM Command Sample

The following example tests to see if a controller is ready to accept commands, writes a binary tell position command and reads the response. Note how the return value from each functions is used to determine the success of the function call.

#define TP  82	// the Tell Position command

char buffer[16];

if (pmcrdy(hCtlr))

{

buffer[0] = TP;	// command

buffer[1] = 1;	// axis number

buffer[2] = buffer[3] = buffer[4] = buffer[5] = 0;	// argument = 0

if (pmccmd(hCtlr, 6, buffer) != 0)	// send command

{

if (pmcrpy(hCtlr, 16, buffer) != 0)

{

...	// process reply

}

}

}


C / C++ OEM Command Sample

The following example tests to see if a controller is ready to accept commands, writes a binary tell position command and reads the response. Note how the return value from each functions is used to determine the success of the function call.

The new Ex (extended) version of the binary OEM commands are used to simplify the code.

#include "MCCL.H"	// command defs (i.e. 'TP')

long int arg, reply;

if (pmcrdy(hCtlr))

{

arg = 0;

if (pmccmdex(hCtlr, 1, TP, arg, MC_TYPE_LONG) == MCERR_NOERROR)

{

if (pmcrpy(hCtlr, reply, MC_TYPE_LONG) == MCERR_NOERROR)

{

...	// process reply

}

}

}


C / C++ OEM String Sample

Send the version "VE" command and read back the response.

char buffer[] = "VE\r";	// note carriage return!

pmcputs(hCtlr, buffer);	// send string

while (pmcgets(hCtlr, buffer, len) != 0)	// check if we got a reply

{

puts(buffer);	// yes - display it!

}


aAB Abort Motion
aAB    Abort Motion    (MCCL)

Performs an emergency stop.

Opcode:	10  (0x0A)

Platforms:	All


aAFn    Auxiliary Encoder Find Index
aAFn    Aux. Encoder Find Index    (MCCL)

Starts search for auxiliary encoder index.

Opcode:	235  (0xEB)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aAGn    Acceleration Gain
aAGn    Acceleration Gain    (MCCL)

Sets the acceleration feed-forward gain for a servo.

Opcode:	226  (0xE2)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aAH    Auxiliary Encoder Define Home
aAH    Auxiliary Encoder Define Home    (MCCL)

Sets the auxiliary encoder position of the selected axis to zero.

Opcode:	234(0xEA)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX AT100, DCX PC100


ALn    Accumulator Load
ALn    Accumulator Load    (MCCL)

Load accumulator with constant value n.

Opcode:	130  (0x82)

Platforms:	All


ARn    Accumulator Copy To Register
ARn    Accumulator Copy To Register    (MCCL)

Copy the contents of the accumulator to register n.

Opcode:	132  (0x84)

Platforms:	All


aAT    Auxiliary Encoder Tell Position
aAT    Auxiliary Encoder Tell Position    (MCCL)

Reports the auxiliary encoder's position.

Opcode:	233  (0xE9)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aAZ    Auxiliary Encoder Tell Index
aAZ    Auxiliary Encoder Tell Index    (MCCL)

Reports the auxiliary encoder's position where the index pulse
was last observed.

Opcode:	236  (0xEC)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aBCn    Begin Compare
aBCn    Begin Compare    (MCCL)

Enables high-speed compare operation.

Opcode:	324  (0x144)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


aBDn    Backlash Distance
aBDn    Backlash Distance    (MCCL)

Sets the backlash compensation distance for axis a to n.

Opcode:	208  (0xD0)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aBF    Backlash Compensation Off
aBF    Backlash Compensation Off    (MCCL)

Turns backlash compensation off.

Opcode:	207  (0xCF)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aBN    Backlash Compensation On
aBN    Backlash Compensation On    (MCCL)

Turns backlash compensation on.

Opcode:	206  (0xCE)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aCAn    Arc Center Absolute    (MCCL)

Specifies the center of an arc for contour path motion, in absolute units.

Opcode:	180  (0xB4)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aCBn    Capture Begin    (MCCL)

Enables position capture operation.

Opcode:	328  (0x148)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aCDn    Contour Distance
aCDn    Contour Distance    (MCCL)

Specify the distance for a user defined contour path.

Opcode:	193  (0xC1)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


CFx    Channel Off
CFx    Channel Off    (MCCL)

Turns the selected digital I/O channel off.

Opcode:	31  (0x1F)

Platforms:	All


aCG    Get Capture Count
aCG    Get Capture Count    (MCCL)

Retrieve the count of captured positions.

Opcode:	329  (0x149)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


CHx    Channel High
CHx    Channel High    (MCCL)

Configures a digital I/O channel for high true logic.

Opcode:	66  (0x42)

Platforms:	All


CIx    Channel In
CIx    Channel In    (MCCL)

Configures a digital I/O channel for input.

Opcode:	32  (0x20)

Platforms:	All


CLx    Channel Low
CLx    Channel Low    (MCCL)

Configures a digital I/O channel for low true logic.

Opcode:	67  (0x43)

Platforms:	All


aCMn    Contour Mode
aCMn    Contour Mode    (MCCL)

Places the selected axis in contour mode.

Opcode:	27  (0x1B)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


CNx    Channel On
CNx    Channel On    (MCCL)

Turns the selected digital I/O channel on.

Opcode:	33  (0x21)

Platforms:	All


aCPn    Contour Path
aCPn    Contour Path    (MCCL)

This command is used to form a compound command
that specifies a multi-axis contour path motion.

Opcode:	192  (0xC0)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aCRn    Arc Center Relative    (MCCL)

Specifies the center of an arc for contour path motion, relative
to the current position.

Opcode:	181  (0xB5)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


CTx    Channel Out
CTx    Channel Out    (MCCL)

Configures a digital I/O channel for output.

Opcode:	34  (0x22)

Platforms:	All


aDAn    Display Auxiliary Encoder
aDAn    Display Auxiliary Encoder    (MCCL)

Display the recorded auxiliary encoder positions for
the specified axis.

Opcode:	219  (0xDB)

Platforms:	MultiFlex


aDBn    Set Position Deadband
aDBn    Set Position Deadband    (MCCL)

Sets the position deadband that a controller uses to determine when
a controller is 'At Target'.

Opcode:	118  (0x76)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DC2 PC100


aDDn    Display Status
aDDn    Display Status    (MCCL)

Display the recorded status data for
the specified axis.

Opcode:	256  (0x100)

Platforms:	MultiFlex


aDGn    Deceleration Gain
aDGn    Deceleration Gain    (MCCL)

Sets the deceleration feed-forward gain for a servo.

Opcode:	227  (0xE3)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aDHn    Define Home
aDHn    Define Home    (MCCL)

Defines the current position of the selected axis to be n.

Opcode:	35  (0x23)

Platforms:	All


aDIn    Direction
aDIn    Direction    (MCCL)

Sets the direction of an axis when operating
in velocity mode.

Opcode:	36  (0x24)

Platforms:	All


aDOx    Display Optimal
aDOn    Display Optimal    (MCCL)

Display the recorded optimal positions for
the specified axis.

Opcode:	214  (0xD6)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200, DC2 PC100


aDQn    Display Torque
aDQn    Display Torque    (MCCL)

Display the recorded actual positions for
the specified axis.

Opcode:	189  (0xBD)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


aDRn    Display Recorded
aDRn    Display Recorded    (MCCL)

Display the recorded actual positions for
the specified axis.

Opcode:	213  (0xD5)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200, DC2 PC100


aDSn    Deceleration Set
aDSn    Deceleration Set    (MCCL)

Sets the deceleration rate for an axis to n.

Opcode:	117  (0x75)

Platforms:	All


aDTn    Set Delay At Target
aDTn    Set Delay At Target    (MCCL)

This command sets the time period during which a servo must
remain within the position deadband for the 'At Target' flag in the
motor status to be set.

Opcode:	197  (0xC1)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DC2 PC100


aDYn    Position Record Delay
aDYn    Position Record Delay   (MCCL)

Delay before beginning position recording.

Opcode:	190  (0xBE)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300


EAn    End Angle Absolute
EAn    End Angle Absolute    (MCCL)

Sets the end angle for an arc contour move.

Opcode:	187  (0xBB)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


EEn    Encoder Fault Enable
EEn    Encoder Fault Enable    (MCCL)

Sets the end angle for an arc contour move.

Opcode:	217  (0xD9)

Platforms:	MultiFlex


ELn    Edge Latch
ELn    Edge Latch Arm    (MCCL)

Enables the stepper edge input for homing.

Opcode:	228  (0xE4)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


ERn    End Angle Relative
ERn    End Angle Relative    (MCCL)

Sets the end angle for an arc contour move.

Opcode:	188  (0xBC)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


ESn    Encoder Scaling
ESn    Encoder Scaling    (MCCL)

Sets the encoder count to step ratio for closed-loop steppers.

Opcode:	229  (0xE5)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


ETn    Escape Task
ETn    Escape Task    (MCCL)

Cancels a background task.

Opcode:	251  (0xFB)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aFC    Full Current
aFC    Full Current    (MCCL)

Causes the full / half current signal of a stepper
module to go low.

Opcode:	64  (0x40)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX AT100, DCX PC100


aFEn    Find Edge
aFEn    Find Edge    (MCCL)

Initialize a stepper motor at a given position.

Opcode:	11  (0x0B)

Platforms:	All


aFF    Amplifier Fault Off
aFF    Amplifier Fault Off    (MCCL)

Disables the amplifier fault input of a servo module.

Opcode:	51  (0x33)

Platforms:	All


aFIn    Find Index
aFIn    Find Index    (MCCL)

Initialize a servo motor at a given position.

Opcode:	12  (0x0C)

Platforms:	All


aFLn    Digital Filter Load
aFLn    Digital Filter Load    (MCCL)

Load digital filter coefficient.

Opcode:	337  (0x151)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


aFN    Amplifier Fault On
aFN    Amplifier Fault On    (MCCL)

Enables the amplifier fault input of a servo module.

Opcode:	50  (0x32)

Platforms:	All


aFRn    Set Derivative Sampling Period
aFRn    Set Derivative Sampling Period    (MCCL)

Helps tune the servo loop to the inertial characteristics of the system.

Opcode:	39  (0x27)

Platforms:	All


aGCn    Get Compare Count
aGCn    Get Compare Count    (MCCL)

Retrieve the count of compares that have occured.

Opcode:	325  (0x145)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


aGFn    Get Digital Filter
aGFn    Get Digital Filter    (MCCL)

Retrieve digital filter coefficient n.

Opcode:	338  (0x152)

Platforms:	DCX PCI300, DCX AT300


aGH    Go Home
aGH    Go Home    (MCCL)

Causes an axis or all axes to move to the offset
position that was specified when the last DH, FE,
or FI command was issued.

Opcode:	13  (0x0D)

Platforms:	All


aGM    Gain Mode
aGM    Gain Mode    (MCCL)

Places the selected axis in gain mode.

Opcode:	8  (0x08)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200, DCX AT100, DCX PC100, DC2 PC100


aGO    Go
aGO    Go    (MCCL)

Causes one or all axes to begin motion
in velocity mode.

Opcode:	14  (0x0E)

Platforms:	All


GT
GTn    Generate Task    (MCCL)

Causes macro n to be executed as a background
task, or may be used to run a compound command
as a background task.

Opcode:	250  (0xFA)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aHC    Half Current
aHC    Half Current    (MCCL)

Causes the full / half current signal of a stepper
module to go high.

Opcode:	65  (0x41)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX AT100, DCX PC100


aHLn    Set High Motion Limit
aHLn    Set High Motion Limit    (MCCL)

Sets the high limit for soft limits.

Opcode:	211  (0xD3)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aHSn    High Speed
aHSn    High Speed    (MCCL)

Sets high speed mode for MC200, MC210, MC260, MC300, and MC360 modules.

Opcode:	232  (0xE8)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX AT100, DCX PC100


aIAn    Index Arm
aIAn    Index Arm    (MCCL)

Initialize a servo motor at a given position.

Opcode:	93  (0x5D)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aILn    Set Integration Limit
aILn    Set Integration Limit    (MCCL)

Limits the level of power that integral gain can use to reduce
error to zero.

Opcode:	40  (0x28)

Platforms:	All


aIMn    Set Input Mode
aIMn    Set Input Mode    (MCCL)

Sets the input mode (open-loop, closed-loop) for steppers

modules.

Opcode:	114  (0x72)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


aIPn    Interrupt on Absolute Position
aIPn    Interrupt on Absolute Position    (MCCL)

Sets the status word breakpoint bit when absolute position is reached.

Opcode:	96  (0x60)

Platforms:	All


aIOn    Set Integral Option
aIOn    Set Integral Option    (MCCL)

Sets the operating mode for the integral term of the PID filter.

Opcode:	205  (0xCD)

Platforms:	MultiFlex, DCX PCI300, DCX AT300


aIRn    Interrupt on Relative Position
aIRn    Interrupt on Relative Position    (MCCL)

Sets the status word breakpoint bit when relative position is reached.

Opcode:	97  (0x61)

Platforms:	All


aJAn    Set Jog Acceleration
aJAn    Set Jog Acceleration    (MCCL)

Sets the jog acceleration for the specified axis.

Opcode:	56  (0x38)

Platforms:	DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aJBn    Set Jog Deadband
aJBn    Set Jog Deadband    (MCCL)

Sets the jogging joystick input deadband for the specified axis.

Opcode:	223  (0xDF)

Platforms:	DCX PCI300, DCX AT300,DCX AT200, DCX PC100, DC2  PC100


aJF    Jogging Off
aJF    Jogging Off    (MCCL)

Disables jogging for the specified axis.

Opcode:	58  (0x4A)

Platforms:	DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aJGn    Set Jog Proportional Gain
aJGn    Set Jog Proportional Gain    (MCCL)

Sets the jog proportional gain for the specified axis.

Opcode:	220  (0xDC)

Platforms:	DCX PCI300, DCX AT300, DCX AT200, DCX PC100, DC2  PC100


aJN    Jogging On
aJN    Jogging On    (MCCL)

Enables jogging for the specified axis.

Opcode:	57  (0x49)

Platforms:	DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aJOn    Set Jog Offset
aJOn    Set Jog Offset    (MCCL)

Sets the jogging joystick input offset for the specified axis.

Opcode:	222 (0xDE)

Platforms:	DCX PCI300, DCX AT300, DCX AT200, DCX PC100, DC2  PC100


aJVn    Set Jog Minimum Velocity
aJVn    Set Jog Minimum Velocity    (MCCL)

Sets the jog minimum velocity for stepper motors.

Opcode:	55  (0x37)

Platforms:	DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aLAn    Load Commutation Phase A
aLAn    Load Commutation Phase A    (MCCL)

Load commutation Phase A setting.

Opcode:	330  (0x14A)

Platforms:	DCX PCI300, DCX AT300


aLBn    Load Commutation Phase B
aLBn    Load Commutation Phase B    (MCCL)

Load commutation Phase B setting.

Opcode:	331  (0x14B)

Platforms:	DCX PCI300, DCX AT300


aLCn    Load Compare
aLCn    Load Compare    (MCCL)

Load next value into compare memory.
Opcode:	322  (0x142)

Platforms:	DCX PCI300, DCX AT300


aLDn    Load Commutation Divisor
aLDn    Load Commutation Divisor    (MCCL)

Load commutation divisor setting.

Opcode:	333  (0x14D)

Platforms:	DCX PCI300, DCX AT300


aLEn    Load Commutation Pre-Scale
aLEn    Load Commutation Pre-Scale    (MCCL)

Load commutation prescale setting.

Opcode:	332  (0x14C)

Platforms:	DCX PCI300, DCX AT300


aLFn    Motion Limits Off
aLFn    Motion Limits Off    (MCCL)

Disables one or more 'hard' limit switch inputs or 'soft' position
limits for an axis.

Opcode:	54  (0x36)

Platforms:	All


aLLn    Set Low Motion Limit
aLLn    Set Low Motion Limit    (MCCL)

Sets the high limit for soft limits.

Opcode:	211  (0xD3)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aLMn    Limit Mode
aLMn    Limit Mode    (MCCL)

Configures how a controller will react when a 'hard'
or 'soft' limit is tripped.

Opcode:	52  (0x34)

Platforms:	All


aLNn    Motion Limits On
aLNn    Motion Limits On    (MCCL)

Enables one or more 'hard' limit switch inputs or 'soft' position
limits for an axis.

Opcode:	53  (0x35)

Platforms:	All


aLPn    Learn Position
aLPn    Learn Position    (MCCL)

Stores the specified axis' target position.

Opcode:	112  (0x70)

Platforms:	All


aLRn    Load Commutation Repeat
aLRn    Load Commutation Repeat    (MCCL)

Load commutation repeat setting.

Opcode:	334  (0x14E)

Platforms:	DCX PCI300, DCX AT300


aLSn    Low Speed
aLSn    Low Speed    (MCCL)

Sets low speed mode for MC200, MC210, MC260, MC300, and MC360 modules.

Opcode:	230  (0xE6)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aLTn    Learn Target
aLTn    Learn Target    (MCCL)

Stores the specified axis target position.

Opcode:	113  (0x71)

Platforms:	All


MCn    Macro Call
MCn    Macro Call    (MCCL)

Used to execute a previously defined macro.

Opcode:	2  (0x02)

Platforms:	All


aMAn    Move Absolute
aMAn    Move Absolute    (MCCL)

This command generates a move to absolute position n.

Opcode:	16  (0x10)

Platforms:	All


MD
MDn    Macro Define    (MCCL)

Used to define a new macro.

Opcode:	3  (0x03)

Platforms:	All


aMF    Motor Off
aMF    Motor Off    (MCCL)

Disables the specified axis.

Opcode:	17  (0x11)

Platforms:	All


aMN    Motor On
aMN    Motor On    (MCCL)

Enables the specified axis

Opcode:	19  (0x13)

Platforms:	All


aMPn    Move To Point
aMPn    Move To Point    (MCCL)

Used for moving one or more axes to a previously stored point.

Opcode:	20  (0x14)

Platforms:	All


aMRn    Move Relative
aMRn    Move Relative    (MCCL)

This command generates a move to the relative position n.

Opcode:	21  (0x15)

Platforms:	All


aMSn    Medium Speed
aMSn    Medium Speed    (MCCL)

Sets medium speed mode for MC200, MC210, MC260, MC300, and MC360 modules.

Opcode:	231  (0xE7)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aMVn    Set Minimum Velocity
aMVn    Set Minimum Velocity    (MCCL)

This command sets the minimum velocity for a stepper axis to n.

Opcode:	196  (0xC0)

Platforms:	All


aNC    Compare Increment
aNCn    Compare Increment    (MCCL)

Sets increment for equally spaced compare points.

Opcode:	323  (0x143)

Platforms:	DCX PCI300, DCX AT300


aNF    Digital Filter Off
aNF    Digital Filter Off    (MCCL)

Disables digital filter.

Opcode:	336  (0x150)

Platforms:	DCX PCI300, DCX AT300


aNS    No Synchronization
aNS    No Synchronization    (MCCL)

Turns off synchronization in contour path motions.

Opcode:	171  (0xAB)

Platforms:	All


OAx    Output Analog
OAx    Output Analog    (MCCL)

Output analog value to analog output channel x..

Opcode:	249  (0xF9)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aOCn    Compare Output Mode
aOCn    Compare Output Mode    (MCCL)

Set the output mode for position compare.

Opcode:	320  (0x140)

Platforms:	DCX PCI300, DCX AT300


aOMn    Set Module Output Mode
aOMn    Set Module Output Mode    (MCCL)

Used to set the output mode of servo or stepper modules.

Opcode:	216  (0xD8)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aOPn    Compare Output Period
aOPn    Compare Output Period    (MCCL)

Set the output period for position compare one-shot mode.

Opcode:	321  (0x141)

Platforms:	DCX PCI300, DCX AT300


aPHn    Set Servo Phase
aPHn    Set Servo Phase    (MCCL)

Sets output phasing of servo modules.

Opcode:	115  (0x73)

Platforms:	All


aPM    Position Mode
aPM    Position Mode    (MCCL)

Places the selected axis in position mode.

Opcode:	23  (0x17)

Platforms:	All


aPP    Set Profile to Parabolic
aPP    Set Profile to Parabolic    (MCCL)

Sets the acceleration / deceleration profile to parabolic.

Opcode:	237  (0xED)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aPRn    Position Recording
aPRn    Position Recording    (MCCL)

Configures data capture.

Opcode:	212  (0xD4)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200, DC2 PC100


aPS    Set Profile to S-Curve
aPS    Set Profile to S-Curve    (MCCL)

Sets the acceleration / deceleration profile to s-curve.

Opcode:	238  (0xEE)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aPT    Set Profile to Trapezoidal
aPT    Set Profile to Trapezoidal    (MCCL)

Sets the acceleration / deceleration profile to trapezoidal.

Opcode:	239  (0xEF)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aQM    Torque Mode
aQM    Torque Mode    (MCCL)

Places the selected axis in torque mode.

Opcode:	9  (0x09)

Platforms:	All


aRIn    Position Record Interval
aRIn    Position Record Interval   (MCCL)

Sets the interval between points for position
record mode.

Opcode:	191  (0xBF)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300


RMn Reset Macros
RMn    Reset Macros    (MCCL)

Erases currently defined macros from memory.

Opcode:	4  (0x04)

Platforms:	All


RPn    Repeat
RPn    Repeat    (MCCL)

Causes the command string to repeat n times.

Opcode:	100  (0x64)

Platforms:	All


RRn    Reset System
RRn    Arc Radius    (MCCL)

Sets the radius for an arc contour move.

Opcode:	182  (0xB6)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aRT    Reset System
aRT    Reset System    (MCCL)

Performs a complete reset of the controller, restoring all
default conditions, and leaving all axes in the "off" state.

Opcode:	42  (0x2A)

Platforms:	All


aSAn    Set Acceleration
aSAn    Set Acceleration    (MCCL)

Sets the maximum acceleration rate for an axis.

Opcode:	43  (0x2B)

Platforms:	All


aSDn    Set Derivative Gain
aSDn    Set Derivative Gain    (MCCL)

Sets the derivative gain of a servo's feedback loop.

Opcode:	44  (0x2C)

Platforms:	All


aSEn    Stop On Error
aSEn    Stop On Error    (MCCL)

Used to set the maximum following or position error
for a servo.

Opcode:	25  (0x19)

Platforms:	All


aSF    Step Full
aSF    Step Full    (MCCL)

Causes the full / half step signal of a stepper
module to go low.

Opcode:	62  (0x3E)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aSGn    Set Proportional Gain
aSGn    Set Proportional Gain    (MCCL)

Sets the proportional gain of a servo's feedback loop.

Opcode:	45  (0x2D)

Platforms:	All


aSH    Step Half
aSH    Step Half    (MCCL)

Causes the full / half step signal of a stepper
module to go high.

Opcode:	63  (0x3F)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DCX PC100


aSIn    Set Integral Gain
aSIn    Set Integral Gain    (MCCL)

Sets the magnitude of the accumulated position error
output signal.

Opcode:	46  (0x2E)

Platforms:	All


aSMn    Set Master
aSMn    Set Master    (MCCL)

Slaves axis a to master axis n.

Opcode:	26  (0x1A)

Platforms:	All


aSN    Synchronization On
aSN    Synchronization On    (MCCL)

Turns on synchronization in contour path motions.

Opcode:	170  (0xAA)

Platforms:	All


aSQn    Set Torque
aSQn    Set Torque    (MCCL)

Sets the maximum output level for servos.

Opcode:	116  (0x74)

Platforms:	All


aSSn    Set Slave Ratio
aSSn    Set Slave Ratio    (MCCL)

Sets the ratio between a master and a slave's motion.

Opcode:	29  (0x1D)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aST    Stop
aST    Stop    (MCCL)

Brings one or all axes to a halt.

Opcode:	22  (0x16)

Platforms:	All


aSVn    Set Velocity
aSVn    Set Velocity    (MCCL)

Sets the maximum velocity for a given axis.

Opcode:	47  (0x2f)

Platforms:	All


TAx    Tell Analog
TAx    Tell Analog    (MCCL)

Tell analog channel.

Opcode:	73  (0x49)

Platforms:	All


aTB    Tell Breakpoint
aTB    Tell Breakpoint    (MCCL)

Reports the position where the breakpoint for an axis
is placed.

Opcode:	91  (0x5B)

Platforms:	All


TCx    Tell Channel
TCx    Tell Channel    (MCCL)

Reports the on / off state for the specified digital I/O
channel.

Opcode:	74  (0x4A)

Platforms:	All


aTD    Tell Derivative Gain
aTD    Tell Derivative Gain    (MCCL)

Reports the derivative gain setting for a servo.

Opcode:	75  (0x4B)

Platforms:	All


aTF    Tell Following Error
aTF    Tell Following Error    (MCCL)

Reports the current following error for servos.

Opcode:	77  (0x4D)

Platforms:	All


aTG    Tell Proportional Gain
aTG    Tell Proportional Gain    (MCCL)

Reports the proportional gain setting for a servo.

Opcode:	78  (0x4E)

Platforms:	All


aTI    Tell Integral Gain
aTI    Tell Integral Gain    (MCCL)

Reports the integral gain setting for a servo.

Opcode:	79  (0x4F)

Platforms:	All


aTK    Tell Velocity Constant
aTK    Tell Velocity Constant    (MCCL)

Reports the velocity constant for a servo.

Opcode:	92  (0x5C)

Platforms:	All


aTL    Tell Integration Limit
aTL    Tell Integration Limit    (MCCL)

Reports the integration limit setting for a servo.

Opcode:	80  (0x50)

Platforms:	All


aTO    Tell Optimal
aTO    Tell Optimal    (MCCL)

Reports the desired position for servos, or the
current position for steppers.

Opcode:	89  (0x59)

Platforms:	All


aTP    Tell Position
aTP    Tell Position    (MCCL)

Reports the absolute position of the specified axis.

Opcode:	82  (0x52)

Platforms:	All


aTQ    Tell Torque
aTQ    Tell Torque    (MCCL)

Reports the torque setting of the specified of axis.

Opcode:	209  (0xD1)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DC2 PC100


TRn    Tell Register
TRn    Tell Register    (MCCL)

Tell the contents of register n.

Opcode:	87  (0x57)

Platforms:	All


aTS    Tell Status
aTS    Tell Status    (MCCL)

Reports 32-bit status word for the specified axis.

Opcode:	83  (0x53)

Platforms:	All


aTT    Tell Target
aTT    Tell Target    (MCCL)

Reports target position for the specified axis.

Opcode:	84  (0x54)

Platforms:	All


aTV    Tell Velocity
aTV    Tell Velocity    (MCCL)

Reports actual velocity for the specified axis.

Opcode:	85  (0x55)

Platforms:	All


aTX    Tell Contouring Count
aTX    Tell Contouring Count    (MCCL)

Reports the current contour path motion that an axis is performing.

Opcode:	88  (0x58)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DC2 PC100


aTZ    Tell Index
aTZ    Tell Index    (MCCL)

Reports the position where the index pulse was
observed.

Opcode:	90  (0x5A)

Platforms:	All


aUKn    Set User Output Constant
aUKn    Set User Output Constant    (MCCL)

Sets the user output constant for the given axis.

Opcode:	215  (0xD7)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aUOn    Set User Offset
aUOn    Set User Offset    (MCCL)

Sets the user offset for the given axis.

Opcode:	179  (0xB3)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aURn    Set User Rate
aURn    Set User Rate    (MCCL)

Sets the user rate for the given axis.

Opcode:	177  (0xB1)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aUSn    Set User Scale
aUSn    Set User Scale    (MCCL)

Sets the user scale constant for the given axis.

Opcode:	175  (0xAF)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


UTn    Set User Time
UTn    Set User Time    (MCCL)

Sets the user time for the controller.

Opcode:	178  (0xB2)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aUZn    Set User Zero
aUZn    Set User Zero    (MCCL)

Sets the user zero for the given axis.

Opcode:	176  (0xB0)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aVAn    Set Vector Acceleration
aVAn    Set Vector Acceleration    (MCCL)

Sets the acceleration rate for motion along a contour path.

Opcode:	173  (0xAD)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DC2 PC100


aVDn    Set Vector Deceleration
aVDn    Set Vector Deceleration    (MCCL)

Sets the deceleration rate for motion along a contour path.

Opcode:	174  (0xAE)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DC2 PC100


aVGn    Velocity Gain
aVGn    Velocity Gain    (MCCL)

Sets the feed-forward gain of the servo PID
feed-forward loop.

Opcode:	119  (0x77)

Platforms:	All


aVM    Velocity Mode
aVM    Velocity Mode    (MCCL)

Places the selected axis in velocity mode.

Opcode:	24  (0x18)

Platforms:	All


aVOn    Set Velocity Override
aVOn    Set Velocity Override    (MCCL)

Sets the multiplying factor that will be applied to the vector velocity
in contour mode.

Opcode:	224  (0xE0)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200


aVVn    Set Vector Velocity
aVVn    Set Vector Velocity    (MCCL)

Sets the maximum velocity for motion along a contour path.

Opcode:	172  (0xAC)

Platforms:	MultiFlex, DCX PCI300, DCX AT300, DCX AT200, DC2 PC100


WAn    Wait
WAn    Wait    (MCCL)

Inserts a wait period before going on to
the next command.

Opcode:	101  (0x65)

Platforms:	All


aWEn    Wait for Edge
aWEn    Wait for Edge    (MCCL)

Wait for the coarse home input to go to the
specified logic state.

Opcode:	102  (0x66)

Platforms:	All


WFx    Wait For Channel Off
WFx    Wait For Channel Off    (MCCL)

Waits until the specified digital I/O channel is "off".

Opcode:	103  (0x67)

Platforms:	All


WIx    Wait For Index
WIx    Wait For Index    (MCCL)

Waits until the servo index is found.

Opcode:	94  (0x5E)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200, DCX PC100


WNx    Wait For Channel On
WNx    Wait For Channel On    (MCCL)

Waits until the specified digital I/O channel is "on".

Opcode:	104  (0x68)

Platforms:	All


aWPn    Wair For Absolute Position
aWPn    Wait For Absolute Position    (MCCL)

Waits for the specified axis to reach the given absolute position.

Opcode:	98  (0x62)

Platforms:	All


aWRn    Wait For Relative Position
aWRn    Wait For Relative Position    (MCCL)

Waits for the specified axis to reach the given position, relative to the target
position for this axis.

Opcode:	99  (0x63)

Platforms:	All


aWSn    Wait For Stop
aWSn    Wait For Stop    (MCCL)

Wait until the specified axis is stopped (trajectory complete).

Opcode:	105  (0x69)

Platforms:	All


aWTn    Wait For Target
aWTn    Wait For Target    (MCCL)

Wait until the specified axis has reached its target position.

Opcode:	198  (0xC6)

Platforms:	MultiFlex, DCX PCI300, DCX PCI100, DCX AT300, DCX AT200


aYF    Digital Filter Off
aYF    Digital Filter Off    (MCCL)

Disable the digital filter.

Opcode:	335  (0x14F)

Platforms:	DCX PCI300, DCX AT300


aZF    Zero Digital Filter
aZF    Zero Digital Filter    (MCCL)

Zero the digital filter coefficients.

Opcode:	339  (0x153)

Platforms:	DCX PCI300, DCX AT300