Tutorial

Programming Tutorial

Introduction

The PCM-3240 4-Axes Stepping/Pulse-type Servo Motor Control Card is designed for general-purpose extreme motion applications. The PCM-3240 is a high-speed 4-Axes motion control card for the PC-104 bus that simplifies stepping and pulse-type servo motor control, giving you added performance from your motors. The card's intelligent NOVA MCX314-Motion ASIC builds in a variety of motion control functions, such as 2/3-axis linear interpolation, 2-axes circular interpolation, T/S-curve acceleration/deceleration rate and more. In addition, the PCM-3240 performs these motion control functions without processor load during driving. For advanced applications, Windows DLL drivers and user-friendly examples are supplied to decrease the programming load. Moreover, through a free bundled PCM-3240 motion utility, it is easy to complete configuration and diagnosis.

Features

The Advantech PCM-3240 provides users with the most requested motor control functions as seen below:
  • Independent 4-axes motion control
  • Support hand wheel and jog function
  • 2/3-axes linear interpolation function
  • 2-axes circular interpolation function
  • Continuous interpolation function
  • Programmable interrupt conditions
  • Programmable T/S-curve acceleration and deceleration
  • Up to 4MPPS pulse output for each axis
  • Two pulse output types: Up/Down or Pulse/Direction
  • Up to 1 MHz encoder input for each axis
  • Two encoder pulse input types: A/B phase or Up/Down
  • Position management and software limit switch function
  • Board ID

  • Motion Utility bundled for configuration and diagnosis

  • EEPROM

The Advantech PCM-3240 Device Driver offers the following main features

1. Initialize Hardware.

Function Name

Description

P3240MotDevAvailable

Search all available cards on the system.

P3240MotDevOpen

Open the device according to the board ID. This function will write 0x8000 to WR0 to reset the hardware first. Then initialize some static value for necessary register.

P3240MotDevClose

Close the device and clear all event.

P3240MotReset

Reset the P3240 to initial status and stop all current active functions.

2. Parameter Setting.

Function Name

Description

P3240MotAxisParaSet | Setting motion parameters for each axis or interpolation once, such as TS, SV, DV, MDV, AC, AK.
P3240SetStartSpeed | Setting start speed for each axis or interpolation individual.
P3240SetDrivingSpeed | Setting driving speed for each axis or interpolation individual.
P3240SetAcceleration | Setting acceleration for each axis or interpolation individual.
P3240SetDeceleration | Setting deceleration for each axis or interpolation individual.
P3240SetJerk | Setting jerk for each axis or interpolation individual.
P3240SetRange | Setting range for each axis or interpolation individual.
P3240MotChgDV | Change the assigned axis drive speed when moving.
P3240MotChgLineArcDV | Change the drive speed when Line and Arc moving.

3. Point to Point

Function Name

Description

P3240MotPtp | Force the assigned axis from current position to new position, for each axis will move by their own speed parameters.
P3240MoveAbs | Move one axis in absolute mode.
P3240MoveIns

Move one axis in relative mode.

P3240MotStop

This function will stop all the assigned axis in any motion function.

The following is flow chart:

4. Linear Interpolation

Function Name

Description

P3240MotLine Force the assigned axis from current position to new position by line Interpolation. (2-3 axes)
P3240MotStop

This function will stop all the assigned axis in any motion function.

The following is flow chart:

5. Circle/Arc Interpolation

Function Name

Description

P3240MotArc | Move from current position to new position via arc interpolation.(2 axes)
P3240MotArcTheta | Move from current position to new position via arc interpolation by degree. (2 axes)
P3240MoveCircle

Draw a circle by relative mode. (2 axes)

P3240MotStop

This function will stop all the assigned axis in any motion function.

The following is flow chart:

6. Continue Move

6.1 Move specified axis(axes) by a driving speed setting in P3240MotAxisParaSet or P3240SetDrivingSpeed.

Function Name

Description

P3240MotCmove Force the assigned axis to continue drive in user assigned direction.
P3240MotStop

This function will stop all the assigned axis in any motion function.

6.2 Set the paths as line or arc interpolation.

Function Name

Description

P3240InitialContiBuf | Allocate and initialize the path data buffer to continue path movement
P3240GetCurContiNum | Get the current movement path data sequence number.
P3240SetContiData | Put the path data to the path data buffer for movement when call P3240StartContiDrive API.
P3240StartContiDrive | Start continue path moving function
P3240FreeContiBuf | Release the path data buffer resource to system.
P3240MotStop

This function will stop all the assigned axis in any motion function.

The following is flow chart:

Remark:

1. Can get how much node number remain by calling P3240GetCurContiNum function after P3240StartContiDriver.

2. Continue data includes line and arc.

7. Continue Compare

Function Name

Description

P3240BuildCompTable | It provides a API to build a table, when interrupt occur the data of table will be put into comparator.
P3240BuildSpeedTable | It provides a API to build 2 table(1 compare table, 1 speed table), when when P counter >= Comp+ counter, then interrupt occur, the next data of compare table will be put into comparator. And the data of speed table will be put into MCX314(speed will be changed).
P3240SetOutputType | Setting Output type of WR3 for each axis.
P3240EnableComNLimit

Enable/disable setting for COMP- register which is used as the - direction software limit.

P3240EnableComPLimit

Enable/disable setting for COMP+ register which is used as the + direction software limit.

P3240SetCompareObject | Setting if real position counter or logical position counter is going to be compared with COMP+/- register.
P3240MotStop

This function will stop all the assigned axis in any motion function.

The following is the flow chart:

Remark: Reference to the console examples. (P3240ChangeSpeedOnFly, P3240CompTable)

8. Driving by External Signal

Function Name

Description

P3240MotExtMode

Set the external drive operation mode for assign axis.

P3240 support 2 external control mode, one is JOG mode and the other is Hand Wheel mode.

P3240MotStop

This function will stop all the assigned axis in any motion function.

9. Input/Output Signal

Function Name

Description

P3240SetOutputType | Setting Output type of WR3 for each axis.
P3240SetOutput | Level setting for output signals OUT4-7 as general purpose output signals.
P3240MotDI | Get the DI status of the P3240
P3240MotDO | Level setting for output signals OUT4-7 as general purpose output signals.

10. Servo Motor Feedback Signals

Function Name

Description

P3240SetInPosition | Setting logical level of nINPOS input signal and enable/disable of in-position nINPOS from servo driver.
P3240SetServoAlarm

Setting active level of input signal nALARM and enable/disable of servo alarm input signal nALARM.

P3240GetInput | Get the RR4 or RR5 value.

11. Real Time Monitoring

Function Name

Description

P3240GetAcel

Get the current axis’s acceleration or deceleration.

P3240GetDriverState | Display driving status of specified axis.
P3240GetError | Display error status of specified axis.
P3240GetInput | Get the RR4 or RR5 value.
P3240GetMotionInput | Get the RR2 value of specified axis.
P3240GetMotionState | Get the RR1 value of specified axis.
P3240GetPracticalRegister

Get the real position counter.

P3240GetSpeed

Get the current moving axis speed.

P3240GetTheorecticalRegister | Get the logical position counter.
P3240MotRdMultiReg | Get data from the assigned port.Can set more than one axis.
P3240MotRdReg | Get data from the assigned port.
P3240MotAxisBusy | Checking the assigned axis is busy or not. multi axes can be assigned at the same time.

12. Interrupt Event Relation

Function Name

Description

P3240MotEnableEvent | Provide eight interrupt mode.
P3240MotCheckEvent | Check the interrupt status when interrupt occur.

13. Home Functions

Function Name

Description

P3240MotHome | Force the assigned axis to Home position, each enabled axis will operate by their Home parameter setting. This function can only stop by P3240MotStop.
P3240MotHomeStatus | Get the Home process status, user can use this function when P3240MotHome is operating.

14. Error

Function Name

Description

P3240MotClrErr If error occurs, no more command can be send out. This function is used to clear error status.

The following condition can case the error:

(1) If motor reached the hardware or software limit.

(2) If motor is stopped by the EMG signal.

(3) If error is caused by ALARM signal.

15. EEPROM Functions

Function Name

Description

P3240WriteEEPROM | Write data to the EEPROM.
P3240ReadEEPROM | Read data from the EEPROM.


New Page 1

Install/Uninstall Utility

The interface of the PCM-3240 WinCE Install/Uninstall utility is displayed in the dialog box as shown below.

The following is a description of the PCM-3240 Install/Uninstall Utility dialog box.

Install: To install the driver

Remove: To remove the driver

Deselect: To release the focus of one selected device

Refresh: To detect whether or not the device is in the system

Install

Steps to install the device:

1. Set BaseAddress

Input base address as a hex number into the edit box. The base address must be consistent with the switch setting in the hardware.
2. Set IRQ

Select an unused IRQ in the system.
3. Select BoardID

Auto: If the auto is checked, the install/uninstall utility will select a minimum board ID which has not been used by the device.

Manual: If the auto is unchecked, a number from 0 to 15 can be input into the edit box, and it will be set as the device board ID if it has not already been used.
4. Click the Install button to install the device

If it is successful, a message box will be displayed as shown below:

Remove

Steps to remove the device from the system:
1. Select a device in the list box as shown below.

2. Click the Remove button.

The relative registry key will be deleted after the device is removed. If the last device in the system is removed successfully, the driver will be removed

Deselect

When a device in the list box is selected, the edit boxes will be used to show the parameters of the selected device, and the Adjust and Remove buttons will be usable.

To install a new device, click the Deselect button to free the selection of the current device, and use the edit boxes to input parameters for the new device.

Refresh

Because the PCM-3240 is not a PnP (Plug and Play) device, the computer cannot affirm if the device is in the system during the driver installation period. When the Refresh button is clicked, the Advantech program will detect if the selected device is in the system. If it is not, the program will set Not in System in the list box.


This window show the PCM

Index:

The interface of the PCM-3240 WinCE Motion Utility is as shown below:

Board Selection: Select which PCM-3240 board to operate with

Parameters: Set the PCM-3240 hardware parameters

Input Status: Monitor the PCM-3240 digital input and position counter value

Operation: Operate the PCM-3240 motion function

Profile Monitor: Monitor the motion profile

Exit: Quit the utility program


Board Selection:

The PCM-3240 utility will display the Board ID of all PCM-3240 devices available in the system. The interface for Board Selection is as shown below.

Steps for Board Selection:

1. Select device.

2. Press OK to select device, and press Exit to cancel.


Index

Parameter Setting:

The interface for Parameter Setting is as shown below:

All parameters are different from axis, and they can be loaded from or set to hardware.

1. Load Parameters:

The parameters can be loaded from the PCM-3240 hardware and drivers, and displayed in the dialog box.

Steps to load parameter:

(1) Select which axis to load.

(2) Press Load button.

2. Save Parameters:

The parameters displayed in the dialog box can be set to the PCM-3240 hardware and driver by pressing the Save button.

Steps to save parameters:

(1) Select which axis to save.

Multiple axes can be selected at the same time. The same parameters displayed in the dialog box will be saved in them.

(2) Press the Save button.

3. Reset:

The parameters will be set to default values and displayed in the dialog box, but they will not be set to the hardware until the Save button is used.

There are five groups of parameters for each axis, as shown below:

Group 1

Group 2

Group 3

Group 4

Home Parameter


New Page 1

Group 1 parameters:

The interface of the parameters of Group 1 is displayed as shown below:

1. Drive Speed Parameter Range Reference:

Range setting is to set a multiple for drive speed, acceleration (deceleration) and Rate of acceleration. The range setting can be set from 1 to 500.

For example, if the multiple is set to 1, the range of speed, acceleration, rate of acceleration is displayed as shown below:

If the range setting is set to a higher value, the device will have a larger multiple. , Although high speed driving is possible when the multiple increases, the speed resolution will be decreased. So, the user can set the multiple as small as possible if the range of the setting speed has covered the desired speed.

2. Drive Speed Parameter Setting:

Set the driving parameter for the PCM-3240 pulse output.

Initial Speed (SV): The parameter determining the initial velocity of the constant speed period in trapezoidal driving.

Drive Speed (DV): The parameter determining the velocity of the constant speed period during trapezoidal driving.

Max. Drive Speed (MDV): The parameter limiting the drive speed.

Acc. / Dec. (AC): The parameter determining the acceleration or deceleration of the trapezoidal driving. For S-curve acceleration/deceleration, it shows the linear acceleration until a specific driving value.

Rate of Acceleration (AK): the parameter determining the increasing/decreasing rate of acceleration/deceleration, in a time unit of S-curve acceleration/deceleration.


New Page 2

Group 2 parameters:

The interface of parameters Group 2 is displayed as shown below:

1. LMT+/LMT-H/W Limited Switch Operation Mode:

Set stop type as immediate stop type or slow down stop type when the hardware limits are active.

2. LMT+ Input Active Level:

Set the logical level of the positive (+) direction limit input signal

3. LMT- Input Active Level:

Set the logical level of the negative (-) direction limit input signal

4. Motor Alarm and In Position Input Setting:

Alarm and In Position signals are used only for servo motor drivers. Check to enable and uncheck to disable them.

Alarm: When it is enabled, PCM-3240 will check the Alarm input signals from the servo motor. If it is active, the driving will stop.

In Position: When it is enabled, the driving status will still be driving even if the output driving pulse is finished, until the In Position signal is active.

5. Motor Alarm Input Level Setting:

Set the active level of the input signal Alarm.

6. Motor In Position Input Level Setting:

Set the active level of the input signal In Position.


New Page 3

Group 3 parameters :

Each axis of PCM-3240 has 4 digital input (IN0~3) and 4 digital output (OUT4~7) channels, and the parameters of Group 3 are related to them. The interface of the parameters of Group 3 is displayed as shown below:

1. IN0 ~ IN3 Limited Switch Function Disable/Enable:

IN0 ~ IN3 can be used as driving stop input signals. For example, if IN1 is enabled as a driving stop input signal, the driving will stop if the IN1 input signal is active.

In PCM-3240 driver, IN0 is used as the Phase Z input signal of the encoder, and IN3 is used as the home limit sensor input signal. Please refer to the PCM-3240 hardware manual and check hardware connection before using IN0 and IN3.

Check to enable and uncheck to disable them.

2. IN0 Active Level:

Set the active level of the input signal IN0.

3. IN1 Active Level:

Set the active level of the input signal IN1.

4. IN2 Active Level:

Set the active level of the input signal IN2.

5. IN3 Active Level:

Set the active level of the input signal IN3.


New Page 4

Group 4 parameters :

The interface of parameters of Group 4 is displayed as shown below:

Enable/Disable Interrupts:

1. Interrupt occurs when the value of logical / real position counter is larger than that of COMP- register.
2. Interrupt occurs the value of logical / real position counter is smaller than that of COMP- register.
3. Interrupt occurs when the value of logical / real position counter is smaller than that of COMP+ register.
4. Interrupt occurs when the value of logical / real position counter is larger than that of COMP+ register.
5. Interrupt occurs when the pulse output is finished in the constant speed drive during an acceleration/deceleration driving.
6. Interrupt occurs when the pulse output is started in the constant speed drive during an acceleration/deceleration driving.
7. Interrupt occurs when the driving is finished.


New Page 1

Group 5 parameters:

The interface of the parameters of Group 5 is displayed as shown below:

1. nP+P/N nP-P/N Pulse Output Mode:

Set the pulse output mode (two pulse mode (CW/CCW) or one pulse mode (Pulse/Direction). The pulse output type must be selected according to motor type.

For detailed information about pulse output mode, please refer to the PCM-3240 hardware manual.

2. nP+P/N nP-P/N Pulse Output Level:

Set the pulse output level as shown below:

Pulse Output Active High:

Pulse Output Active Low:

3. nP-P/nP-N Direction Output Level:

Set the logical level of the direction (nP-P/nP-N) output signal according to motor type, when the PCM-3240 is used in Pulse/Direction output mode. Please refer to the PCM-3240 hardware manual for detailed information.

4. Acceleration Mode:

Set the acceleration mode as a T-curve or an S-curve.

T-curve acceleration/deceleration mode:

S-curve acceleration/deceleration mode:

If S-curve acceleration/deceleration mode is set, the rate for acceleration/deceleration increase or decrease should be set.

In the S-curve acceleration displayed above, there are three regions with different acceleration values. At the beginning, the acceleration increases linearly from 0 to the specific value A with a specific rate of acceleration K, this shows that the driving speed increases as a parabola curve in this region. Then, the driving speed increases in a constant acceleration in region b. And, in section c, the acceleration decelerates linearly to 0 with the rate of deceleration K. So the acceleration of the S-curve includes regions a, b and c.


Group 4 parameters

Group 6 parameters :

The interface of parameters of Group 6 is displayed as shown below:

1. Enable/Disable S/W Limited Switch Function:

COMP+ and COMP- can be used as software limit switches.

COMP+: If COMP+ is enabled during positive (+) direction driving, deceleration to stop will be performed when the value of the logical/real position counter is larger than that of COMP+.

COMP-: If COMP- is enabled during the negative (-) direction driving, deceleration to stop will be performed when the value of logical/real position counter is smaller than that of COMP-.

2. COMP+/- Register Comparing Mode:

The settings of COMP+/COMP- will be compared with the logical position counter or the real position counter.

3. Encoder Input Mode:

Set the type of encoder input signals. PCM-3240 support AB phase(quadrature pulse）input type and CW/CCW(Up/Down) pulse input type). For detailed information, please refer to the PCM-3240 hardware manual.

CW/CCW Pulse Mode:

When CW/CCW pulse input type is specified, nECAP/nECAN is for “count up” input and nECBP/nECBN is for “count down” input.

AB Phase 1/1 Mode:

Counts of real Position counter will increase or decrease by one during one encoder cycle.

AB Phase 1/2 Mode:

Counts of real Position counter will increase or decrease by two during one encoder cycle.

AB Phase 1/4 Mode:

Counts of real Position counter will increase or decrease by four during one encoder cycle.

4. OUT4 ~ 7 operation Mode:

Set digital output channels (OUT 4 ~ 7) used for general purposes or to show the driving status.

If DO channels are used for general purposes, the DO status can be specified as any values in the Input Status dialog box.

If DO channels are used to show the driving status, the DO status can be described as shown below:

Signal Name | Output description
OUT4 | Hi: if logical/real position counter >= COMP+ register Low: if logical/real position counter < COMP+ register
OUT5 | Hi: if logical/real position counter < COMP- register Low: if logical/real position counter >= COMP- register
OUT6 | When the driving command is engaged, the level becomes Hi once the driving status is in acceleration.
OUT7 | When the driving command is engaged, the level becomes Hi once the driving status is in deceleration.


New Page 5

Home Parameter:

The interface of the parameters of Home Parameter is displayed as shown below:

Setting 1 ~ 5 are used to set home parameters, we separate the home process into 4 phases (from phase0 to phase3), different home type contains different phases, for detailed information of each parameter please refer to the P3240MotHome function manual.

1. Home Type:

Set the HomeType parameter, can be set from 0 to 4

2. Phase 0 Setting:

Set the HomeP0_Dir and HomeP0_Speed parameters.

3. Phase 1 Setting:

Set the HomeP1_Dir and HomeP1_Speed parameters.

4. Phase 2 Setting:

Set the HomeP2_Dir parameter.

5. Phase 3 Setting:

Set the HomeOffSet and HomeOffSet_Speed parameters.

6. CW End and CCW End:

CW End: Set the CW end position parameter. It is used by the PCM-3240 DLL driver to check input parameters of driver functions. If any input parameter is larger than CW End, the function will return an error code as OverPLmtErr.

CCW End: Set the CCW end position parameter. It is used by the PCM-3240 DLL driver to check input parameters of driver functions. If any input parameter is smaller than CCW End, the function will return an error code as OverNLmtErr.


Operation:

User can use this window to easily operate the Home, Continue, Point to Point, Line or Arc functions

1. Operation Axis:

Specify which axis to operate. It must be the first step to do any operation.

For different drive modes, numbers of specified axes are different.

Home: Axes from 1 ~ 4 can be specified.

Continue Drive: Axes from 1 ~ 4 can be specified.

Point to Point Drive: Axes from 1 ~ 4 can be specified.

Line Profile Drive: Only 2 or 3 axes can be specified.

Arc Profile Drive: Only 2 axes can be specified.

2. Drive Mode:

Select which drive mode to operate.

Home: Please refer to the P3240MotHome function manual.

Continue Drive: Please refer to the P3240MotCMove function manual.

Point to Point Drive: Please refer to the P3240MotPtp function manual.

Line Profile Drive: Please refer to the P3240MotLine function manual.

Arc Profile Drive: Please refer to the P3240MotArc and P3240MotArcTheta function manuals.

3. Movement Mode:

Specify Movement Mode as Absolute Mode or Relative Mode.

Absolute Mode: The position parameters will be used directly by the hardware.

Relative Mode: The position parameters will be used as an offset from current position.

4. Stopping Mode:

Select the stopping mode as immediate stop or slow down to stop when the Stop button is pressed.

5. Continue and Ptp Drive Parameter Setting:

Set the drive parameters for Continue Drive or Point to Point Drive mode. Please refer to the P3240MotCMove and P3240MotPtp function manuals for detailed information about input parameters.

Drive Speed: Drive speed (pulse per second) for each axis. These parameters are used by both P3240MotCMove and P3240MotPtp functions.

End Position: End position for P3240MotPtp function.

Continue Drive Dir.: Direction for P3240MotCMove function.

Line and Arc Drive Parameter Setting:

Please refer to P3240MotLine, P3240MotArc and P3240MotArcTheta function manuals for detailed information.

6. Line / Arc Speed:

Set the driving parameter for the PCM-3240 pulse output.

SV: Initial speed for line or arc interpolation.

DV: Drive speed for line or arc interpolation.

AC: The acceleration or deceleration for line or arc interpolation.

AK: The rate of acceleration or deceleration for line or arc interpolation.

7. Line End:

Set the end position for the line interpolation.

8. Arc center position:

Set the position of arc center for arc interpolation

C1: The center position for the first axis.

C2: The center position for the second axis.

The axes will follow the order X, Y, Z, U. For example, if X and Z axes are specified to do an arc interpolation, X is the first axis and Z is the second axis.

9. Arc End Position:

Set the end position of arc interpolation.

If the Arc Direction (11) is specified as CW or CCW, the interface of Arc End Position is as shown below:

E1: The end position for the first axis.

E2: The end position for the second axis.

Please refer to the P3240MotArc function manual.

If the Arc Direction (11) is specified as Angle, the interface of Arc End Position is as shown below:

Degree: The degree for P3240MotArcTheta to move.

10. Acceleration Mode:

Set the acceleration mode as a T-curve or an S-curve.

11. Arc Direction:

CW: Direction of arc interpolation is clockwise.

CCW: Direction of arc interpolation is counter clockwise.

Angle: If the Angle > 0, the direction is CW, otherwise it is CCW.

External Mode:

Please refer to the P3240MotExtMode function manual for detailed information.

12. Mode Selected and HW Pulses Set:

(1). Mode Selected:

Disable: Disable external mode.

JOG_A: JOG mode 1.

JOG_S_X: JOG mode 2.

JOG_S_Y: JOG mode 3.

JOG_X: JOG mode 4.

JOG_Y: JOG mode 5.

JOG_Z: JOG mode 6.

JOG_U: JOG mode 7.

Disable: Disable external mode.

HW_A: Hand Wheel Mode 1.

HW_S_X: Hand Wheel Mode 2.

HW_S_Y: Hand Wheel Mode 3.

HW_X: Hand Wheel Mode 4.

HW_Y: Hand Wheel Mode 5.

HW_Z: Hand Wheel Mode 6.

HW_U: Hand Wheel Mode 7.

(2). HW Pulse Set:

Set the number of output driving pulses when an active edge of input pulse is accepted in Hand Wheel mode.

13. Set:

The parameters of external mode will be set to PCM-3240 hardware.

14. Start:

The specified motion operation will start.

15. Change DV:

Change current driving speed of each axis to the values displayed in the dialog box (5).

This button is used to change driving speed in Continue Drive or Point to Point Drive, not for interpolation or home speed change.

16. Stop:

Stop the specified axes movement.

17. Exit:

Exit this dialog box.


This window show the profile track for select axis

Input Status:

There are two groups of Input status, the group one dialog is used to display the status of DI channels and motor inputs. The interface is shown as below:

Input Status:

LMT+: Display hardware limit sensor status. It turns red when the nLMT+ input signal is active.

SLMT+: Display software limit status. It turns red when the logical or real position counter is larger than COMP+ register when the software limit is enabled.

IN1: Display digital input status. It turns green if input signal n_IN1 is low level.

IN2: Display digital input status. It turns green if input signal n_IN2 is low level.

IN3/H: Display digital input status, turns green if input signal n_IN3 is low level.

SLMT-: Display software limit status. It turns red when the logical or real position counter is smaller than COMP- register when the software limit is enabled.

LMT-: Display hardware limit sensor status. It turns red when the nLMT- input signal is active.

IN0/Z: Display digital input status. It turns green if input signal nIN0P/nIN0N is low level.

ALM: Display digital input status. It turns green if input signal n_ALARM is low level.

INPOS: Display digital input status. It turns green if input signal n_INPOS is low level.

DRV: Display the driving status. It turns red if the axis is driving.

ERR: Display the driving status. It turns red if any error occurs on the axis.

CNST: Display the driving status. It turns orange if the axis is driving with a constant speed.

The group two dialog is used to display the status of DO channels and drive end. The interface is shown as below:

1. OUT 4 ~ OUT 7 Control and Status:

Digital output channels OUT4 ~ OUT7 can be used for general purposes or to show the driving status. It can be set in the Parameter Setting of Group 3.

04 / >=: Display the output status. It turns orange if the output signal nOUT4 is high level.

05 / <: Display the output status. It turns orange if the output signal nOUT5 is high level.

06 / AC: Display the output status. It turns orange if the output signal nOUT6 is high level.

07 / DC: Display the output status. It turns orange if the output signal nOUT7 is high level.

OUT4: Button to set digital output status if it is used for a general purpose. Press the button to set nOUT4 as high level or low level.

OUT5: Button to set digital output status if it is used for a general purpose. Press the button to set nOUT5 as high level or low level.

OUT6: Button to set digital output status if it is used as general purpose. Press the button to set nOUT6 as high level or low level.

OUT7: Button to set digital output status if it is used as general purpose. Press the button to set nOUT7 as high level or low level.

2. Drive End Status:

Display abnormal driving end status.

IN: Turns red if the driving is stopped by one of external decelerating stop signals nIN0 ~ 3.

LMT+: Turns red if the driving is stopped by + direction limit signal nLMT+.

LMT-: Turns red if the driving is stopped by - direction limit signal nLMT-.

ALM: Turns red if the driving is stopped by input signal n_ALARM from servo drivers.

EMG: Turns red if the driving is stopped by external emergency input signal EMG.

3. Position Counter and Register Status:

These edit boxes are used to display register values of the PCM-3240 device. They can also be used to set values to the registers of PCM-3240 hardware if the Edit button is pressed.

Please refer to the PCM-3240 hardware manual for detailed information about these registers.

Real Counter: Real position Counter of each axis. The real position counter will count input pulse numbers from the external encoder. The type of input pulse can be either A/B phase quadrature pulse type or Up/Down pulse (CW/CCW) type.

Logical Counter: Logical Position Counter of each axis. The logic position counter is counting the driving pulses output by the PCM-3240 device. When one positive (+) direction pulse is outputting, the counter will count up one; when one negative (-) direction pulse is outputting, the counter will count down one.

Error: This dialog box is used to display value only. And the value is derived by subtracting the Logical Counter value from the Real Counter value.

COMP+ Reg: COMP+ registers of each axis.

COMP- Reg: COMP- registers of each axis.

4. Edit (Update):

This button is used to set values directly to PCM-3240 registers, and the steps are as shown below:

(1). Press the Edit button. And the Edit button will be changed to the Update button.

(2). Set values in the edit boxes.

(3). Press the Update button.

5. Exit:

Push this button to exit this window


This window show the profile track for select axis

Profile Monitor:

This window shows the track profile for selected axes.

It is important that the track results are for reference only because this utility uses software to track the counter position and draws the profile on the screen. There may be some difference on different PC platforms.

Display Parameter Setting:

Set the axes coordinate range and select which counter to track by pressing Set. Push Reset to set them as the default values.

1. H Axis:

Select which axis of PCM-3240 to be displayed in the monitor as H axis

2. H axis Max/Min:

The range of H axis to be displayed in the profile monitor.

H Axis Max.: The maximal position of the H axis which can be displayed on the monitor.

H Axis Min.: The minimal position of the H axis which can be displayed on the monitor.

3. V Axis:

Select which axis of PCM-3240 to be displayed in the monitor as V axis

4. V axis Max/Min:

The range of V axis to be displayed in the profile monitor.

V Axis Max.: The maximal position of V axis which can be displayed on the monitor.

V Axis Min.: The minimal position of V axis which can be displayed on the monitor.

5. Logical Position Tracking/Real Position Tracking:

Logical Position Tracking: Every point is tracked by its logical position.

Real Position Tracking: Every point is tracked by its real position.

6. Set:

Set Profile Monitor to use the parameter values displayed in the edit boxes shown above.

7. Reset:

Set Profile Monitor to use the default parameter values.

8. H/V axis position:

These edit boxes display current H axis and V axis position.

9. Clear Screen:

Clear display screen.

10. Exit:

Quit this window

Velocity Monitor:

This window shows the current velocity of each axis.

It is important that the track result is for reference only. This utility uses software to sample counter values with a software timer and calculate the pulse output rate. There may be some differences on different PC platforms

1. Velocity Axis:

Set the maximal velocity range

2. Time Axis:

Set the maximal display time

3. Set:

Set velocity monitor to use the parameter values displayed in the edit boxes shown above.

4. Reset:

Set Profile Monitor to use the default parameter values.

5. Clear Screen: Clear display screen

6. Exit:

Quit this window


P3240BuildCompTable

Function description:

Used to set a user-fill array (the sequential positions compare table) to the driver on the specified axis.

After the table is assigned, the driver compares the specified axis position with each position on the table sequentially. When DO channels are used as driving status indicator purpose, pulses output on the OUT4 channel of the specified axis when the position is matched.

The positions on the table must be in order and match the driving direction (can only be set to + direction) of the axis. No matter how the axis moves, each position on the table causes only one pulse output. The table can be used only once for each setting.

Syntax

LRESULT P3240BuildCompTable(
BYTE | byBoard_ID | //Board ID number
BYTE | byMoveAxis | //Assigned Axis
DWORD * | dwTableArray | //One DWORD array
DWORD | dwAllPointNum | //The number of array

);

Parameters

BYTE byBoard_ID

[IN] Specified board ID number

value :

From 0 to 15, other values are invalid

BYTE byMoveAxis

[IN] Assigned Axis

value :

0 for disable, 1 for enable
bit 0 : X axis
bit 1 : Y axis
bit 2 : Z axis
bit 3 : U axis

bit 4 ~ 7: reserved, must be 0.

Only one axis can be enabled.

DWORD *dwTableArray

[IN] One DWORD array. Each item value is used to write COMP+ register.

DWORD dwAllPointNum

[IN] Quantity of the array items.

Return Values

BoardNumErr

The board number is error

AxisNumErr

The operating axis is not valid

CallKernelDriverFail

System resource error

ERROR_SUCCESS

Function success

Remark

(1) The interrupts are caused by the compare of the position register and the COMP+ register, including "P<C+" interrupt and "P>=C+" interrupt. These interrupts can be enabled by P3240MotEnableEvent.
(2) All interrupts caused by P3240BuildCompTable will not set event.
(3) COMP+ register is also used as software limit, it must be disable before this API is used.
(4) P3240SetOutputType can be used to set output type as general purpose or driving status purpose.


P3240BuildSpeedTable

Function description:

Used to set a user-fill array (the sequential position-speed table) to the driver on specified axis. The table should be a MotSpeedTable structure that includes position and speed data.

After the table is assigned, driver will compare the specified axis position with each position on the table sequentially, and will change the moving axis speed according to the table when each position is matched. The positions on the table must be in order and match the direction (can be set to either direction) of the moving axis.

The table can be used only once for each setting.

Syntax

LRESULT P3240BuildSpeedTable(
BYTE | byBoard_ID | //Board ID number
BYTE | byMoveAxis | //Assigned Axis
MotSpeedTable * | SpeedTable | //Speed table array
DWORD | dwAllPointNum | //The number of array

);

Parameters

BYTE byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

BYTE byMoveAxis

[IN] Assigned Axis

value :

0 for disable, 1 for enable
bit 0 : X axis
bit 1 : Y axis
bit 2 : Z axis
bit 3 : U axis

bit 4 ~ 7: Reserved, must be 0.

Only one axis can be enabled.

MotSpeedTable *SpeedTable

[IN] An assigned speed table array.

value :

The SpeedTable structure defined as the following:

typedef struct _MotSpeedTable
{

DWORD dwSpeed; // speed data
DWORD dwComp; // comparator data

} MotSpeedTable, * LPMotSpeedTable;

DWORD dwAllPointNum

[IN] Quantity of the array items.

Return Values

BoardNumErr

The board number is error

AxisNumErr

The operating axis is not valid

CallKernelDriverFail

System resource error

ERROR_SUCCESS

Function succeed

Remark

(1) The interrupts are caused by the compare of the position register and the COMP- register, including "P<C-" interrupt and "P>=C-" interrupt. These interrupts can be enabled by P3240MotEnableEvent.
(2) The interrupt can be set by P3240MotEnableEvent, and all interrupts caused by P3240BuildSpeedTable will not set event.
(3) COMP- register is also used as software limit, it must be disable before this API is used.


P3240FreeContiBuf

Function description:

Release a specified continuous interpolation buffer that was initialized by P3240InitialContiBuf

Syntax

LRESULT P3240FreeContiBuf(
 | BYTE | byBufID | // Assign the Buffer ID for release
);

Parameter

byBufID |  | [IN] Assign the buffer ID for release
 | value : | From 0 to 255

Return Values

FreeBufferFail | Release buffer resource fail
ERROR_SUCCESS | Function success


P3240GetCurContiNum

Function description:

Get the current order number of continuous interpolation.

Syntax

LRESULT P3240GetCurContiNum(
 | BYTE | byBoard_ID
 | DWORD* | lpReturnValue
);

Parameter

byBoard_ID |  | [IN] Assign board ID number
 | value : | From 0 to 15, other values are invalid.
lpReturnValue |  | [OUT] Pointer used to return current sequence number of continuous interpolation, can not be NULL.

Return Values

BoardNumErr | The board number is error
ParaValueErr | Parameter value error.
CallKernelDriverFail | System call fail
ERROR_SUCCESS | Function success


P3240 InitialContiBuf

Function description:

Allocate and initialize the buffer with a specific ID and size for later continuous interpolation operations.

Syntax

LRESULT P3240InitialContiBuf(
 | BYTE | ByBufID | // Assign Buffer ID
 | DWORD | dwAllPointNum | // Buffer size, the amount of continuous interpolation node.
);

Parameter

ByBufID |  | [IN] Assign the buffer ID
 | value : | 0 to 255
dwAllPointNum |  | [IN] The quantity of continuous interpolation node.
 | value : | 2 ~ 2^32. 0 and 1 are invalid.

Return Values

ParaValueErr | The input parameter value error.
BufferReAllocate | The assigned ID buffer has already been created.
AllocateBufferFail | Allocate buffer from system fail
ERROR_SUCCESS | Function success

Remark

(1)

The buffer created must be released by P3240FreeContiBuf, otherwise it will not be released even the application has been closed.


P3240MotArc

Function description:

Move two specific axes via arc interpolation from current position to new position using a specific end position

Syntax

LRESULT P3240MotArc(
 | BYTE | byBoardID | // Board ID number
 | BYTE | byMoveAxis | // Assign the operation axis, bit assignment
 | BYTE | byRA | // Assign movement operation is relative or absolute coordinate, bit assignment
 | BYTE | byMoveDirection | // Assign the movement direction
 | LONG | lCenter1 | // The center position for first axis
 | LONG | lCenter2 | // The center position for second axis
 | LONG | lEnd1 | // The end position for first axis
 | LONG | lEnd2 | // The end position for second axis
);

Parameter

ByBoardID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byMoveAxis |  |  | [IN] Assign the operating axis by bit, any two and only two axis must be enabled at the same time.
 | bit value : |  | 0 for non operation, 1 for operation
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
byRA |  |  | [IN] Assign the coordinate is relative or absolute system
 | value : |  | 0 for relative, 1 for absolute
byMoveDirection |  |  | [IN] Assign the drive direction
 | value : |  | 0 for CW, 1 for CCW
lCenter1,2 |  |  | [IN] The center position for Arc?
 | value : |  | Relative coordinate : | -8388608 to 8388608 , the other value is illegal
 |  |  | Absolute coordinate : | -2147483648 to 2147483648, the other value is illegal and?the maximum distance from current position can't over 268435455 pulses.
lEnd1,2 |  |  | [IN] The end position for Arc
 | value : |  | Relative coordinate: | -8388608 to 8388608 , other value is illegal
 |  |  | Absolute coordinate: | -2147483648 to 2147483648, the other value is illegal and?the maximum?distance from current position can't over 268435455 pulses.

Return Values

AxisNumErr | The operating axis is assigned error
AxisDrvBusy | The operating axis is busy
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
OverPLmtErr | The center or end position over positive maximum range
OverNLmtErr | The center or end position over negative maximum range
MaxMoveDistErr | The moving distance over maximum moving distance
ERROR_SUCCESS | Function success

Remark

(1)

If need slow down, please call P3240SetDeceleration function first.

(2)

The designated finish point may not on the circular track. The IC will make an in-position checking by the short axis. If the value of finish point is as same as that of short axis, this circular interpolation is finished.

Right figure shows an example of CCW interpolation with the start point (0,0), center point (-200,500) and finish point (-702, 299). The finish point is in quadrant 4, and ax2 is the
short axis in quadrant 4. So the interpolation is finished when the ax2 is 299.

(3)

In circular interpolation, if the finish point is set on the shadow area as the following figures, it will cause a problem that the MCX-314 chip can not find the finish point, and the axes will not stop. This problem is due to an arithmetic error. So the finish point may be set on the circular or in it.


P3240MotArcTheta

Function description:

Move two specific axis via arc interpolation from current position to new position using a specific moving angle.

Syntax

LRESULT P3240MotArcTheta(
 | BYTE | byBoardID | // Board ID number
 | BYTE | byMoveAxis | // Assign the operation axis, bit assignment
 | BYTE | byRA | // Assign movement operation is relative or absolute coordinate, bit assignment
 | LONG | lCenter1 | // Center position for first axis
 | LONG | lCenter2 | // Center position for second axis
 | Double | dMoveDeg | // Degree for moving
);

Parameter

byBoardID

[IN] Assign board ID number

value :

0 to 15, other values are not accepted

byMoveAxis

[IN] Assign the operating axis by bit, any two and only two axes must be enabled at the same time.

bit value:

for non operation, 1 for operation (any two axis must be enabled at the same time)

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved must be 0

byRA

[IN] Assign the coordinate to relative or absolute system

value :

0 for relative, 1 for absolute

lCenter1,2

[IN] The center position for Arc?

value :

Relative coordinate:

-8388608 to 8388608, other values are not accepted

Absolute coordinate:

-2147483648 to 2147483648, other values are not accepted and?the maximum distance from current position is 268435455 pulses.

dMoveDeg

[IN] The degree of movement

value :

-360 ~ +360

Return Values

AxisNumErr | The operating axis is assigned error
AxisDrvBusy | The operating axis is in busy
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
OverPLmtErr | The center or end position over positive maximum range
OverNLmtErr | The center or end position over negative maximum range
MaxMoveDistErr | The moving distance over maximum moving distance
ERROR_SUCCESS | Function success

Remark

(1)

If need slow down, please call P3240SetDeceleration function first.

(2)

The radius of the arc interpolation cant be zero.

(3)

If dMoveDeg > 0, the drive direction is CW, otherwise it is CCW.


P3240MotAxisParaSet

Function description:

Set motion parameters for the axes.

Syntax

LRESULT P3240MotAxisParaSet(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | bySetAxis | // Assign the operation axis, bit assignment
 | BYTE | byTS | // Assign the acceleration type T or S
 | DWORD | dwSV | // Assign the initial speed
 | DWORD | dwDV | // Assign the drive speed
 | DWORD | dwMDV | // Assign the Maximum drive speed
 | DWORD | dwAC | // Assign the acceleration speed
 | DWORD | dwAK | // Assign the acceleration rate
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
bySetAxis |  |  | [IN] Assign the axis for setting. If multiple axis are assigned, the same setting values will be set for each enabled axis. When all bits are set to 0, the parameters will be set for Line or Arc interpolation.
 | bit value : |  | 0 for disable, 1 for enable.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
byTS |  |  | [IN] Set the acceleration mode for all assigned axes by bySetAxis parameter
 | bit value : |  | 0 for T curve, 1 for S curve
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
dwSV |  |  | [IN] The initial speed for all assigned axes by bySetAxis parameters
 | value : |  | 1 to 4000000(pps), other values are invalid
dwDV |  |  | [IN] The drive speed for all assigned axes by bySetAxis parameters
 | value : |  | 1 to 4000000(pps), other values are invalid.
dwMDV |  |  | [IN] The maximum drive speed for all assigned axes by bySetAxis parameters
 | value : |  | 1 to 4000000(pps), other values are invalid.
dwAC |  |  | [IN] The acceleration for all assigned axes by bySetAxis parameters
 | value : |  | 125 to 500000000(pps), other values are invalid.
dwAK |  |  | [IN] The accelerated speeded rate for all assigned axis by bySetAxis parameter
 | value : |  | 954 to 2000000000(pps), other values are invalid

Return Values

BoardNumErr | The board number is error
AxisNumErr | Axis setting error
ParaValueErr | Parameter value error. (1)
ParaValueUnderRange | Parameter value under minimum setting value
ParaValueOverRange | Parameter value over maximum range
ERROR_SUCCESS | Function succeed

Remark

(1) The limitation for the P3240 motion parameter SV,DV,MDV,AC,AK , in PCM-3240 the value of SV,DV,MDV,AC, AK can't be any value it should be meet the rule list below:

1. SV,DV,MDV = ( 1 ~ 8000 ) * K, Multiplier K is 1 ~ 500.

2. AC = ( 1 ~ 8000 ) * 125 * K, Multiplier K is 1 ~ 500.

3. AK = 62.5e6 * ( 1 ~ 65535 ) / K, Multiplier K is 1 ~ 500.

4. SV <= MDV

5. DV <= MDV

6. SV <= DV

7. If the bySetAxis is set to 0, the Multiplier K is 2 ~ 288.

P3240MotAxisParaSet API will calculate a suitable K value to meet the user parameter setting, but if there is no K can meet the parameter setting, it will return error


P3240MotAxisBusy

Function description:

Check the state (busy/not busy)of the specified axes.

Syntax

LRESULT P3240MotAxisBusy(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byCheckAxis | // Assign operation axis, bit assignment
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byCheckAxis |  |  | [IN] Assign the checking axis by bit, multi axes can be assigned at the same time. Only all assigned axis is not buy will return ERROR_SUCCESS.
 | bit value : |  | 0 for disable, 1 for enable.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating axis assignment error
AxisDrvBusy | There is one axis at least in driving status
AxisHomeBusy | There is one axis at least in Home process
AxisExtBusy | There is one axis at least in external operating mode
ERROR_SUCCESS | Function success


P3240MotCheckEvent

Function description:

An API to check interrupt event.

Syntax

LRESULT P3240MotCheckEvent(
BYTE | byBoard_ID | //Board ID number
DWORD * | lpRetEventStatus | //Interrupt status for each axis.
DWORD | dwMillisecond | //Time out

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

Form 0 to 15, other values are invalid

lpRetEventStatus

[OUT] Interrupt status for each axis.

Bit 0-7 for X axis, Bit 8-15 for Y axis , Bit 16-23 for Z axis , Bit 24-31 for U axis

bit value : 1 for interrupt occurs, 0 for non
bit 0 : Reserved, Always be 0.
bit 1 : Interrupt occurs when the value of logical / real position counter is larger than that of COMP- register.
bit 2 : Interrupt occurs the value of logical / real position counter is smaller than that of COMP- register.
bit 3 : Interrupt occurs when the value of logical / real position counter is smaller than that of COMP+ register.
bit 4 : Interrupt occurs when the value of logical / real position counter is larger than that of COMP+ register.
bit 5 : Interrupt occurs when the pulse output is finished in the constant speed drive during an acceleration/deceleration driving.
bit 6 : Interrupt occurs when the pulse output is started in the constant speed drive during an acceleration/deceleration driving.
bit 7 : Interrupt occurs when the driving is finished.

dwMillisecond

[IN] Time out

Return Values

BoardNumErr

The board number is error

OpenEventFail

System resource initial fail

CreateKernelDriverFail

System resource initial fail

ERROR_SUCCESS

Function success


P3240MotChgDV

Function description:

Change the drive velocity (speed) of the specified axes

Syntax

LRESULT P3240MotChgDV(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | bySetAxis | // Assign operation axis, bit assignment
 | DWORD | dwSetDVValue | // The new speed for X axis

Parameter

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the operating axis by bit, only 1 axis can be enabled.

bit value :

0 for disable, 1 for enable.

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved, must be 0

dwSetDVValue

[IN] The new drive speed for enabled axis

value :

0 to 4000000, other values are invalid

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating axis assignment error
ParaValueUnderRange | The new speed value under range
ParaValueOverErr | The new speed value over range ( > MDV )
ERROR_SUCCESS | Function success


P3240MotChgLineDV

P3240MotChgLineArcDV

Function description:

Change the drive velocity of the running Line or Arc interpolation operation. If there is no running operation, an error code (ChangeSpeedErr) will be returned.

Syntax

LRESULT P3240MotChgLineDV(
 | BYTE | byBoard_ID | // Board ID number
 | DWORD | dwSetDVValue | // The new speed for Line or Arc
);

Parameter

byBoard_ID |  | [IN] Assign the board ID number
 | value : | 0 to 15, other values are invalid
dwSetDVValue |  | [IN] The new drive speed for Line and Arc movement
 | value : | 0 to 4000000, other values are invalid

Return Values

BoardNumErr | The board number is error
ParaValueUnderRange | The new speed value under range
ParaValueOverErr | The new speed value over range
ChangeSpeedErr | Change speed error
ERROR_SUCCESS | Function success


P3240MotClrErr

Function description:

Clear the most recent informal finished driving status of the RR1 register of MCX-314. Please refer to chip MCX-314 or the hardware manual.

Syntax

LRESULT P3240MotClrErr(
BYTE | byBoard_ID | //Board ID number
BYTE | byClearAxis | //assign the axis

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

byClearAxis

[IN] Assign Axis.

value :

0 for disable, 1 for enable
bit 0 : X axis
bit 1 : Y axis
bit 2 : Z axis
bit 3 : U axis

Other bits are reserved, and must be 0.

Return Values

BoardNumErr

The board number is error

AxisNumErr

The operating axis is not valid

ERROR_SUCCESS

Function success


P3240MotCmove

Function description:

Drive the specified axes to move continuously in a specific direction.

Syntax

LRESULT P3240MotCmove(
 | BYTE | byBoard_ID | //Board ID number
 | BYTE | byCMoveAxis | //Assign operation axis, bit assignment
 | BYTE | byAxisDirection | //Assign drive direction, bit assignment
);

Parameter

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

byCMoveAxis

[IN] Assign the operating axis by bit, muti. axes can be assigned.

bit value :

0 for disable, 1 for enable

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved must be 0

byAxisDirection

[IN] Assign the drive direction by bit

bit value :

0 for CW, 1 for CCW

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved must be 0

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating assignment error
AxisDrvBusy | The operating axis is in busy
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
ERROR_SUCCESS | Function success


P3240SetContiData

Function description:

Insert a section of continuous interpolation data with its order number into the buffer which is initiated by P3240InitialContiBuf for later use by P3240StartContiDrive.

Syntax

LRESULT P3240SetContiData(
 | BYTE | byBufID | // Assign the Buffer ID for put node data
 | LPMotMoveBuffer* | lpPathData | // Pointer to the data of continuous interpolation node.
 | DWORD | dwPointNum | // The sequence number for the continuous interpolation node.(2)
);

Parameter

byBufID |  | [IN] Assign the buffer ID for put node data
 | value : | From 0 to 255
lpPathData |  | [IN] Node data (1)
 | value : | Depend on the interpolation type
dwPointNum |  | [IN] The sequence number for continuous interpolation node. The number must be set one by one.

Return Values

BufferNoneAllocate | The buffer hasn't been create
PathTypeErr | The node data type is not one of L2,L3,ArcCW or ArcCCW
FirstPointNumberFail | Assign the 1'st node data but the dwPointNum is not 1
SequenceNumberErr | Current node data sequence number is not continue with the previous one
PathTypeMixErr | Interpolation type of current node does not match the type of previous setting one.(3)
PointNumExceedAllocatedSize | No space for new node data in this buffer
ERROR_SUCCESS | Function succeed

Remark

(1) The node data struce

typedef struct

{

DWORD

dwEndPoint_ax1;

//1'st end point for IPO_L2,IPO_L3,IPO_CW or IPO_CCW

DWORD

dwEndPoint_ax2;

//2'nd end point for IPO_L2,IPO_L3,IPO_CW or IPO_CCW

DWORD

dwEndPoint_ax3;

//3'rd end point for IPO_L3 only

DWORD

dwCenPoint_ax1;

//1'st center point for IPO_CW/IPO_CCW only

DWORD

dwCenPoint_ax2;

//2'nd center point for IPO_CW/IPO_CCW only

DWORD

dwPointNum;

//Serial number for current node data

WORD

wCommand;

//Interpolation type IPO_L2,IPO_L3,IPO_CW,IPO_CCW

WORD

TempB;

//Internal using

DWORD

TempA;

//Internal using

} MotMoveBuffer;

For example:

If interpolation type is IPO_L2, the dwEndPoint_ax1 and dwEndPoint_ax2 must be filled with correct values, others will be ignored.

If interpolation type is IPO_L3 the dwEndPoint_ax1, dwEndPoint_ax2 and dwEndPoint_ax3 must be filled with correct values, others will be ignored.

If interpolation type is IPO_CW/IPO_CCW, the dwEndPoint_ax1, dwEndPoint_ax2, dwCenPoint_ax1 and dwCenPoint_ax2 must be filled with correct values, and the dwEndoint_ax3 will be ignored.

(2) The "dwPointNum" must be increased one by one. it must be assigned as the next node number of the previous node. Only 1 can be assigned as a node number anytime, and it means a beginning of a new continuous interpolation sequence.

for example:

[1]

1'st data, dwPointNum = 1

2'nd data, dwPointNum = 2

3'rd data, dwPointNum = 3

4'th data, dwPointNum = 4

5'th data, dwPointNum = 5

6'th data, dwPointNum = 6, any other value is illegal and function will return fail

.

.

.

.

.

.

.

[2]

1'st data, dwPointNum = 1, Initial continuous interpolation sequence.

2'nd data, dwPointNum = 2

3'rd data, dwPointNum = 3

.

.

.

P3240StartContiDrive(...) //Run continue interpolation

1'th data, dwPointNum = 1, Initial another continuous interpolation sequence.

2'th data, dwPointNum = 2

3'th data, dwPointNum = 3

.

.

.

.

P3240StartContiDrive(...) //Run another continue interpolation

(3) It is impossible to operate 2-axis and 3-axis continuous interpolations at the same time.

(4) The maximum speed for the continuous interpolation is 2 MHz PPS.


P3240StartContiDrive

Function description:

Start the continuous interpolation function previously set by P3240InitialContiBuf and P3240SetContiData.

Syntax

LRESULT P3240StartContiDrive(
 | BYTE | byBoard_ID | // Board ID
 | BYTE | byMoveAxis | // Assign the operating axis
 | BYTE | byBufID | // Assign the buffer ID for continuous interpolation.
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID
 | value : |  | From 0 to 15, other values are invalid
byMoveAxis |  |  | [IN] Axis for operating
 | bit value : |  | 0 for disable, 1 for enable
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved, must be 0
byBufID |  |  | [IN] Buffer ID for continuous interpolation.

Return Values

BoardNumErr | The Board number is error
AxisNumErr | The operating axis is assigned error
BufferNoneAllocate | The buffer has not been created
BufferDataNotEnough | The buffer size is less than 2.
CallKernelDriverFail | System call fail
ERROR_SUCCESS | Function success


P3240MotDevAvailable

Function description:

Check how many PCM-3240 cards are available in the system.

Syntax

LRESULT P3240MotDevAvailable(

DWORD *

lpReturnBoardStatus

//Return the board available status

);

Parameter

lpReturnBoardStatus

[OUT] A pointer of a DWORD to return available status

bit value :

1 for available, 0 for not.

Bit 0 : For board ID 0

Bit 1 : For board ID 1

Bit 2 : For board ID 2

Bit 3 : For board ID 3

.

.

.

Bit 15 : For board ID 15

Other bits are reserved.

Return value
ParaValueErr | Input parameter error
RegistryReadFail | Read data from registry fail

ERROR_SUCCESS

Function success


P3240MotDevClose

Function description:

Close the specified PCM-3240 device to finish motion operations. All motion operations of the PCM3240 must be initiated with P3240MotDevOpen and ended with P3240MotDevClose, except P3240MotDevAvailable.

Syntax

LRESULT P3240MotDevClose(

BYTE

byBoard_ID

//Board ID number

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

Return Values

BoardNumErr

The board number is error

DeviceCloseErr

System resource release fail

CallKernelDriverFail

Call kernel driver fail

ERROR_SUCCESS

Function succeed


P3240MotDevOpen

Function description:

Open the specified PCM-3240 device to start motion related operations. All the motion operations of the PCM3240 must be initiated with P3240MotDevOpen and ended with P3240MotDevClose, except P3240MotDevAvailable.

Syntax

LRESULT P3240MotDevOpen(

BYTE

byBoard_ID

//Board ID number

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

From 0 to 15, other values are invalid

Return Values

BoardNumErr

The board number is error

OpenEventFail

System resource initial fail

CreateKernelDriverFail

System resource initial fail
RegistryOpenFail | Read data from registry fail
CallKernelDriverFail | Call kernel driver fail
DeviceNotExist | PCM-3240 device is not in the slot.

ERROR_SUCCESS

Function succeed


P3240MotDI

Function description:

Retrieve the state of the four DI (digital input) channels (bit 0 to 3) of the DI port on the specified PCM3240 and axis.

Syntax

LRESULT P3240MotDI(
 | BYTE | ByBoard_ID | // Board ID number
 | BYTE | byReadDIAxis | // Assign operation axis, bit assignment
 | BYTE* | lpReturnValue | // The port data
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byReadDIAxis |  |  | [IN] Assign the operating axis by bit, only one axis can be assigned at the same time.
 | bit value : |  | 1 for assigned, 0 for not
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
lp ReturnValue |  |  | [OUT] The current DI status by bit
 | value : |  | 0 for low level, 1 for high level
 |  | bit 0 : IN0
 |  | bit 1 : IN1
 |  | bit 2 : IN2
 |  | bit 3 : IN3
 |  | bit 4 : EXOP+
 |  | bit 5 : EXOP-
 |  | bit 6 : InPos
 |  | bit 7 : Alarm

Return Values

BoardNumErr | The Board num is error
AxisNumErr | The operating axis are error assignably
ERROR_SUCCESS | Function success


P3240MotDO

Function description:

Output desired state to the four DO (digital output) channels (OUT4 ~ 7) on the specified PCM3240 and axis, when the digital output channels are used as general purpose.

Syntax

LRESULT P3240MotDO(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byWriteDOAxis | // Assign operation axis, bit assignment
 | BYTE | by WriteValue | // The port data
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byWriteDOAxis |  |  | [IN] Assign the operating axis by bit, only one axis can enable at the same time.
 | bit value : |  | 0 for disable, 1 for enable.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
byWriteValue |  |  | [IN] The output value
 | value: |  | 0 for low level, 1 for high level
 |  | bit 0 : OUT4
 |  | bit 1 : OUT5
 |  | bit 2 : OUT6
 |  | bit 3 : OUT7
 |  | bit 4 ~ bit 7: Reserved, must be 0

Return Values

BoardNumErr | The board num is error
AxisNumErr | The operating axis assignment error
DOPortAsDriverStatus | The DO for assigned axis work in driving status outputting mode
ERROR_SUCCESS | Function success


P3240MotEnableEvent

Function description :

Enable or disable the specified interrupts on the specified card and axes. Each enabled interrupt will signal the corresponding event on the interrupt rise each time.

Syntax

LRESULT P3240MotEnableEvent(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | bySettingAxis | // Assign the operation axis, bit assignment
 | BYTE | byX_AxisEvent | // Assign the X Axis event type
 | BYTE | byY_AxisEvent | // Assign the Y Axis event type
 | BYTE | byZ_AxisEvent | // Assign the Z Axis event type
 | BYTE | byU_AxisEvent | // Assign the U Axis event type
);

Parameter

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySettingAxis

[IN] Assign operation axis, more than 1 axis can be assigned at the same time

bit value :

0 for disable, 1 for enable

bit 0 : X Axis

bit 1 : Y Axis

bit 2 : Z Axis

bit 3 : U Axis

bit 4 ~ bit 7 : Reserved, must be 0

ByX(Y,Z,U)_AxisEvent

Enable or disable interrupt by bit

bit value

0 for disable, 1 for enable

bit 0 : Reserved, must be 0.
bit 1 : Interrupt occurs when the value of logical / real position counter is larger than that of COMP- register.
bit 2 : Interrupt occurs the value of logical / real position counter is smaller than that of COMP- register.
bit 3 : Interrupt occurs when the value of logical / real position counter is smaller than that of COMP+ register.
bit 4 : Interrupt occurs when the value of logical / real position counter is larger than that of COMP+ register.
bit 5 : Interrupt occurs when the pulse output is finished in the constant speed drive during an acceleration/deceleration driving.
bit 6 : Interrupt occurs when the pulse output is started in the constant speed drive during an acceleration/deceleration driving.
bit 7 : Interrupt occurs when the driving is finished.

Return Value
ERROR_SUCCESS

ERROR SUCCESS

BoardNumErr

The board number is error

AxisNumErr

The Axis number is error


P3240MotExtMode

Function description:

Set the external drive operation to JOG or Hand Wheel mode on the specified card and axis

P3240 support 2 external control mode, one is JOG mode and another is Hand Wheel mode.

JOG Mode:

For JOG mode, the motion is controlled by the level of nEXOP+ / nEXOP- signal. If the input signal is active level, the pulse will output from nP+ / nP-. The nEXOP+ and nEXOP- can not be active at the same time.

Hand Wheel Mode:

For Hand Wheel mode, the motion is controlled by the input pulse edge of nEXOP+/nEXOP-. If the nEXOP+/nEXOP- get the active edge of pulse, the nP+/nP- will output fixed pulses driving. The number of fixed pulses driving can be set from 1 to 10,000. In this mode, the nEXOP+/nEXOP- only accept A/B phase pulse input signal.

In the P3240 each axis can support external JOG and Hand Wheel control mode, and there are 7 operating types for JOG and Hand Wheel mode to suit for user application. The 7 operating types are the same in JOG and Hand Wheel mode, only different in input signal type.

Mode 1: In this mode, the axis is controlled by the pin of itself. For example, X axis is controlled by X-EXOP+ and X-EXOP-, Z axis is controlled by Z-EXOP+ and Z-EXOP-.

Mode 2: In this mode, the external control pin is from X-EXOP+ and X-EXOP- only, and U-IN1 and U-IN2 is used to select which axis will be controlled.

.

Mode 3: In this mode, the external control pin is from Y-EXOP+ and Y-EXOP- only, and U-IN1 and U-IN2 is used to select which axis will be controlled.

Mode 4: In this mode the external control pin is from X-EXOP+ and X-EXOP-.

Mode 5: In this mode the external control pin is from Y-EXOP+ and Y-EXOP-.

Mode 6: In this mode the external control pin is from Z-EXOP+ and Z-EXOP-.

Mode 7: In this mode the external control pin is from U-EXOP+ and U-EXOP-.

In mode 4 to 7, software setting is used to set external controlled axis. For example: when all X, Y, Z, U axis are set in Mode 6, it means that when Z_EXOP+ or Z-EXOP- is active, the X, Y, Z, U axis will output driving pulses at the same time.

Syntax

LRESULT P3240MotExtMode(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byAssignmentAxis | // Assign operation axis, bit assignment
 | BYTE | byExternalMode | // Set the external drive operation mode
 | LONG | lPulseNum | // Set the pulse number for each Hand Wheel pulse
);

Parameter

byBoard_ID |  |  |  | [IN] Assign board ID number
 | value : |  |  | 0 to 15, other values are invalid
byAssignmentAxis |  |  |  | [IN] Assign the operating axes by bit, only one axis can be assigned at the same time.
 | bit value : |  |  | 1 for assigned, 0 for not.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
byExternalMode |  |  |  | [IN] Assign the external drive operation mode (1)
 | value : |  |  | 0 to 15, other values are invalid, please refere to the table list below
 |  | b3 | b2 |  | b1 | B0 |
 |  | 0 | 0 |  | 0 | 0 | Disable
 |  | 0 | 0 |  | 0 | 1 | JOG mode 1
 |  | 0 | 0 |  | 1 | 0 | JOG mode 2
 |  | 0 | 0 |  | 1 | 1 | JOG mode 3
 |  | 0 | 1 |  | 0 | 0 | JOG mode 4
 |  | 0 | 1 |  | 0 | 1 | JOG mode 5
 |  | 0 | 1 |  | 1 | 0 | JOG mode 6
 |  | 0 | 1 |  | 1 | 1 | JOG mode 7
 |  | 1 | 0 |  | 0 | 0 | Disable
 |  | 1 | 0 |  | 0 | 1 | Hand Wheel Mode 1
 |  | 1 | 0 |  | 1 | 0 | Hand Wheel Mode 2
 |  | 1 | 0 |  | 1 | 1 | Hand Wheel Mode 3
 |  | 1 | 1 |  | 0 | 0 | Hand Wheel Mode 4
 |  | 1 | 1 |  | 0 | 1 | Hand Wheel Mode 5
 |  | 1 | 1 |  | 1 | 0 | Hand Wheel Mode 6
 |  | 1 | 1 |  | 1 | 1 | Hand Wheel Mode 7
lPulseNum |  |  |  | [IN] The number of output driving pulses when an active edge of input pulse is accept in Hand Wheel mode.
 | value : |  |  | From 1 to 10,000 other values are invalid.

Return Values

BoardNumErr | The board number is error
ParaValueErr | The input parameter is error
AxisNumErr | The operating axis assignment error
ERROR_SUCCESS | Function success


P3240MotHome

Function description:

Drive the specified axes back to home position, each specified axis will operate on their home parameter setting (1). This function can be stoped by P3240MotStop.

Syntax

LRESULT P3240MotHome(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byHomeAxis | // Assign operation axis, bit assigned
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byHomeAxis |  |  | [IN] Assign the axis for return home position by bit, multiple axes can be assigned at the same time.
 | bit value : |  | 1 for assigned, 0 for not
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0

Return Values

BoardNumErr | The board number is error.
AxisNumErr | The operating axis assignment is error
AxisDrvBusy | There is one axis at least in driving status
AxisHomeBusy | There is one axis at least in Home process
AxisExtBusy | There is one axis at least in external operating mode
ERROR_SUCCESS | Function success

Remark

(1)Home function parameters will be used when P3240MotHome be called, user can use utility or P3240WrReg to set these parameters.

Home function parameters:

HomeType : Return home type. Value: 0~4

HomeP0_Dir: Phase0 direction in home process. Value: 0 for CW, 1 for CCW

HomeP0_Speed: Phase0 speed.

HomeP1_Dir: Phase1 direction in home process. Value: 0 for CW, 1 for CCW

HomeP1_Speed: Phase1 speed.

HomeP2_Dir: Phase2 direction in home process. Value: 0 for CW, 1 for CCW

HomeOffset: Offset value from physical home to logical home.

HomeOffset_Speed: Speed of move to logical home.

Home function sketch map:

HomeType 0: Phase0~Phase3

1: Phase0, Phase3

2: Phase0, Phase1, Phase3

3: Phase2, Phase3

4: Limit switch as home, include Phase0, Phase3 process.


P3240MotHomeStatus

Function description:

Retrieve the status of the back home operation (P3240MotHome) for user information (normal or abnormal, or not finished yet).

Syntax

LRESULT P3240MotHomeStatus(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byHomeAxis | // Assign operation axis, bit assignment
 | DWORD * | lpReturnValue | // Return home status.
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byHomeAxis |  |  | [IN] Assign the axis for return home position by bit
 | bit value : |  | 0 for disable, 1 for enable
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
lpReturnValue |  |  | [OUT] Pointer to a DWORD, used to return home status.
 | value : |  | Please reference the error message to get the home status information.

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating axis assignment error
ParaValueErr | The input parameter is error
ERROR_SUCCESS | Function success


P3240MotLine

Function description:

Drive the specified axes to move with the line interpolation from current position to a specified position.

Syntax

LRESULT P3240MotLine(
 | BYTE | byBoard_ID | //Board ID number
 | BYTE | byMoveAxis | //Assign operation axis, bit assignment
 | BYTE | byRA | //Assign movement operation is relative or absolute coordinate, bit assignment
 | LONG | LPulseX | //The new position for X axis
 | LONG | LPulseY | //The new position for Y axis
 | LONG | LPulseZ | //The new position for Z axis
 | LONG | LPulseU | //The new position for U axis
);

Parameter

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

byMoveAxis

[IN] Assign the operating axis by bit, 2 or 3 axes can be selected at the same time.

bit value :

1 for operation, 0 for non

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved must be 0

byRA

[IN] Assign the coordinate is relative or absolute system by bit

value :

0 for relative, 1 for absolute, other values are invalid.

LPulseX,Y,Z,U

[IN] The new position for X, Y, Z and U axes

value :

Relative coordinate :

-8388608 to 8388608 , other values are invalid

Absolute coordinate :

-2147483648 to 2147483648, the other values are invalid and

the maximum movement distance can't over 268435455 pulses.

Return Values

AxisNumErr | The operating axis assignment error
AxisDrvBusy | The operating axis in busy mode
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
OverPLmtErr | The center or end position over positive maximum range
OverNLmtErr | The center or end position over negative maximum range
MaxMoveDistErr | The moving distance over maximum movement distance
ERROR_SUCCESS | Function success

Remark

(1)The speed parameter is set by P3240MotAxisParaSet


P3240MotReset

Function description:

Shutdown all current operations and reset the motion chip MCX-314

Syntax

LRESULT P3240MotReset(
 | BYTE | byBoard_ID | // Board ID number
);

Parameter

byBoard_ID |  | [IN] Assign the board ID number
 | value : | 0 to 15, other values are invalid

Return Values

BoardNumErr | The board number is error
RegistryCreateFail | Internal function fail
RegistryOpenFail | Internal function fail
RegistryReadFail | Internal function fail
ERROR_SUCCESS | Function success


P3240MotSavePara

Function description:

Store the current motion parameters to the system registry for the next system initialization by P3240MotDevOpen.

Syntax

LRESULT P3240MotSavePara(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | bySaveAxis | // Assign operation axis, bit assignment
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
bySaveAxis |  |  | [IN] Assign the saving axis by bit, multiple axes can be assigned at the same time.
 | bit value : |  | 0 for disable, 1 for enable.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating axis assignment error
RegistryOpenFail | Internal function fail
RegistryWriteFail | Internal function fail
ERROR_SUCCESS | Function succeed


P3240MotStop

Function description:

Stop the specified axes with a specified stopping mode.(1,2)

Syntax

LRESULT P3240MotStop(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byStopAxis | // Assign operation axis, bit assignment
 | BYTE | byStopMode | // Assign the stop mode, bit assignment
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byStopAxis |  |  | [IN] Assign the operating axis by bit, multiple axes can be assigned at the same time.
 | bit value : |  | 0 for non operation, 1 for operation
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
byStopMode |  |  | [IN] Assign the stop mode for axis by bit
 | bit value : |  | 1 slow down stop, 0 immediate stop
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating axis assignment error
CallKernelDriverFail | Internal function error
ERROR_SUCCESS | Function success

Remark

(1)This function will stop all the assigned axis in any motion function

(2) If the axes are in Line or Arc interpolation, the motion only stop if the first axis is assigned, and other axes are no effective. For example:

1. Line interpolation in Z, U axis: Z axis is the first axis

2. Arc interpolation in Y, Z axis: Y axis is the first axis

3. line interpolation in X, Y, U axis: X axis is the first axis


P3240MotPtp

Function description:

Drive the specified axes to make a Point To Point moving from the current position to the specified position.

Syntax

LRESULT P3240MotPtp(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byMoveAxis | // Assign operation axis, bit assignment
 | BYTE | byRA | // Assign movement operation is relative or absolute coordinate, bit assignment
 | LONG | lPulseX | // The movement pulses number for X axis
 | LONG | lPulseY | // The movement pulses number for Y axis
 | LONG | lPulseZ | // The movement pulses number for Z axis
 | LONG | lPulseU | // The movement pulses number for U axis
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byMoveAxis |  |  | [IN] Assign the operating axis by bit, multiple axes can be enable at the same time.
 | bit value : |  | 0 for disable, 1 for enable.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved, and must be 0
byRA |  |  | [IN] Assign the axes is relative coordinate or absolute coordinate by bit
 | bit value : |  | 0 for relative, 1 for absolute.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved, and must be 0
lPulseX,Y,Z,U |  |  | [IN] The new position of driving pulses number for X, Y, Z and U axes
 | value : |  | Relative coordinate : | -268435455 to 268435455, other values are invalid
 |  |  | Absolute coordinate : | -2147483648 ~ 2147483647, other values are invalid. The maximum movement distance can't over 268435455 driving pulses

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating axis assignment error
AxisDrvBusy | The operating axis is busy
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
OverPLmtErr | The center or end position over positive maximum range
OverNLmtErr | The center or end position over negative maximum range
MaxMoveDistErr | The movement distance over maximum moving distance
ERROR_SUCCESS | Function success

Remark

(1) | The speed parameter is set by P3240MotAxisParaSet
(2) | The assigned axes will not start simultaneity, and will not stop simultaneity yet.


P3240MotWrMutiReg

P3240MotWrMultiReg

Function description:

Write data to the specified register for specific axes (multiple axes). Please notice that some of the registers are software simulates registers in the driver and are not on the hardware.

Syntax

LRESULT P3240MotWrMutliReg(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byWriteAxis | // Assign operation axis, bit assignment
 | WORD | wCommand | // Assign the port for read data
 | DWORD | dwWrite_XAxisValue | // The port data for X axis
 | DWORD | dwWrite_YAxisValue | // The port data for Y axis
 | DWORD | dwWrite_ZAxisValue | // The port data for Z axis
 | DWORD | dwWrite_UAxisValue | // The port data for U axis
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byWriteAxis |  |  | [IN] Assign the operating axis by bit, multiple axes can be assigned.
 | bit value : |  | 1 for assigned, 0 for not.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
wCommand |  |  | [IN] Command to assign which port will be set.
 | value : |  | Port name(1)
dwWrite_X(Y,Z,U) AxisValue |  |  | [IN] The value to be set
 | value : |  | depended on which register be set

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating assignment error
ERROR_SUCCESS | Function success

Remark

(1) Port Name:

Port Name

Constant Value

Describe

Rcnt

0x0100

Real position counter

Lcnt

0x0101

Logical position counter

Pcmp

0x0102

P/CW/+ direction compare register

Ncmp

0x0103

N/CCW/- direction compare register

Pnum

0x0104

Pulse number

WR1

0x0212

Control Register 1 for write (2)

WR2

0x0214

Control Register 2 for write (2)

WR3

0x0216

Control Register 3 for write (2)

RG

0x0300

Setting speed range value

SV

0x0301

Setting initial driving speed

DV

0x0302

Setting driving speed

MDV

0x0303

Setting maximum speed

AC

0x0304

Setting acceleration

AK

0x0306

Setting acceleration rate

PLmt

0x0307

P/CW/+ direction limitation in pulse

NLmt

0x0308

N/CCW/- direction limitation in pulse

HomeOffset

0x0309

Offset value for physical and logical home

HomeMode

HomeType

HomeP0_Dir

HomeP0_Speed

HomeP1_Dir

HomeP1_Speed

HomeP2_Dir

HomeOffset_Speed

0x030A

0x030B

0x030C

0x030D

0x030E

0x030F

0x0310

0x0311

Reserved

Return home type.

Phase0 direction in home process.

Phase0 speed.

Phase1 direction in home process.

Phase1 speed.

Phase2 direction in home process.

Speed of move to logical home.

(2) Please refer to PCM-3240 hardware manual for more detailed information of WR1 ~ WR3 controlling register before use them, because incorrect operation on those register could make unexpected result.

(3) For more detail information about home process please refer to P3240MotHome function.


P3240MotWrReg

Function description:

Write data to the specified register for a specific axis (single axis). Please notice that some of the registers are software simulates registers in the driver and are not on the hardware.

Syntax

LRESULT P3240MotWrReg(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byWriteAxis | // Assign operation axis, bit assignment
 | WORD | w CommandCode | // Assign the port for write data
 | DWORD | dwWriteValue | // The port data
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byWriteAxis |  |  | [IN] Assign the operating axis by bit, only one axis can be assigned
 | bit value : |  | 1 for assigned, 0 for not.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
w CommandCode |  |  | [IN] Command to assign which port will be set.
 | value : |  | Port name (1)
dwWriteValue |  |  | [OUT] The value to be set
 | value : |  | depended on which register to be set

Return Values

BoardNumErr | The board number is error
AxisNumErr | The operating axis assignment error
ERROR_SUCCESS | Function success

Remark

(1) Port Name:

Port Name

Constant Value

Describe

Rcnt

0x0100

Real position counter, -2,147,483,648 ~ +2,147,483,647

Lcnt

0x0101

Logical position counter, -2,147,483,648 ~ +2,147,483,647

Pcmp

0x0102

COMP+ register, -2,147,483,648 ~ +2,147,483,647

Ncmp

0x0103

COMP- register, -2,147,483,648 ~ +2,147,483,647

Pnum

0x0104

Pulse number

WR1

0x0212

Control Register WR1 (2)

WR2

0x0214

Control Register WR2 (2)

WR3

0x0216

Control Register WR3 (2)

RG

0x0300

Setting range value, 8,000,000 ~ 16,000

SV

0x0301

Setting initial driving speed

DV

0x0302

Setting driving speed

MDV

0x0303

Setting maximum speed

AC

0x0304

Setting acceleration

AK

0x0306

Setting acceleration rate

PLmt

0x0307

P/CW/+ direction limitation in driving pulse

NLmt

0x0308

N/CCW/- direction limitation in driving pulse

HomeOffset

0x0309

Offset value for phase 3 in home process.

HomeMode

HomeType

HomeP0_Dir

HomeP0_Speed

HomeP1_Dir

HomeP1_Speed

HomeP2_Dir

HomeOffset_Speed

0x030A

0x030B

0x030C

0x030D

0x030E

0x030F

0x0310

0x0311

Reserved

Home type.

Phase0 direction in home process.

Phase0 speed.

Phase1 direction in home process.

Phase1 speed.

Phase2 direction in home process.

Phase 3 Speed.

(2) Please refer to PCM-3240 hardware manual for more detailed information of WR1 ~ WR3 controlling register before use them, because incorrect operation on those register could make unexpected result.

(3) For more detail information about home process please refer to P3240MotHome function.


P3240MotRdMutiReg

P3240MotRdMultiReg

Function description:

Retrieve data content of the specified register for specific axes (multiple axes). Please notice that some of the registers are software simulates registers in the driver and are not on hardware.

Syntax

LRESULT P3240MotRdMultiReg(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byReadAxis | // Assign operation axis, bit assignment
 | WORD | w CommandCode | // Assign the port for read data
 | DWORD* | lpReturn_XAxisValue | // The port data for X axis
 | DWORD* | lpReturn_YAxisValue | // The port data for Y axis
 | DWORD* | lpReturn_ZAxisValue | // The port data for Z axis
 | DWORD* | lpReturn_UAxisValue | // The port data for U axis
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byReadAxis |  |  | [IN] Assign the operating axis by bit, multiple axes can be assigned
 | bit value : |  | 1 for assigned, 0 for not.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
w CommandCode |  |  | [IN] Assign the port address
 | value : |  | Port name(1)
lpReturn_X(Y,Z,U)Value |  |  | [OUT] The port data for read
 | value : |  | Depended on which Register be read

Return Values

AxisNumErr | The operating axis assignment error
RegItemErr | The assign port can be read
ERROR_SUCCESS | Function success

Remark

(1) Port definition:

Port Name

Constant Value

Describe

Rcnt

0x0100

Real position counter

Lcnt

0x0101

Logical position counter

Pcmp

0x0102

P/CW/+ direction compare register

Ncmp

0x0103

N/CCW/- direction compare register

Pnum

0x0104

Pulse number

CurV

0x0105

Current logical driving speed

CurAC

0x0106

Current logical acceleration

RR0

0x0200

Status Register 0 for Read (2)

RR1

0x0202

Status Register 1 for Read (2)

RR2

0x0204

Status Register 2 for Read (2)

RR3

0x0206

Status Register 3 for Read (2)

RR4

0x0208

Status Register 4 for Read (2)

RR5

0x020A

Status Register 5 for Read (2)

WR1

0x0212

Control Register 1 for write (2)

WR2

0x0214

Control Register 2 for write (2)

WR3

0x0216

Control Register 3 for write (2)

WR4

0x0218

Control Register 4 for write (2)

WR5

0x021A

Control Register 5 for write (2)

RG

0x0300

Current speed range value

SV

0x0301

Current initial driving speed

DV

0x0302

Current driving speed

MDV

0x0303

Current maximum speed

AC

0x0304

Current acceleration

AK

0x0306

Current acceleration rate

PLmt

0x0307

P/CW/+ direction limitation in pulse

NLmt

0x0308

N/CCW/- direction limitation in pulse

HomeOffset

0x0309

Offset value for phase 3 in home process

HomeMode

HomeType

HomeP0_Dir

HomeP0_Speed

HomeP1_Dir

HomeP1_Speed

HomeP2_Dir

HomeOffset_Speed

0x030A

0x030B

0x030C

0x030D

0x030E

0x030F

0x0310

0x0311

Reserved

Home type.

Phase0 direction in home process.

Phase0 speed.

Phase1 direction in home process.

Phase1 speed.

Phase2 direction in home process.

Phase 3 speed.

(2) Please refer to PCM-3240 hardware manual for more detailed information of status register(RR0 ~ RR5) and controlling register(WR1 ~ WR3) before use them, because incorrect operation on those register could make unexpected result.

(3) For more detail information about home process please refer to P3240MotHome function.


P3240MotRdReg

Function description:

Retrieve data content of specified register for a specific axis (single axis). Please notice that some of the registers are software simulates registers in the driver and are not on the hardware.

Syntax

LRESULT P3240MotRdReg(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | byReadAxis | // Assign operation axis, bit assignment
 | WORD | w CommandCode | // Assign the port for read data
 | DWORD * | lpReturnValue | // The port data
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
byReadAxis |  |  | [IN] Assign the operating axis by bit, only one axis can be assigned
 | bit value : |  | 1 for assigned, 0 for not.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
w CommandCode |  |  | [IN] Command to assign which port will be read.
 | value : |  | Port name (1)
lpReturnValue |  |  | [OUT] The port data for read
 | value : |  | depended on which Register be read

Return Values

AxisNumErr | The operating axis assignment error
ERROR_SUCCESS | Function success

Remark

(1) Port Name:

Port Name

Constant Value

Describe

Rcnt

0x0100

Real position counter

Lcnt

0x0101

Logical position counter

Pcmp

0x0102

P/CW/+ direction compare register

Ncmp

0x0103

N/CCW/- direction compare register

Pnum

0x0104

Pulse number

CurV

0x0105

Current logical driving speed

CurAC

0x0106

Current logical acceleration

RR0

0x0200

Status Register 0 for Read (2)

RR1

0x0202

Status Register 1 for Read (2)

RR2

0x0204

Status Register 2 for Read (2)

RR3

0x0206

Status Register 3 for Read (2)

RR4

0x0208

Status Register 4 for Read (2)

RR5

0x020A

Status Register 5 for Read (2)

WR1

0x0212

Control Register 1 for write (2)

WR2

0x0214

Control Register 2 for write (2)

WR3

0x0216

Control Register 3 for write (2)

WR4

0x0218

Control Register 4 for write (2)

WR5

0x021A

Control Register 5 for write (2)

RG

0x0300

Current speed range value

SV

0x0301

Current initial driving speed

DV

0x0302

Current driving speed

MDV

0x0303

Current maximum speed

AC

0x0304

Current acceleration

AK

0x0306

Current acceleration rate

PLmt

0x0307

P/CW/+ direction limitation in pulse

NLmt

0x0308

N/CCW/- direction limitation in pulse

HomeOffset

0x0309

Offset value for phase 3 in home process

HomeMode

HomeType

HomeP0_Dir

HomeP0_Speed

HomeP1_Dir

HomeP1_Speed

HomeP2_Dir

HomeOffset_Speed

0x030A

0x030B

0x030C

0x030D

0x030E

0x030F

0x0310

0x0311

Reserved

Home type.

Phase0 direction in home process.

Phase0 speed.

Phase1 direction in home process.

Phase1 speed.

Phase2 direction in home process.

Phase 3 speed.

(2) Please refer to PCM-3240 hardware manual for more detailed information of status register(RR0 ~ RR5) and controlling register(WR1 ~ WR3) before use them, because incorrect operation on those register could make unexpected result.

(3) For more detail information about home process please refer to P3240MotHome function.


P3240ReadEEPROM

Function description:

Retrieve the data content of EEPROM on the card.

Syntax

LRESULT P3240 ReadEEPROM(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | by EEPROMAddress | // Assign the EEPROM address.
 | unsigned short * | pusRead Value | // The port data
);

Parameter

byBoard_ID |  | [IN] Assign board ID number
 | value : | 0 to 15, other values are invalid
byEEPROMAddress |  | [IN] Assign the EEPROM address.
 | bit value : | From 0 to 63, other values are invalid.
p usReadValue |  | [OUT] Pointer to an unsigned short. It is used to return values read from EEPROM.
 | value : | Can not be NULL.

Return Values

BoardNumErr | The Board num is error
ParaValue Err | The input parameter is error
ERROR_SUCCESS | Function success


P3240WriteEEPROM

Function description:

Update the data content of EEPROM on the card.

Syntax

LRESULT P3240 WriteEEPROM(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | by EEPROMAddress | // Assign the EEPROM address.
 | unsigned short * | usWrite Value | // The port data
);

Parameter

byBoard_ID |  | [IN] Assign board ID number
 | value : | 0 to 15, other values are invalid
byEEPROMAddress |  | [IN] Assign the EEPROM address.
 | bit value : | From 0 to 63, other values are invalid.
usWriteValue |  | [IN] The value to be write to EEPROM
 | value : | Any unsigned short value.

Return Values

BoardNumErr | The Board num is error
ParaValue Err | The input parameter is error
ERROR_SUCCESS | Function success


Error Message

Error Message | Return Code | Error Type | Message describe
ERROR_SUCCESS | 0X0000 | System (1) | Function call success
BoardNumErr | 0x0001 | Function (1) | The assigned Board number error
CreateKernelDriverFail | 0x0002 | System | System return error when open kernel driver
CallKernelDriverFail | 0x0003 | System | System return error when call kernel driver
RegistryOpenFail | 0x0004 | System | Open Registry file error
RegistryReadFail | 0x0005 | System | Read Registry file error
AxisNumErr | 0x0006 | Function | The assigned axis number error
UnderRGErr | 0x0007 | Function | RG value is under valid range
OverRGErr | 0x0008 | Function | RG value is over valid range
UnderSVErr | 0x0009 | Function | SV value is under valid range
OverSVErr | 0x000a | Function | SV value is over valid range
OverMDVErr | 0x000b | Function | MDV value is over valid range
UnderDVErr | 0x000c | Function | DV value is under valid range
OverDVErr | 0x000d | Function | DV value is over valid range
UnderACErr | 0x000e | Function | AC value is under valid range
OverACErr | 0x000f | Function | AC value is over valid range
UnderAKErr | 0x0010 | Function | AK value is under valid range
OverAKErr | 0x0011 | Function | AK value is over valid range
OverPLmtErr | 0x0012 | Function | PLmt value is over valid range
OverNLmtErr | 0x0013 | Function | NLmt value is over valid range
MaxMoveDistErr | 0x0014 | Function | Moving distance is over single maximum distance
AxisDrvBusy | 0x0015 | Function | One of the assigned axis is in busy state
RegUnDefine | 0x0016 | Function | The assigned Register have no defined
ParaValueErr | 0x0017 | Function | One of the assigned parameter value is invalid
ParaValueOverRange | 0x0018 | Function | One of the assigned parameter value is over valid value
ParaValueUnderRange | 0x0019 | Function | One of the assigned parameter value is under valid value
AxisHomeBusy | 0x001a | Function | One of the assigned axis is in Home process
AxisExtBusy | 0x001b | Function | One of the assigned axis is in External driving mode
RegistryWriteFail | 0x001c | System | Write Registry file error
ParaValueOverErr | 0x001d | Function | One of the assigned parameter value is over valid value
ParaValueUnderErr | 0x001e | Function | One of the assigned parameter value is under valid value
OverDCErr | 0x001f | Function | DC value is over valid range
UnderDCErr | 0x0020 | Function | DC value is under valid range
UnderMDVErr | 0x0021 | Function | MDV value is under valid range
RegistryCreateFail | 0x0022 | System | Create Registry file fail
CreateThreadErr | 0x0023 | System | Create internal Thread error
HomeSwStop | 0x0024 | Function | Return Home process be stopped by P3240MotStop function
ChangeSpeedErr | 0x0025 | Function | The speed parameter is invalid
DOPortAsDriverStatus | 0x0026 | Function | Output DO when DO type is assigned to indicator function
OpenEventFail | 0x0030 | System | System return error when create IRQ event
DeviceCloseErr | 0x0032 | System | System return error when in P3240MotDevClose process
HomeEMGStop | 0x0040 | Function | Return home process be stopped by hardware emergency stop input
HomeLMTPStop | 0x0041 | Function | Return home process be stopped by hardware positive limited switch
HomeLMTNStop | 0x0042 | Function | Return home process be stopped by hardware negative limited switch
HomeALARMStop | 0x0043 | Function | Return home process be stopped by ALARM signal input.
AllocateBufferFail | 0x0050 | Function | System return error when buffer allocate
BufferReAllocate | 0x0051 | Function | The assigned buffer have been allocated and try to reallocate again
FreeBufferFail | 0x0052 | System | The handle of assigned Buffer is NULL or has been freed before
FirstPointNumberFail | 0x0053 | Function | The first data hasn't been set and try to set other number data
PointNumExceedAllocatedSize | 0x0054 | Function | Current buffer is full
BufferNoneAllocate | 0x0055 | Function | The assigned Buffer number hasn't created
SequenceNumberErr | 0x0056 | Function | The point number is not continue number of previous setting data
PathTypeErr | 0x0057 | Function | Path type is not IPO_L2, IPO_L3, IPO_CW or IPO_CCW.
PathTypeMixErr | 0x0060 | Function | Continue Data buffer have mixed IPO_L2 and IPO_L3 or IPO_CW/IPO_CCW and IPO_L3 path type
BufferDataNotEnough | 0x0061 | Function | Buffer contain only one data
DeviceNotExist | 0x0062 | Function | Device not in the system

Remark:

(1) PCM-3240 error messages can be separated from System Error to Function Error. System Error is directly returned from the windows operation system, such as resource allocate failure, system unstable or file missing and so on. Function Error is returned by our driver, such as invalid input parameter values or the specified axis is in driving.


P3240EnableCompNLimit

Function description:

Enable or disable to use COMP- register of specified axis as motion limitation (can be stopped by software) on negative or backward (-) motion direction.

Syntax

LRESULT P3240EnableComNLimit(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Enable | //enable or disable

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Enable

[IN] enable or disable

value :

0 and 1 is Valid, 0 for Enable 1 for disable

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240EnableCompPLimit


P3240EnableCompPLimit

Function description:

Enable or disable to use COMP+ register of specified axis as motion limitation (can be stopped by software) on foreword (+) motion direction.

Syntax

LRESULT P3240EnableCompPLimit(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Enable | //enable or disable

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis .

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Enable

[IN] enable or disable

value :

0 and 1 is Valid , 0 for Enable 1 for disable

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240EnableCompNLimit


P3240GetAcel

Function description:

Retrieve the raw data of current acceleration or deceleration of the specified axis.

The return value (from MCX-314) is a raw data and needs the following formula to convert to the real acceleration or deceleration (PPS) value:

AC = A × 125 × M

AC: Acceleration (PPS)

A: The raw data that is retrieved from MCX-314 register

M: Multiple, and M = 8,000,000/R. The R is the range value and can be retrieved by using port RG in the P3240MotRdReg function.

We recommend the P3240MotRdReg function with port CurAC to retrieve current converted acceleration or deceleration, instead of P3240GetAcel which only retrieves the raw data from MCX-314 register.

Syntax

LRESULT P3240GetAcel(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //Specified the axis
DWORD * | lpValue | //The value of acceleration or Deceleration in chip's register.

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] The value of acceleration or Deceleration in chip's register.

value :

1～8000

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240GetSpeed


P3240GetDriveState

P3240GetDriverState

Function description:

Retrieve the driving status on the specified axis.

Syntax

LRESULT P3240GetDriverState(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //Specified the axis
USHORT * | lpValue | //the driving status of specified axis

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] Specified the axis will action

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] the driving status of specified axis, get from RR0

value :

0->leisure 1->driving

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success
Remark:

1. P3240MotRdReg can be used to read RR0 register, and bit D8 displays the driving status of interpolation.

See Also

P3240GetMotionInput, P3240GetMotionState, P3240GetError


P3240GetError

Function description:

Retrieve the error status on the specified axis.

Syntax

LRESULT P3240GetError(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //Specified the axis
USHORT * | lpValue | //error status of specified axis

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] Specified the axis will action

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT]error status of specified axis, get from RR0

value :

0->no error 1->error occur

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240GetDriverState, P3240GetMotionInput, P3240GetMotionState


P3240GetInput

Function description:

Retrieve the status of DI channels (bit 0 to 3 of DIO port) and external input signals from the input register (RR4 or RR5 of MCX-314) on the specified axis.

Syntax

LRESULT P3240GetInput(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //Specified the axis
USHORT * | lpValue | //get the input status

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] Specified the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] get the input status

value :

Bit0->IN0 for specified axis.

Bit1->IN1 for specified axis.

Bit2->IN2 for specified axis.

Bit3->IN3 for specified axis.

Bit4->EXPP (external drive control input for positive direction)

Bit5->EXPM (external drive control input for negative direction)

Bit6->InPos for specified axis.

Bit7->Alarm for specified axis .

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success


P3240GetMotionInput

Function description:

Retrieve the value content of status register 2(RR2 of MCX-314) on the specified axis.

Syntax

LRESULT P3240GetMotionInput(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //specify the axis
USHORT * | lpValue | //The value of bit0-5 of RR2

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] specify the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] get The value of bit0-5 of RR2

value :

0~63

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240GetDriverState, P3240GetMotionState, P3240GetError


P3240GetMotionState

Function description:

Retrieve the value content of status register 1(RR1 of MCX-314) on the specified axis.

Syntax

LRESULT P3240GetMotionState(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //specify the axis
USHORT * | lpValue | //The value of bit0-15 of RR1

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] specify the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] get The value of bit0-15 of RR1

value :

0~32767

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240GetDriverState, P3240GetMotionInput, P3240GetError


P3240GetPracticalRegister

Function description:

Retrieve the real position counter on the specified axis.

Syntax

LRESULT P3240GetPracticalRegister(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //Specified the axis
LONG * | lpValue | //The value real position count

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] The value real position count.

value :

-2,147,483,648~2,147,483,647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240GetTheoreticalRegister


P3240GetSpeed

Function description:

Retrieve the raw data of current speed on the specified axis.

The return value (get from MCX-314) is a raw data and needs the following formula to convert it to the real speed (PPS).

DV = V × M

DV: Speed(PPS),

V: The raw data that retrieved from the MCX-314 register.

M: Multiple, M = 8,000,000/R. R can be retrieved using P3240MotRdReg through the port RG.

We recommend the P3240MotRdReg function with port CurV in order to retrieve converted speed instead of P3240GetSpeed which retrieves only the raw data from MCX-314 register.

Syntax

LRESULT P3240GetSpeed(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //Specified the axis
DWORD * | lpValue | //The value of driving speed in chip's register

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] The value of driving speed in chip's register.

value :

1~8000

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240GetAcel


P3240GetTheorecticalRegister

Function description:

Retrieve the logical position counter on the specified axis.

Syntax

LRESULT P3240GetTheorecticalRegister(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //Specified the axis
LONG * | lpValue | //The value logic position count

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byGetAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lpValue

[OUT] The value logic position count.

value :

-2,147,483,648~2,147,483,647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success

See Also

P3240GetPracticalRegiste


P3240MotMoveAbs

P3240MoveAbs

Function description:

Move the specified axis from current position to destination in absolute mode.

Syntax

LRESULT P3240MoveAbs(
BYTE | byBoard_ID | //Board ID number
BYTE | byMoveAxis | //Specified the axis
LONG | lPulseNumber | //Set Output pulse quantity

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byHomeAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lPulseNumber

[IN] Set Output pulse quantity

value :

-2,147,483,648~2,147,483,647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

AxisDrvBusy The axis is in moving
AxisHomeBusy | The axis is moving home
AxisExtBusy | The axis is in external mode driving

CallKernelDriverFail

Call kernel driver fail
OverPLmtErr | Over Positive limit
OverNLmtErr | Over Negative limit
MaxMoveDistErr | The setting distance out range of logical counter

ERROR_SUCCESS

Function success

See Also

P3240MoveIns, P3240MoveCircle, P3240MotPtp, P3240MotArc, P3240MotArcTheta, P3240MotLine, P3240MotCmove, P3240MotHome


P3240MotMoveCircle

P3240MoveCircle

Function description:

Move two specified axes in circular interpolation by relative mode, the profile is a circle.

Syntax

LRESULT P3240MoveCircle(
BYTE | byBoard_ID | //Board ID number
BYTE | byMoveAxis | //Specified the axis
BYTE | byAxisDirection | //direction
LONG | lCenter1 | //The circle center for the first axis in relative mode
LONG | lCenter2 | //The circle center for the second axis in relative mode

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byMoveAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

byAxisDirection

[IN] direction

value :

0-> CW direction 1-> CCW direction

lCenter1

[IN] The circle center for the first axis in relation mode

value :

-2,147,483,648~2,147,483,647

lCenter2

[IN] The circle center for the second axis in relation mode

value :

-2,147,483,648~2,147,483,647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

AxisDrvBusy The axis is in moving
AxisHomeBusy | The axis is moving home
AxisExtBusy | The axis is in external mode driving

CallKernelDriverFail

Call kernel driver fail

ERROR_SUCCESS

Function success

Remark

If need slow down, please call P3240SetDeceleration function first.

See Also

P3240MoveIns, P3240MoveAbs, P3240MotPtp, P3240MotArc, P3240MotArcTheta, P3240MotLine, P3240MotCmove, P3240MotHome


P3240MoveIns

Function description:

Move the specified axis from current position to destination in relative mode.

Syntax

LRESULT P3240MoveIns(
BYTE | byBoard_ID | //Board ID number
BYTE | byMoveAxis | //Specified the axis
LONG | lPulseNumber | //Set Output pulse quantity

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byHomeAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lPulseNumber

[IN] Set Output pulse quantity

value :

-2,147,483,648~2,147,483,647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
AxisDrvBusy | The axis is in moving
AxisHomeBusy | The axis is moving home
AxisExtBusy | The axis is in external mode driving

CallKernelDriverFail

Call kernel driver fail
OverPLmtErr | Over Positive limit
OverNLmtErr | Over Negative limit

MaxMoveDistErr The setting distance out range of logical counter

ERROR_SUCCESS

Function success

See Also

P3240MoveAbs, P3240MoveCircle, P3240MotPtp, P3240MotArc, P3240MotArcTheta, P3240MotLine, P3240MotCmove, P3240MotHome


P3240SetAcceleration

Function description:

Set the acceleration value on the specified axis.

The acceleration value must be a multiple of 125, because the driver determines the value by the following formula:

Syntax

LRESULT P3240SetAcceleration(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Specified the axis
DWORD | accel | //The acceleration value

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis for setting by bit. When all bit is 0, it will set for Line and Arc interpolation parameters, not for X,Y,Z,U axis.

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

accel

[IN] The acceleration value

value :

125~500,000,000

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error
ParaValueUnderRange | parameter under range
ParaValueOverRange | parameter over range
OverDVErr | Driver speed out of range

ERROR_SUCCESS

Function success

See Also

P3240SetDeceleration, P3240SetDrivingSpeed, P3240SetJerk, P3240SetRange, P3240SetStartSpeed, P3240MotWrReg


P3240SetCompareObject

Function description:

Set either the real position counter or logical position counter to be compared with COMP+/- register on the specified axis.

Syntax

LRESULT P3240SetCompareObject(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //set the compared register

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] assign the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

value

[IN]set the compared register

value :

0->logical position counter 1->real position counter; other value is invalid

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

One of the assigned parameter value is invalid

ERROR_SUCCESS

Function success


P3240SetCompNLimit

Function description:

Set COMP - register on the specified axis.

COMP - register is used to compare with the logical/real position counter, and the result will be output to bit D0 of RR1 register or nOut5/CMPM signal. It can be also used as the negative or backward (-) direction software limit.

Syntax

LRESULT P3240SetCompNLimit(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
LONG | byWriteValue | //Data of COMP- register

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

byWriteValue

[IN] Data of COMP- register

value :

-2147483648 ~ 2147483647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ERROR_SUCCESS

Function success


P3240SetCompPLimit

Function description:

Set COMP+ register on the specified axis.

COMP+ register is used to compare with the logical/real position counter, and the comparison result will be output to bit D0 of register RR1 or nOut4/CMPP signal. It can be also used as the forward (+) direction software limit.

Syntax

LRESULT P3240SetCompPLimit(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Assign the axis
LONG | byWriteValue | //Data of COMP+ register

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

byWriteValue

[IN] Data of COMP+ register

value :

-2147483648 ~ 2147483647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ERROR_SUCCESS

Function success


P3240SetDeceleration

Function description:

Set the deceleration value on the specified axis.

The deceleration value must be a multiple of 125, because the driver determines the value by the following formula:

Syntax

LRESULT P3240SetDeceleration(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Specified the axis
DWORD | decel | //The deceleration value
LONG | lRetrieve | //The retrieve value

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis for setting by bit. When all bit is 0, it will set for Line and Arc interpolation parameters, not for X,Y,Z,U axis.

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

accel

[IN] The deceleration value

value :

125~500,000,000

lRetrieve

[IN] The retrieve value

value :

For common use please set it to zero and for advance use need to set according to the detail environment

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueErr

Parameter value error
ParaValueUnderRange | parameter under range
ParaValueOverRange | parameter over range

ERROR_SUCCESS

Function success

Remark

If need move arc slow down, please call this function first.

Additional, the 4th parameter of this function need user action.

1. For common user, please set it to zero.

2. For the advance user need high level precise in the deceleration process:

First : set the 4th parameter to zero. Run user program.

Second : Run P3240GetSpeed and P3240GetTheorecticalRegister in a timer or thread. If the deceleration process precise enough, the parameter needn't be modified. Otherwise, it need be modified according to the difference between end logical position and logical position of deceleration process over ( in another word, this position is when driving speed down to the SV ).

See Also

P3240SetAcceleration, P3240SetDrivingSpeed, P3240SetJerk, P3240SetRange, P3240SetStartSpeed, P3240MotWrReg


P3240SetDrivingSpeed

Function description:

Set the driving speed value on the specified axis.

Syntax

LRESULT P3240SetDrivingSpeed(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Specified the axis
DWORD | lSpeedValue | //The speed value

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis for setting by bit. When all bit is 0, it will set for Line and Arc interpolation parameters, not for X,Y,Z,U axis.

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lSpeedValue

[IN] The speed value

value :

1~4,000,000

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error
ParaValueUnderRange | parameter under range
ParaValueOverRange | parameter over range
OverDVErr | Driver speed out of range

ERROR_SUCCESS

Function success

Note:

1. If fixed pulse S-curve acceleration/deceleration driving, there is no way to change the drive speed during the driving. In continuous S-curve acceleration/deceleration driving, the S-curve profile cannot be exactly tracked if the speed alterations during the acceleration/deceleration. It is better to change the drive speed in the constant speed period.

2. In fixed pulse trapezoidal driving, the frequent changes of drive speed may occur residual pulses in the ending of deceleration.

See Also

P3240SetAcceleration, P3240SetDeceleration, P3240SetJerk, P3240SetRange, P3240SetStartSpeed, P3240MotWrReg


P3240SetEncoderMultiple

Function description:

Set the multiple of quadrature (A/B Phase) encoder input signal on the specified axis.

Syntax

LRESULT P3240SetEncoderMultiple(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //multiple

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN]multiple

value :

0: Multiple of encoder is 1. It means 1 count per encoder input cycle.

1: Multiple of encoder is 2. It means 2 counts per encoder input cycle.

2: Multiple of encoder is 4. It means 4 counts per encoder input cycle.

other value->Invalid.

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success


P3240SetHomeLogic

Function description:

Set home sensor logical level on the specified axis.

nIN3 is used for home sensor input.

Syntax

LRESULT P3240SetHomeLogic(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN]logic level

value :

0->active on the low level 1->active on the high level ;other value is invalid

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetZLogic, P3240SetInputLogic


P3240SetInPosition

Function description:

Set logical level of nINPOS input signal on the specified axis, and enable or disable it for servo motor.

If it is enabled, after the output driving signal is finished the specified axis driving status drives until the nINPOS signal is active.

Syntax

LRESULT P3240SetInPosition(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Enable | //enable or disable
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Enable

[IN] enable or disable

value :

0->disable 1->enable ;other value is invalid

Value

[IN] logic level

value :

0->active on the low level 1->active on the high level ; other value is invalid

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetServoAlarm


P3240SetInputLogic

Function description:

Set logical level of input signals on the specified axis, including nIN1 and nIN2.

Syntax

LRESULT P3240SetInputLogic(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | D4Value | //nIN1 logic level

USHORT

D6Value

 //nIN2 logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

D4Value

[IN] nIN1 logic level

value :

0 or 1 is Valid, 0: stop on the low level, 1: stop on the high level

D6Value

[IN] nIN2 logic level

value :

0 or 1 is Valid, 0: stop on the low level, 1: stop on the high level

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

Remark:

(1) Because IN0 is used as input signal of encoder phase Z, the logical level of IN0 can be set by P3240SetZLogic.

(2) Because IN3 is used as input signal of home limit sensor, the logical level of it can be set by P3240SetHomeLogic.

See Also

P3240SetZLogic, P3240SetHomeLogic


P3240SetJerk

Function description:

Set the jerk on the specified axis.

Jerk is the increasing / decreasing rate of acceleration / deceleration in a time unit.

Syntax

LRESULT P3240SetJerk(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Specified the axis
DWORD | lJerk | //The jerk value

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis for setting by bit. When all bit is 0, it will set for Line and Arc interpolation parameters, not for X,Y,Z,U axis.

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lJerk

[IN] The jerk value

value :

954~3,125,000,000,000

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error
ParaValueUnderRange | parameter under range
ParaValueOverRange | parameter over range
OverDVErr | Driver speed out of range

ERROR_SUCCESS

Function success

See Also

P3240SetAcceleration, P3240SetDeceleration, P3240SetDrivingSpeed, P3240SetRange, P3240SetStartSpeed, P3240MotWrReg


P3240SetNLimitLogic

Function description:

Set the logical level of negative or backward (-) motion direction limit input signal on the specified axis.

Syntax

LRESULT P3240SetNLimitLogic(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN]logic level

value :

0 or 1 is Valid

0: active on the low level; 1: active on the high level

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetPLimitLogic


P3240SetOutput

Function description:

Set level for output signals when OUT4-7 are general purpose output signals on the specified axis.

Syntax

LRESULT P3240SetOutput(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //OUT4~7 signal level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN]OUT4~7 output signal level

value :

Bit0 -----OUT4
Bit1 -----OUT5
Bit2 -----OUT6
Bit3 -----OUT7

0->low level output 1-> high level output

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success


P3240SetOutputType

Function description:

Set Output signals (OUT4~7) as general purpose or driving status outputting purpose on the specified axis.

Syntax

LRESULT P3240SetOutputType(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Enable | //OUT4~7 type

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Enable

[IN]Set OUT4~7 as general purpose output or as driving status outputting.

value :

0->general purpose output 1-> driving status outputting

other value is invalid

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success


P3240SetPLimitLogic

Function description:

Set the logical level of foreword (+) motion direction limit input signal on the specified axis.

Syntax

LRESULT P3240SetPLimitLogic(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN]logic level

value :

0 or 1 is Valid

0: active on the low level; 1: active on the high level

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetNLimitLogic


P3240SetPracticalRegister

Function description:

Set real position on the specified axis.

Syntax

LRESULT P3240SetPracticalRegister(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Specified the axis
LONG | lPosition | //The value of real position counter.

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lPosition

[IN] The value of real position counter.

value :

-2,147,483,648~2,147,483,647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ERROR_SUCCESS

Function success

See Also

P3240SetTheorecticalRegister


P3240PulseDirLogic

P3240SetPulseDirLogic

Function description:

Set logical level of the direction output signal when in 1-pulse mode on the specified axis.

Syntax

LRESULT P3240SetPulseDirLogic(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN] logic level

value :

0 or 1 is Valid,

0->+ direction is low. – direction is high

1->+ direction is high. – direction is low.

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetPulseLogic, P3240SetPulseMode


P3240SetPulseLogic

Function description:

Set logical level of driving pulses on the specified axis.

Syntax

LRESULT P3240SetPulseLogic(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN] logic level

value :

0 or 1 is Valid,

0->positive logical level, high level is '1' and low level is '0'

1->negative logical level, high level is '0' and low level is '1'

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetPulseDirLogic, P3240SetPulseMode


P3240SetPulseMode

Function description:

Set output pulse type as independent 2-pulse type or 1-pulse 1-direction type on the specified axis.

Syntax

LRESULT P3240SetPulseMode(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //pulse mode

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Value

[IN] pulse mode

value :

0 or 1 is Valid,

0: Independent 2-pulse type, + direction pulse are output through the output signal nP+P/nP+N, - direction pulse are output through the output signal nP-P/nP-N.

1: 1-pulse 1-direction type, + and – directions pulses are output through the output signal nP+P/nP+N, and nP-P/nP-N is for direction signals.

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetPulseDirLogic, P3240SetPulseLogic


P3240SetRange

Function description:

Set the range on the specify axis.

Syntax

LRESULT P3240SetRange(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Specified the axis
DWORD | lRange | //The range value

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis for setting by bit. When all bit is 0, it will set for Line and Arc interpolation parameters, not for X,Y,Z,U axis.

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lRange

[IN] The range value

value :

8,000,000~16,000

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error
ParaValueUnderRange | parameter under range
ParaValueOverRange | parameter over range

ERROR_SUCCESS

Function success

Remark:

(1)The Range can not be changed during the driving, otherwise the speed will be changed discontinuously.

(2)This function will also effect the MDV (Maximum Drive Speed).

(3)We recommend to use P3240MotAxisParaSet if you want to change the range, because in that function the range is auto set according to the driving speed and other parameters, it will be a optimized value.

See Also

P3240SetAcceleration, P3240SetDeceleration, P3240SetDrivingSpeed, P3240SetJerk, P3240SetStartSpeed, P3240MotWrReg


P3240SetServoAlarm

Function description:

Set active level of input signal nALARM and enable/disable of servo alarm input signal nALARM on the specified axis.

Syntax

LRESULT P3240SetServoAlarm(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Enable | //enable or disable
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

Enable

[IN] enable or disable

value :

0->disable 1->enable; other value is invalid

Value

[IN] logic level

value :

0->active on the low level 1->active on the high level ; other valid is invalid

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetInPosition


P3240SetStartSpeed

Function description:

Set the starting speed value for the specified axis.

The initial speed must be a multiple of 125, because the driver determines the speed by the following formula:

Syntax

LRESULT P3240SetStartSpeed(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Assign the axis
DWORD | lSpeedValue | //The speed value

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis for setting by bit. When all bit is 0, it will set for Line and Arc interpolation parameters, not for X,Y,Z,U axis.

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

Bit value: 0 for non operation, 1 for operation

lSpeedValue

[IN] The speed value

value :

1~4,000,000

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error
ParaValueUnderRange | parameter under range
ParaValueOverRange | parameter over range
OverDVErr | Driver speed out of range

ERROR_SUCCESS

Function success
Remark:

(1) For stepper motors, the user should set the initial speed smaller than the self-starting frequency of stepper motors.

(2) For servo motors, the recommended setting initial speed is higher than the value of the square root of acceleration .

See Also

P3240SetAcceleration, P3240SetDeceleration, P3240SetDrivingSpeed, P3240SetJerk, P3240SetRange, P3240MotWrReg


P3240SetTheorecticalRegister

Function description:

Set logical position for the specified axis.

Syntax

LRESULT P3240SetTheorecticalRegister(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //Specified the axis
LONG | lPosition | //The value of logical position counter.

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Specified the axis

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

lPosition

[IN] The value of logical position counter.

value :

-2,147,483,648~2,147,483,647

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ERROR_SUCCESS

Function success

See Also

P3240SetPracticalRegister


P3240SetZLogic

Function description:

Set logical level of nIN0 on the specified axis.

nIN0P/nIN0N are also used as phase Z signals of encoder.

Syntax

LRESULT P3240SetZLogic(
BYTE | byBoard_ID | //Board ID number
BYTE | bySetAxis | //assign the axis
USHORT | Value | //logic level

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] Assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

V alue

[IN] logic level

value :

0->active on the low level 1->active on the high level ;The other value is invalid.

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ParaValueErr

Parameter value error

ERROR_SUCCESS

Function success

See Also

P3240SetHomeLogic, P3240SetInputLogic


P3240_InpWord

Function description:

Read a word of data from the specified register of PCM-3240. Refer to PCM-3240 hardware manual before using this function.

Syntax

BOOL P3240_InpWord(
BYTE | byBoard_ID | //Board ID number
USHORT | nPort | //Port number
USHORT* | wData | //The value of the specified port.

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

nPort

[IN] The offset from the base address.

value :

0~31

wData

[OUT]The value of the specified port.

value :

0~65535

Return Values

TRUE

SUCCESS

FALSE

ERROR OCCUR

See Also

P3240_OutpWord


P3240_OutpWord

Function description:

Write a word of data to the specified register of PCM-3240. Refer to PCM-3240 hardware manual before using this function.

Syntax

BOOL P3240_OutpWord(
BYTE | byBoard_ID | //Board ID number
USHORT | nPort | //Port number
USHORT | wData | //The value to the specified port.

);

Parameters

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

nPort

[IN] The offset from the base address.

value :

0~31

wData

[IN]The value to the specified port.

value :

0~65535

Return Values

TRUE

SUCCESS

FALSE

ERROR OCCUR

See Also

P3240_InpWord


Examples

This chapter provides several examples to demonstrate how to build an application using the PCM-3240 Driver. Windows console program, Visual Basic and BCB are used to build the application and demonstrate the step-by-step procedure. The source code for these programs is also provided. The source code is located in the Program Files\Advantech\PCM-3240\Examples directory. For information about using other function groups or other development tools refer to the function manual.

This chapter assumes that you are familiar with the basic concepts of using Visual Basic, C++ Builder and Visual C++.

Examples description


Examples Description

The list below shows programs written in eMbedded Visual C++. The programs can be run directly. They may also be used to test PCM-3240 cards and develop new programs.

No. | Example Name | Description | EVC MFC | EVC Console
1. | BasicDrive | Demo program for PCM-3240 basic motion control functions including 2-Axis linear/arc interpolation, 3-Axis linear interpolation, home function, continuous moving and point to point function. | √ |
2. | ContiDrive3 | Demo program for PCM-3240 continuous interpolation function combined with 2/3-Axis linear interpolation and 2-Axis arc interpolation. | √ |
3. | RegisterFunc4 | Demo program for PCM-3240 using Register Level functions and ARC deceleration. | √ |
4. | P3240ARC | Demo program for X & Y-Axis arc interpolation function with center/end position parameter. |  | √
5. | P3240ArcTheta | Demo program for X & Y-Axis arc interpolation function with center/angle parameter. |  | √
6. | P3240ChangeSpeedOnFly | PCM-3240 X axis demo program will change speed automatically with the provided "speed table", when X_Axis "logical position counter" >= COMP - "comparator table". |  | √
7. | P3240CMOVE | Demo program for X-Axis continuous moving function. |  | √
8. | P3240CompTable | PCM-3240 demo program for X axis continuous trigger compare. |  | √
9. | P3240ContiDrive | Demo program for X & Y-Axis continuous interpolation function. |  | √
10. | P3240DI | Demo program for X-Axis digital input function. |  | √
11. | P3240DO | Demo program for X-Axis digital output function. |  | √
12. | P3240Ext | Demo program for X-Axis external mode (jog, hand wheel). |  | √
13. | P3240HOME | Demo program for return home function. |  | √
14. | P3240IRQ | Demo program for checking event function. |  | √
15. | P3240Line | Demo program for X & Y-Axis linear interpolation function. |  | √
16. | P3240PTP | Demo program for XYZU-Axis point to point function. |  | √
17. | P3240TriggerComp | PCM-3240 demo program for X axis trigger compare function. |  | √
18. | P3240PortIO5 | Demo program for PCM-3240 port read and write. |  | √
19. | P3240EEPROM6 | Demo program for PCM-3240 EEPROM read and write. |  | √

Remark:

1. It is required that before calling any motion function, P3240MotAxisParaSet should be called in order to set the motion parameter.

2. If the servo motor is used, the servo_on signal of the servo motor driver must be turned on, otherwise the motor may not move.

3. In the example ContiDrv, in order to run L3 interpolation the six paths must all be set to type L3, and in order to use L2, CCW and CW type the six paths must be on the same plane. When running Continuous Interpolation, with a set 6 segment of line interpolation the Continuous Interpolation is not stopped when the moving second segment software limit is reached and the motor stops. In this case, user should click the Stop button before running the next cycle.

4. The example RegisterFunc is only used to demonstrate the use of register level functions (parts of the functions are covered). This example calls P3240GetSpeed and P3240GetAcel, because these two functions need to use a multiple to get the real value (for detailed information please refer to the manual). P3240MotrdReg can be used through the port RG to get the range, and then the multiple can be calculated. We recommend the P3240MotRdReg function with port CurV or CurAC to retrieve current converted speed instead of P3240GetSpeed or P3240GetAcel,which retrieve only raw data from MCX-314 register value. In this example we also demonstrate the P3240MotRdReg function to get the speed and acceleration of the circle interpolation. The MCX-314 hardware will put the speed and acceleration of interpolation on the register of the first axis. The sequence of the axes is X, Y, Z, U. For example, when operating the Y and Z axis line interpolation, the Y axis is the first axis and is the only way to get the interpolation speed and acceleration.

5. The example P3240PortIO is used to operate the register of PCM-3420, please refer to the hardware manual before running this example.

6. The example P3240EEPROM is used to demonstrate the EEPROM read and write. In PCM-3240, the capacity of EEPROM is 1k and the address scope is from 0 to 63 because 4 bytes are operated at one time.

7. In the EVC MFC examples, only part of the error code is translated into a meaning message, if other error codes are encountered please refer to Error Message for detailed information.


P3240 API Function for DLL

Utility

DLL Function

P3240MotArc

P3240MotArcTheta

P3240MotAxisParaSet

P3240MotChgDV

P3240MotChgLineArcDV

P3240MotCmove

P3240MotDevAvailable

P3240MotDevClose

P3240MotDevOpen

P3240MotDI

P3240MotDO

P3240MotExtMode

P3240MotHome

P3240MotHomeStatus

P3240MotLine

P3240MotPtp

P3240MotRdMutiReg

P3240MotRdReg

P3240MotSavePara

P3240MotStop

P3240MotBusy

P3240MotWrMutiReg

P3240MotWrReg

P3240MotReset

P3240InitialContiBuf

P3240FreeContiBuf

P3240SetContiData

P3240StartContiDrive

P3240GetCurContiNum

P3240MotEnableEvent

Error Message


P3240GetCompareState

Function description:

Get the RR3 value of specified axis. If interrupt is handled by driver, the RR3 register will be cleared, then this function will not get the interrupt status. We do not recommend using this function to get interrupt status, instead we advise user to use P3240MotCheckEvent.

Syntax

LRESULT P3240GetCompareState(
BYTE | byBoard_ID | //Board ID number
BYTE | byGetAxis | //assign the axis
USHORT * | lpValue | //The value of bit0-7 of RR3

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

bySetAxis

[IN] assign the axis

value :

Bit 0 -> X axis,

Bit 1 -> Y axis ,

Bit 2 -> Z axis ,

Bit 3 -> U axis

Bit 4~7 reserved, must be 0

bit value: 0 for non operation, 1 for operation

USHORT *lpValue

[OUT] get The value of bit0-7 of RR3

value :

The value of bit0-7 of RR3, bit value 0: no interrupt, 1: interrupt occurs

bit 0 : Reserve for system

bit 1 : P >= C-, when P counter >= Comp- counter

bit 2 : P <C-, when P counter <Comp- counter

bit 3 : P <C+, when P counter <Comp+ counter

bit 4 : P >= C+, when P counter >= Comp+ counter

bit 5 : C-END, when end of constant drive

bit 6 : C-STA, when start of constant drive

bit 7 : D-END, when end of drive

Return Values

BoardNumErr

The board number is error

AxisNumErr

The axis number is error

ERROR_SUCCESS

Function success


P3240MotDevOpen

P3240MotHome

Function description:

Search home for specified axis.

Syntax

LRESULT P3240MotDevOpen(
BYTE | byBoard_ID | //Board ID number
byHomeAxis | //get the axis

);

Parameters

byBoard_ID

[OUT] Specified board ID number

value :

0 to 15, other values are invalid

byHomeAxis

[OUT] Get One HEX number.

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

Return Values

BoardNumErr

The board number is error

OpenEventFail

System resource initial fail

CreateKernelDriverFail

System resource initial fail

ERROR_SUCCESS

Function success


P3240MotDevOpen

P3240MoveArcContinuous

Function description:

Continue move arc.

Syntax

LRESULT P3240MoveArcContinuous(
BYTE | byBoard_ID | //Board ID number
BYTE | byMoveAxis | //One HEX number
BYTE | byAxisDirection | //0-> CW direction 1-> CCW direction
LONG | lCenter1 | //The circle center for the first axis
LONG | lCenter2 | //The circle center for the second axis
LONG lEnd1

//The Arc end point for the first axis

LONG | lEnd2 | //The Arc end point for the second axis

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byMoveAxis

[IN] One HEX number

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

byAxisDirection

[IN] direction

value :

0-> CW direction 1-> CCW direction

LONG lCenter1

[IN] The circle center for the first axis

value :

The circle center for the first axis

LONG lCenter2

[IN] T The circle center for the second axis

value :

The circle center for the second axis

LONG lEnd1

[IN] The Arc end point for the first axis

value :

The Arc end point for the first axis

LONG lEnd2

[IN] T The Arc end point for the second axis

value :

TThe Arc end point for the second axis

Return Values

BoardNumErr

The board number is error

OpenEventFail

System resource initial fail

CreateKernelDriverFail

System resource initial fail

ERROR_SUCCESS

Function success

Remark

If need slow down, please call P3240SetDeceleration function first.


P3240MotDevOpen

P3240MoveLineContinuous

Function description:

Continue move line.

Syntax

LRESULT P3240MoveLineContinuous(
BYTE | byBoard_ID | //Board ID number
BYTE | byMoveAxis | //One HEX number
LONG | lPosition1 | //The first axis move position.
LONG | lPosition2 | //The second axis move position.
LONG | lPosition3 | //The third axis move position.

);

Parameters

byBoard_ID

[IN] Specified board ID number

value :

0 to 15, other values are invalid

byMoveAxis

[IN] One HEX number

value :

Bit 0 -> X axis

Bit 1 -> Y axis

Bit 2 -> Z axis

Bit 3 -> U axis

LONG lPosition1

[IN] position

value :

The first axis move position.

LONG lPosition2

[IN] position

value :

The second axis move position.

LONG lPosition3

[IN] The circle center for the first axis in relation mode

value :

The third axis move position.

Return Values

BoardNumErr

The board number is error

OpenEventFail

System resource initial fail

CreateKernelDriverFail

System resource initial fail

ERROR_SUCCESS

Function success


P3240MotArcTheta

Function description: Move from current position to new position via arc interpolation.

Syntax

LRESULT P3240MotArcTheta(
 | BYTE | byBoardID | // Board ID number
 | BYTE | byMoveAxis | // Assign the operation axis, bit assignment
 | BYTE | byRA | // Assign movement operation is relative or absolute coordinate, bit assignment
 | BYTE | byMoveDirection | // Assign the movement direction
 | LONG | lCenter1 | // Center position for first axis
 | LONG | lCenter2 | // Center position for second axis
 | Double | dMoveDeg | // Degree for moving
);

Parameter

byBoardID

[IN] Assign board ID number

value :

0 to 15, other values are not accepted

byMoveAxis

[IN] Assign the operating axis by bit, any two and only two axes must be enabled at the same time.

bit value :

0 for non operation, 1 for operation (any two axis must be enabled at the same time)

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved must be 0

byRA

[IN] Assign the coordinate to relative or absolute system

value :

0 for relative, 1 for absolute

byMoveDirection

[IN] Assign the drive direction

value :

0 for CW, 1 for CCW

lCenter1,2

[IN] The center position for Arc

value :

Relative coordinate:

-8388608 to 8388608, other values are not accepted

Absolute coordinate:

-2147483648 to 2147483648, other values are not accepted and the maximum distance from current position is 268435455 pulses.

dMoveDeg

[IN] The degree of movement

value :

-360 ~ +360

Return Values

AxisNumErr | The operating axis assignment error
AxisDrvBusy | The operating axis is busy
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
OverPLmtErr | The center or end position over positive maximum range
OverNLmtErr | The center or end position over negative maximum range
MaxMoveDistErr | The moving distance over maximum moving distance
ERROR_SUCCESS | Function success

Remark

If need slow down, please call P3240SetDeceleration function first.


P3240MotLine

Function description: Force the assigned axis from current position to new position by line Interpolation

Syntax

LRESULT P3240MotLine(
 | BYTE | byBoard_ID | //Board ID number
 | BYTE | Axis | //Assign operation axis, bit assignment
 | BYTE | RA | //Assign movement operation is relative or absolute coordinate, bit assignment
 | LONG | PosX | //The new position for X axis
 | LONG | PosY | //The new position for Y axis
 | LONG | PosZ | //The new position for Z axis
 | LONG | PosU | //The new position for U axis
);

Parameter

byBoard_ID

[IN] Assign board ID number

value :

0 to 15, other values are invalid

Axis

[IN] Assign the operating axis by bit

bit value :

0 for non operation, 1 for operation

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved must be 0

RA

[IN] Assign the coordinate is relative or absolute system by bit

bit value :

0 for relative, 1 for absolute, at least one axis must be enabled and no more than 3 axes can be enabled at the same time

bit 0 : X axis

bit 1 : Y axis

bit 2 : Z axis

bit 3 : U axis

bit 4 ~ 7 : reserved must be 0

PosX,Y,Z,U

[IN] The new position for X, Y, Z and U axes

value :

Relative coordinate :

-8388608 to 8388608 , other values are invalid

Absolute coordinate :

-2147483648 to 2147483648, the other values are invalid and the maximum movement distance can't over 268435455 pulses.

Return Values

AxisNumErr | The operating axis assignment error
xisDrvBusy | The operating axis busy
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
OverPLmtErr | The center or end position over positive maximum range
OverNLmtErr | The center or end position over negative maximum range
MaxMoveDistErr | The moving distance over maximum movement distance
ERROR_SUCCESS | Function success

Remark

(1)The speed parameter is set by P3240MotAxisParaSet


P3240MotPtp

Function description: Force the assigned axis from current position to new position, for each axis will move by their own speed parameters

Syntax

LRESULT P3240MotPtp(
 | BYTE | byBoard_ID | // Board ID number
 | BYTE | Axis | // Assign operation axis, bit assignment
 | BYTE | RA | // Assign movement operation is relative or absolute coordinate, bit assignment
 | LONG | PulseX | // The movement pulses number for X axis
 | LONG | PulseY | // The movement pulses number for Y axis
 | LONG | PulseZ | // The movement pulses number for Z axis
 | LONG | PulseU | // The movement pulses number for U axis
);

Parameter

byBoard_ID |  |  | [IN] Assign board ID number
 | value : |  | 0 to 15, other values are invalid
Axis |  |  | [IN] Assign the operating axis by bit, muti. axes can be enable at the same time.
 | bit value : |  | 0 for disable, 1 for enable.
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
RA |  |  | [IN] Assign the coordinate is relative or absolute system by bit
 | bit value : |  | 0 for relative, 1 for absolute
 |  | bit 0 : X axis
 |  | bit 1 : Y axis
 |  | bit 2 : Z axis
 |  | bit 3 : U axis
 |  | bit 4 ~ 7 : reserved must be 0
PulseX,Y,Z,U |  |  | [IN] The movement pulses number for X, Y, Z and U axes
 | value : |  | Relative coordinate : | -268435455 to 268435455, other values are invalid
 |  |  | Absolute coordinate : | -2147483648 ~ 2147483647, other values are invalid and the maximum movement distance can't over 268435455 pulses

Return Values

AxisNumErr | The operating axis assignment error
AxisDrvBusy | The operating axis is in busy mode
AxisHomeBusy | The operating axis is operating home function
AxisExtBusy | The operating axis is in external operating mode (Jog or Handwheel)
OverPLmtErr | The center or end position over positive maximum range
OverNLmtErr | The center or end position over negative maximum range
MaxMoveDistErr | The movement distance over maximum moving distance
ERROR_SUCCESS | Function success

Remark

(1)The speed parameter is set by P3240MotAxisParaSet


This window show the current operation board number and available PCM

Parameter Setting :

This window lets the user to set the parameters value for the PCM-3240 hardware. There are five parameter groups can be selected and modified for user's application. Each time can show one axis parameters only.

Users can use the axis to modify X,Y,Z,U option to select which axis to load from the PCM-3240 HW and update the parameter settings or value to screen ( when pushing "Load" button, the utility will load all five groups ( Group 1,2,3,4 and Home parameters )

After the parameters have been modified, users can use check box to select which axis would be changed too, then select the "Save" button to save the new parameters setting for the P3240. ( when pushing "Save" button, the utility will save the current active parameter group only, and not all parameter groups )

In the parameter setting window, there are Group1, Group 2, Group 3, Group 4 and Home parameter group for different parameter setting , users can select different group to modify the parameters.

Group 1 parameters :

nP+P/N nP-P/N Pulse Output Mode: Set the pulse output mode, CW/CCW two pulses mode or Pulse/Dir one pulse mode, it depend on what input mode of driver can support.

nP+P/N nP-P/N Pulse Output Level: Set the pulse output level

nP-P/N Direction Output Level: Set the output level when operate in Pulse/Direction output mode

Acceleration Mode: Set the acceleration mode (The PCM-3240 supports T and S acceleration curve)

Drive Speed Parameter Range Reference: This is the driving speed parameter range reference for the PCM-3240, because the PCM-3240 supports a very wide speed range for different application, so users can select the appropriate speed range for user's application.

Drive Speed Parameter Setting: Set the driving parameter for the PCM-3240 pulse output

Group 2 parameters:

LMT+/LMT-H/W Limited Switch Operation Mode: Set pulse output stopping mode when external H/W limited switch is triggered.

LMT+ Input Active Level: Set the LMT+ limited switch input trigger level

LMT- Input Active Level: Set the LMT- limited switch input trigger level

Motor Alarm and In Position Input Setting: Enable or disable the "Alarm" and "In position" input signal (In general these two signals come from the motor driver)

Motor Alarm Input Level Setting: Set the "Alarm" input trigger level

Motor In Position Input Level Setting : Set the "In Position" input trigger level

Group 3 parameters :

The P3240 supports four digital inputs and four digital output channels for general purpose applications. The four digital input channels can be also set as limited switch to stop pulse output when the input is triggered. The four digital outputs can be also set as driving status indicators during pulses out in acceleration, constant.. period.

In the PCM-3240 DLL drive IN0 is set as the encoder index input and IN3 is set as Home input, when users use the PCM-3240 DLL driver to develop user's program. Users must connect the encoder output to IN0 and Home output to IN3.

IN0 ~ IN3 Limited Switch Function Disable/Enable: Enable or Disable IN0 ~ IN3 limited switch function

IN0 Active Level: Set the IN0 active level.

IN1 Active Level: Set the IN1 active level

IN2 Active Level: Set the IN2 active level

IN3 Active Level: Set the IN3 active level

OUT4 ~ 7 operation Mode: Set OUT 4 ~ 7 as a general purpose output or driving status indicator

Group 4 parameters :

Enable/Disable S/W Limited Switch Function: Enable or Disable the PCM-3240 COMP+/- register as a SW limited switch function. The value of SW limit is set in Input Status dialog.

COMP+/- Register Comparing Mode: Set which counter compare with Compare register

Encoder Input Mode: Set the Encoder input mode

Enable/Disable Interrupt: Enable or Disable the PCM-3240 interrupt function

Home parameters :

Offset between HW and Logical Home: Set the distance between HW home and Logical Home positions. When HOME function is active, it will search for HW home first then move to the logical home, If this moving object's logic home position is 0, this means the HW Home and the Logical Home are in the same position.

CW End: Set the CW limited position for the PCM-3240 DLL driver reference, use P3240MotWrReg through port PLmt to set.

CCW End: Set the CCW limited position for the PCM-3240 DLL driver reference, use P3240MotWrReg through port NLmt to set.

About the CW End and CCW End, before the P3240MotPtp and other motion function send out moving command to the hardware, the driver will check whether the moving distance is out of range, if the pulse number is too large that out of the range then no moving command will send out. These two parameter is used to set the positive and negative limit for the driver.

Reference P3240MotHome to get more detail information.