101
TPM PCE-M134 Programming Manual 1 PCE-M134 Series PCE-M134 PCE-M134-LD Programming Manual Version: V1.4 2017Jul18 To properly use the product, read this manual thoroughly is necessary. Part No.: 81-05123GH10-010

PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

1

PCE-M134 Series

PCE-M134 PCE-M134-LD

Programming Manual

Version: V1.4 2017Jul18

To properly use the product, read this manual thoroughly is necessary. Part No.: 81-05123GH10-010

Page 2: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

2

Revision History Date Revision Description

2015/08/19 1.0 Document Creation 2015/10/05 1.1 Add linear interpolation API description. 2016/08/30 1.2 Add PCE-M134-LD API description. 2016/05/01 1.3 Add Homing mode API description. 2016/07/18 1.4 Add Encoder input type and move ratio

Page 3: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

3

© Copyright 2014 TPM The product, including the product itself, the accessories, the software, the manual and the software description in it, without the permission of TPM Inc. (“TPM”), is not allowed to be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form or by any means, except the documentation kept by the purchaser for backup purposes. The names of products and corporations appearing in this manual may or may not be registered trademarks, and may or may not have copyrights of their respective companies. These names should be used only for identification or explanation, and to the owners’ benefit, should not be infringed without any intention. The product’s name and version number are both printed on the product itself. Released manual visions for each product design are represented by the digit before and after the period of the manual vision number. Manual updates are represented by the third digit in the manual vision number. Trademark MS-DOS and Windows 95/98/NT/2000/XP/CE, Visual Studio, Visual C++, Visual BASIC are

registered trademarks of Microsoft. BCB (Borland C++ Builder) is registered trademark of Borland. MULTIPROG is registered trademark of KW software. Other product names mentioned herein are used for identification purposes only and may be trademarks

and/or registered trademarks of their respective companies.

Page 4: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

4

Electrical safely To prevent electrical shock hazard, disconnect the power cable from the electrical outlet before

relocating the system. When adding or removing devices to or from the system, ensure that the power cables for the devices

are unplugged before the signal cables are connected. Disconnect all power cables from the existing system before you add a device.

Before connecting or removing signal cables from motherboard, ensure that all power cables are unplugged.

Seek professional assistance before using an adapter or extension card. These devices could interrupt the grounding circuit.

Make sure that your power supply is set to the voltage available in your area. If the power supply is broken, contact a qualified service technician or your retailer. Operational safely Please carefully read all the manuals that came with the package, before installing the new device. Before use ensure all cables are correctly connected and the power cables are not damaged. If you

detect and damage, contact the dealer immediately. To avoid short circuits, keep paper clips, screws, and staples away from connectors, slots, sockets and

circuitry. Avoid dust, humidity, and temperature extremes. Do not place the product in any area where it may

become wet. If you encounter technical problems with the product, contact a qualified service technician or the

dealer.

Page 5: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

5

Contents CONTENTS .................................................................................................................................................................................. 5

1. OPERATIONAL PRINCIPLE ........................................................................................................................................................ 8

1.1. SYSTEM INITIALIZATION .................................................................................................................................................................. 8 1.2. AUTOMATIC MOTION CONTROL ...................................................................................................................................................... 9

1.2.1. Velocity Mode Motion ........................................................................................................................................... 9 1.2.2. Point-to-Point (PTP) Mode Motion ..................................................................................................................... 10 1.2.3. Linear Interpolation Mode Motion ...................................................................................................................... 11 1.2.4. Velocity Change On-The-Fly ............................................................................................................................... 12

1.3. MISCELLANEOUS FUNCTIONS ........................................................................................................................................................ 13 1.3.1. Machine I/O ......................................................................................................................................................... 13 1.3.2. Driver I/O Signals ................................................................................................................................................ 14 1.3.3. Counters ............................................................................................................................................................... 16

1.4. ADVANCED FUNCTIONS ............................................................................................................................................................... 18 1.4.1. Auto-Compared Trigger Output Operation .......................................................................................................... 18

2. SOFTWARE PROCEDURE ....................................................................................................................................................... 19

2.1. MOTION SYSTEM INITIATION......................................................................................................................................................... 19 2.1.1. Hardware Dependent Setting ............................................................................................................................... 20 2.1.2. Input Pulse Setting ............................................................................................................................................... 21 2.1.3. Single Axis Operation .......................................................................................................................................... 22 2.1.4. Linear Interpolation Operation ............................................................................................................................. 23

3. HARDWARE INITIALIZATION.................................................................................................................................................. 24

3.1. _M134_OPEN ........................................................................................................................................................................... 25 3.2. _M134_CLOSE .......................................................................................................................................................................... 26 3.3. _M134_GET_SWITCH_CARD_NUM ............................................................................................................................................... 27 3.4. _M134_CHECK_SWITCH_CARD_NUM ........................................................................................................................................... 28 3.5. _M134_GET_CARD_TYPE ........................................................................................................................................................... 29 3.6. _M134_GET_CPLD_VERSION ....................................................................................................................................................... 30 3.7. _M134_INITIAL ......................................................................................................................................................................... 31 3.8. _M134_CONFIG_FROM_FILE ....................................................................................................................................................... 32

4. INTERFACE I/O CONFIGURATION .......................................................................................................................................... 33

4.1. _M134_SET_ALM ...................................................................................................................................................................... 34 4.2. _M134_SET_ERC_ON ................................................................................................................................................................ 35 4.3. _M134_SET_SERVO ................................................................................................................................................................... 36 4.4. _M134_SET_RALM .................................................................................................................................................................... 37 4.5. _M134_SET_ELL ....................................................................................................................................................................... 38 4.6. _M134_SET_SD ........................................................................................................................................................................ 39

5. PULSE I/O CONFIGURATION .................................................................................................................................................. 40

Page 6: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

6

5.1. _M134_SET_PLS_OUTMODE ....................................................................................................................................................... 41 5.2. _M134_SET_PLS_IPTMODE ......................................................................................................................................................... 42 5.3. _M134_SET_FEEDBACK_SRC ....................................................................................................................................................... 43 5.4. _M134_SET_ABS_REFERENCE ...................................................................................................................................................... 44

6. AXIS STATUS FUNCTIONS ...................................................................................................................................................... 45

6.1. _M134_MOTION_DONE ............................................................................................................................................................. 46 6.2. _M134_GET_IO_STATUS ............................................................................................................................................................. 47

7. STOP MOTION FUNCTIONS ................................................................................................................................................... 48

7.1. _M134_SD_STOP ...................................................................................................................................................................... 49 7.2. _M134_IMD_STOP .................................................................................................................................................................... 50 7.3. _M134_EMG_STOP ................................................................................................................................................................... 51

8. HOMING ............................................................................................................................................................................... 52

8.1. _M134_SET_HOME_MODE ......................................................................................................................................................... 53 8.2. _M134_HOME_MOVE ................................................................................................................................................................ 56

9. SINGLE AXIS MOTION ........................................................................................................................................................... 57

9.1. _M134_START_TR_MOVE ........................................................................................................................................................... 58 9.2. _M134_START_TA_MOVE ........................................................................................................................................................... 59 9.3. _M134_START_SR_MOVE ........................................................................................................................................................... 60 9.4. _M134_START_SA_MOVE ........................................................................................................................................................... 61

10. VELOCITY MODE MOTION ................................................................................................................................................... 62

10.1. _M134_TV_MOVE ................................................................................................................................................................... 63 10.2. _M134_SV_MOVE ................................................................................................................................................................... 64 10.3. _M134_V_CHANGE ................................................................................................................................................................. 65 10.4. _M134_FIX_SPEED_RANGE ....................................................................................................................................................... 66 10.5. _M134_UNFIX_SPEED_RANGE ................................................................................................................................................... 67 10.6. _M134_GET_CURRENT_SPEED .................................................................................................................................................. 68

11. COUNTER CONTROL FUNCTIONS ........................................................................................................................................ 69

11.1. _M134_GET_POSITION ............................................................................................................................................................ 70 11.2. _M134_SET_POSITION ............................................................................................................................................................. 71 11.3. _M134_GET_COMMAND .......................................................................................................................................................... 72 11.4. _M134_SET_COMMAND .......................................................................................................................................................... 73 11.5. _M134_SET_MOVE_RATIO ........................................................................................................................................................ 74

12. AXIS LINEAR MOTION ......................................................................................................................................................... 75

12.1. _M134_START_TR_LINE2C ....................................................................................................................................................... 76 12.2. _M134_START_TA_LINE2C ....................................................................................................................................................... 77 12.3. _M134_START_TR_LINE3C ....................................................................................................................................................... 78 12.4. _M134_START_TA_LINE3C ....................................................................................................................................................... 79

Page 7: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

7

12.5. _M134_START_TR_LINE4C ....................................................................................................................................................... 80 12.6. _M134_START_TA_LINE4C ....................................................................................................................................................... 81

13. AUTO COMPARE PROGRAMMING ...................................................................................................................................... 82

13.1. _M134_GET_AUTO_COMPARE_ENCODER .................................................................................................................................... 83 13.2. _M134_SET_AUTO_COMPARE_ENCODER..................................................................................................................................... 84 13.3. _M134_SET_AUTO_COMPARE_SOURCE ....................................................................................................................................... 85 13.4. _M134_GET_AUTO_COMPARE_COUNT ....................................................................................................................................... 86 13.5. _M134_GET_AUTO_COMPARE_STATUS ....................................................................................................................................... 87 13.6. _M134_SET_AUTO_COMPARE_FUNCTION ................................................................................................................................... 88 13.7. _M134_SET_AUTO_COMPARE_TRIGGER ...................................................................................................................................... 89 13.8. _M134_SET_AUTO_COMPARE_TABLE ......................................................................................................................................... 90 13.9. _M134_START_AUTO_COMPARE ................................................................................................................................................ 91 13.10. _M134_FORCE_TRIGGER_OUTPUT ........................................................................................................................................... 92

14. GPIO ACCESS ....................................................................................................................................................................... 93

14.1. _M134_GET_DIGITAL_INPUT ..................................................................................................................................................... 94 14.2. _M134_GET_DIGITAL_OUTPUT .................................................................................................................................................. 95 14.3. _M134_SET_DIGITAL_OUTPUT ................................................................................................................................................... 96 14.4. _M134_GET_DIGITAL_INPUT_BIT ............................................................................................................................................... 97 14.5. _M134_GET_DIGITAL_OUTPUT_BIT ............................................................................................................................................ 98 14.6. _M134_SET_DIGITAL_OUTPUT_BIT............................................................................................................................................. 99 14.7. _M134_TOGGLE_DIGITAL_OUTPUT_BIT ..................................................................................................................................... 100

15. APPENDIX A – ERROR CODES ............................................................................................................................................ 101

Page 8: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

8

1. Operational Principle PCX-M134 series is a motion control equipped with a 4-axis motion ASIC and a Motionnet master ASIC. Most real-time tasks are completed by the ASIC hardware together with user-friendly software under Windows operating system. This chapter describes the operational principle of the PCX-M134.

1.1. System Initialization

PCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization, Windows will allocate appropriate system resources for it, for example, IRQ and base memory address. Each individual card must be initialized respectively before its operation. The following message in Windows registry indicates that this hardware initialization is completed successfully.

Figure 1-1: PCE-M134 Shown in Device Manager

The PCX-M134 would be fully functioned after the hardware initialization call, _m134_open().

Card Index = 0 SwitchCardNo = 2

Card Index = 1 SwitchCardNo = 4

_m134_openExistCard = 3

Card Index = 2SwitchCardNo = 6

Figure 1-2: S-curve velocity mode motion

Relative functions: _m134_open, _m134_close

Page 9: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

9

1.2. Automatic Motion Control

6 main types of automatic motion control are supported as listed in the following. a. Velocity mode motion: 1 ~ 4 axes. b. Point-to-Point movement: 1 axis above, non-synchronized. c. Linear interpolation: 2~ 4 axes, synchronized.

They are described in the following sections respectively

1.2.1. Velocity Mode Motion

For velocity motion, after assigning the desired axis, start velocity, max velocity and acceleration time. The pulse command will be generated accordingly as shown in the following figure. User has to issue a stop command, “decelerate to stop” or “stop immediately” to stop the motion of this axis. S-curve velocity is displayed in the following figure.

Figure 1-3: S-curve velocity mode motion

Relative functions: _m134_tv_move, _m134_sv_move, _m134_v_change, _m134_sd_stop, _m134_emg_stop, _m134_fix_speed_range, _m134_unfix_speed_range, _m134_get_current_speed

Tacc(sec) Tdec(sec)

StrVel

MaxVel

Time

Velocity (pps)

Svac

Svac Svde

Svde

Page 10: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

10

1.2.2. Point-to-Point (PTP) Mode Motion

The PTP motion could be either single axis or multiple axes. For single axis PTP motion, PCE-M134 supports either T-curve or S-curve velocity profile under relative or absolute coordinates.

Figure 1-4: Point-to-Point mode motion

To move from P0 to P1 by single axis Point-to-Point movement, please select T-curve or S-curve under Relative or Absolute coordinate. The following arguments must be specified. Distance, Start Velocity, Max Velocity, Acc. Time Relative functions: _m134_start_tr_move, _m134_start_ta_move, _m134_start_sr_move, _m134_start_sa_move

P0 P1

Page 11: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

11

1.2.3. Linear Interpolation Mode Motion

PCE-M134 supports 2 ~ 4 axes linear interpolation with T-curve velocity profile under relative or absolute coordinates. 2-axis linear interpolation is explained in the following figure. This is a line in the 2-D coordinate. Motion starts from P0 and ends at P1. The speed ratio along X axis and Y axis is (dX:dY) respectively and the vector speed is as follows.

Figure 1-5: the speed ratio and the vector speed

When calling this 2-axis linear interpolation movement, the application interface arguments – start speed (StrVel) and maximum speed (MaxVel) actually defines the start and maximum vector speed respectively. Relative functions: _m134_start_tr_line2C, _m134_start_ta_line2C 3-D Interpolation _m134_start_tr_line3C, _m134_start_ta_line3C 4-axis Interpolation _m134_start_ta_line4C, _m134_start_ta_line4C

X

P0(X0,Y0)

P1(X1,Y1)

dX

dY

Y

Page 12: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

12

1.2.4. Velocity Change On-The-Fly

Velocity change on-the-fly

Figure 1-6: velocity change on-the-fly

Relative functions: _m134_sv_change, _m134_tv_change, _m134_fix_speed_range, _m134_unfix_speed_range, _m134_get_current_speed, _m134_verify_speed

Velocity (pps)

StrVel

Tacc

MaxVel

Time (second)Time

NewVel

Page 13: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

13

1.3. Miscellaneous Functions

1.3.1. Machine I/O

As shown in the following figure, controller is in the gray part and the driver is in the blue part, the direction of arrow with different color represents In and Out respectively. You can find the signals that connecting with its source and destination according to the remarks. CMP and SLD signals are in the gray part with dotted line . PEL, MEL and ORG are input signals that will be connected to sensors and the encoder feedback signal is coming from the encoder on the rear end of the motor. You can find detailed descriptions in the following chapters.

Figure 1-7: machine I/O

Page 14: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

14

EL (End Limit) – PEL / MEL The EL signal is an input signal connected usually as normal-close type to limit switch on the mechanism. The command pulse output will be stopped when the EL signal is active. It is to stop the command pulse output by hardware. PEL signal indicates the EL in the “Plus” direction of motion. MEL signal indicates the EL in the “Minus” direction of motion. While the output command pulse is toward plus direction, the pulse output will be stopped when PEL is active. But the pulse command toward minus direction is still active. IRQ can be generated when the EL signal is active according the interrupt setting in the beginning. SD (Slow Down) The SD signal is an input signal. The output command pulse will be changed when the SD signal is active. While the SD signal is active the velocity will be decelerated automatically to the start velocity, i.e. StrVel setting in the motion command. The StrVel value must be less than the maximum velocity, i.e. MaxVel. Usually the SD signal is designed to protect over-speed motion when incorrect command is issued. CMP CPM is usually used to compare the target position with feedback position. Please refer to the following figure for its application.

Figure 1-8: CMP application

1.3.2. Driver I/O Signals

ALM The ALM signal is an input signal. Its signal source is from the output of the servo driver. The processing of the ALM signal is a hardware built-in function. When the ALM signal is active, the command output pulse will be stopped immediately. The interrupt will be generated if the INT setting set in the beginning. The _m134_set_alm function is used to set the ALM mode and logic. INP INP signal is to be used together with position mode servo driver. It is an input signal from servo driver to

Comparator

Trigger Circuit

P2 P1 Data Interrupt to Host PC

T2 T1

Encoder Feedback

Encoder Motor

Object

Page 15: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

15

PCE-M134. There is an output signal in position mode servo driver. This signal will be output by hardware when the value of following error counter is equal or smaller than the pre-set INP range parameter inside the servo driver motor. ERC ERC signal is to be used together with position mode servo driver / motor. It is an output signal from PCE-M134 to servo driver / motor. The processing of ERC inside servo driver is also hardware built-in. The servo driver will clear the following error counter immediately when the ERC is active. It means that the motor will be stopped and hold at the position when the ERC signal is on.

Figure 1-9: INP / ERC signal

Xp

B.C

Xp Err Kp M

PG

Velocity CurrentRatio

Encoder

A

B

Z

INP Settling Time

Following ErrorIn-Position Range

ON

OFF

ERC

Page 16: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

16

1.3.3. Counters

Command Position Counter The command position counter is a 24-bit up/down counter. Its input source is from the command output pulse. The command position counter value will increase or decrease according the pulse output. The command position counter will be cleared to “0” when automatic homing operation is completed. The command position counter can be set by _m134_set_command and read by _m134_get_command function. Feedback Position Counter The feedback position counter is a 32-bit up/down counter. Its input source is from the external encoder feedback from EA + and EB+ pins. 2 Types of encoder feedback signal is supported. For A/B Phase mode signal the only factor x4 can be selected.

Page 17: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

17

Figure 1-10: feedback position counter

Axis Encoder Counter The axis encoder counter is a 32-bit up/down counter. It is used as the source counter of auto-compared trigger ouput function. Relative functions: _m134_get_position, _m134_set_position, _m134_get_command, _m134_set_command,

MUX

FB Counter

Command

FeedBack

Page 18: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

18

1.4. Advanced Functions

Advanced functions are listed below. Auto-compared trigger output operation These newly added functions are introduced in the following subsections.

1.4.1. Auto-Compared Trigger Output Operation

Auto-Compared trigger output is usually used to compare fixed interval position with feedback position. This function can be used to trigger the high speed linescan camera. The maximum triggering frequency is 100KHz. This function is designed by the hardware circuit so it will not waste the CPU time when high speed trigger pulses are outputted.

Figure 1-11: auto-compare trigger output application

Relative functions: _m134_set_auto_compare_source, _m134_set_auto_compare_trigger, _m134_start_auto_compare, _m134_set_auto_compare_table, _m134_set_auto_compare_function, _m134_force_trigger_output, _m134_get_auto_compare_count

Page 19: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

19

2. Software Procedure

2.1. Motion System Initiation

Application Start

Hardware Dependent Setting

Output Pulse Setting

_m134_set_pls_outmode(SwitchCardNo, AxisNo, pls_outmode)

Input Pulse Setting

Clear Driver Deviation Counter

_m134_set_erc_on(SwitchCardNo, AxisNo, on_off)NOTE: ERC should output before Servo ON

Driver Servo On

_m134_set_servo(SwitchCardNo, AxisNo, on_off)

Start Motion Control

Figure 2-1: Hardware Dependent Setting

Page 20: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

20

2.1.1. Hardware Dependent Setting

Start Hardware Dependent Setting

End Hardware Dependent Setting

Initialize Card

_m134_open(existcards)_m134_initial(SwitchCardNo)

Set Correct EL Logic & Mode

_m134_set_ell(SwitchCardNo, AxisNo, ell_logic, ell_mode)

Set Correct Alarm Input Logic

_m134_set_alm(SwitchCardNo, AxisNo, alm_logic, alm_mode)

Set SD Active Logic

_m134_set_sd(SwitchCardNo, AxisNo, enable, sd_logic, sd_latch, sd_mode)

Correct Alarm Logic &Correct EL Logic &

Correct SD Logic

YES

NO

HardwareDependent

Figure 2-2: Hardware Dependent Setting

Page 21: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

21

2.1.2. Input Pulse Setting

Start Input Pulse Setting

Cotinuous Mode Motion Setting

Set Pulse Input Mode

_m134_set_pls_iptmode(SwitchCardNo, AxisNo, pls_iptmode, pls_logic)

Set Command As Feedback Source

Absolute Moving Functions follow Command counter_m134_set_feedback_src(SwitchCardNo, AxisNo, 1)_m134_set_abs_reference(SwitchCardNo, AxisNo, 1)

Start Motion Control

Encoder Feedback?

Absolute Moving Functions

Type ?

Cotinuous Mode Motion?

Set Encoder As Feedback Source

Absolute Moving Functions follow command counter_m134_set_feedback_src(SwitchCardNo, AxisNo, 0)_m134_set_abs_reference(SwitchCardNo, AxisNo, 1)

Set Encoder As Feedback Source

Absolute Moving Functions follow position counter_m134_set_feedback_src(SwitchCardNo, AxisNo, 0)_m134_set_abs_reference(SwitchCardNo, AxisNo, 0)

Follow Position CounterFollow Command Counter

NO

YES

NO

YES

Figure 2-3: Input Pulse Setting

Page 22: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

22

2.1.3. Single Axis Operation

Start Position Mode Motion

VelocityProfile choice

Absolute or Relative Moving ?

Absolute Moving

_m134_start_ta_move(SwitchCardNo, AxisNo, Pos, StrVel, MaxVel, Tacc, Tdec)

Relative Moving

_m134_start_tr_move(SwitchCardNo, AxisNo, Dist, StrVel, MaxVel, Tacc, Tdec)

Absolute or Relative Moving ?

Absolute Moving

_m134_start_sa_move(SwitchCardNo, AxisNo, Pos, StrVel, MaxVel, Tacc, Tdec)

Relative Moving

_m134_start_sr_move(SwitchCardNo, AxisNo, Dist, StrVel, MaxVel, Tacc, Tdec)

S-Curve

Absolute Relative

RelativeAbsolute

T-Curve

STOP ?

Check Motion Status

_m134_motion_done(SwitchCardNo, AxisNo)

MoSt == 0 ?

Stop Command

_m134_sd_stop(SwitchCardNo, AxisNo, Tdec)_m134_emg_stop(SwitchCardNo, AxisNo)

End Position Mode Motion

NO

YES

YES

NO

Figure 2-4: Single Axis Operation

Page 23: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

23

2.1.4. Linear Interpolation Operation

Start linear Interpolation Motion

Absolute or Relative Moving ?

Absolute Moving_m134_start_ta_line2C_m134_start_ta_line3C_m134_start_ta_line4C

Relative Moving_m134_start_tr_line2C_m134_start_tr_line3C_m134_start_tr_line4C

RelativeAbsolute

T-Curve

STOP ?

Check Motion Status

_m134_motion_done(SwitchCardNo, AxisNo)

MoSt == 0 ?

Stop Command

_m134_sd_stop(SwitchCardNo, AxisNo, Tdec)_m134_emg_stop(SwitchCardNo, AxisNo)

End linear Interpolation Motion

NO

YES

YES

NO

Figure 2-5: Linear Interpolation Operation

Page 24: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

24

3. Hardware Initialization Function name Description

_m134_open Allocate hardware resources and get the amount of the master card. _m134_close Release hardware resources _m134_get_switch_card_num Get the card number from the card index _m134_check_switch_card_num Check the existence of the PCE-M134 with a card number. _m134_get_card_type Get the PCE-M134 card type. _m134_get_cpld_version Get the software version of the CPLD. _m134_initial Initialize the resource of PCE-M134 _m134_config_from_file Load the parameters of axis configuration from the ini file

which is generated by the MyLink utility.

Page 25: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

25

3.1. _m134_open

Description Allocate hardware resources and get the amount of the master card. Syntax I16 _m134_open (U16 *existcards) Argument

Name Type Description existcards U16 * Get master card count in your PC

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 26: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

26

3.2. _m134_close

Description Release hardware resources Syntax: I16 _m134_close () Argument N/A Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 27: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

27

3.3. _m134_get_switch_card_num

Description Get the card number from the card index. Syntax I16 _m134_get_switch_card_num(U16 CardIndex, U16 *SwitchCardNo) Argument

Name Type Description CardIndex U16 The number of the card index. SwitchCardNo U16 * The number of the card to be checked with the rotary switch setting.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table. Note. CardIndex is auto-incrementing from 0, and the SwitchCardNo is decision by rotary switch on master card. For example, there are 3 PCE-M134 master cards installed in PC, we can get the SwitchCardNo by API.

Card Index = 0 SwitchCardNo = 2

Card Index = 1 SwitchCardNo = 4

Card Index = 2SwitchCardNo = 6

Page 28: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

28

3.4. _m134_check_switch_card_num

Description Check the existence of the PCE-M134 with a card number. Syntax I16 _m134_check_switch_card_num (U16 SwitchCardNo, U8 *IsExist) Argument

Name Type Description SwitchCardNo U16 The number of the card to be checked with the rotary switch setting. IsExist U8 * Equal to 1 if the card exists, 0 if the card does not exist.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 29: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

29

3.5. _m134_get_card_type

Description Get the PCE-M134 card type. Syntax I16 _m134_get_card_type(U16 SwitchCardNo, U8 *CardType) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

CardType U8 *

Card Type Value Meaning

0 CARD_UNKNOWN 1 CARD_PCE_M134 2 CARD_PCE_M134_LD

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 30: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

30

3.6. _m134_get_cpld_version

Description Get the software version of the CPLD. Syntax I16 _m134_get_cpld_version (U16 SwitchCardNo, U16 *CpldVer) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. CpldVer U16 * Returns the current CPLD version.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 31: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

31

3.7. _m134_initial

Description Check the existence of the PCE-M134 with a card number. Syntax I16 _m134_initial(U16 SwitchCardNo) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 32: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

32

3.8. _m134_config_from_file

Description Load the parameters of axis configuration from the ini file which is generated by the MyLink utility Syntax I16 _m134_config_from_file(U16 SwitchCardNo, char *FilePath) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. FilePath char* File Name And Path For Parameters Of Axis Configuration

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 33: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

33

4. Interface I/O Configuration Function name Description

_m134_set_alm Set alarm logic and operating mode of axis. _m134_set_erc_on Force ERC output by software command. _m134_set_servo Set servo driver to ON / OFF. _m134_set_ralm Set the status of servo alarm reset signal. _m134_set_ell Set EL active mode & logic. _m134_set_sd Set SD logic and operating mode.

Page 34: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

34

4.1. _m134_set_alm

Description Set alarm logic and operating mode of axis. Syntax I16 _m134_set_alm (U16 SwitchCardNo, U16 AxisNo, I16 alm_logic, I16 alm_mode) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

alm_logic I16

Setting of active logic for ALARM signal. Value Meaning

0 Low active 1 High active

alm_mode I16

Reacting modes when receiving ALARM signal. Value Meaning

0 Motor immediately stops (default). 1 Motor decelerates to stop.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 35: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

35

4.2. _m134_set_erc_on

Description Force ERC output by software command. Syntax I16 _m134_set_erc_on (U16 SwitchCardNo, U16 AxisNo, I16 on_off) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

on_off I16

Setting the action of ERC signal. Value Meaning

0 Inactive 1 Active

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 36: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

36

4.3. _m134_set_servo

Description Set the servo driver to ON / OFF. Syntax I16 _m134_set_servo (U16 SwitchCardNo, U16 AxisNo, I16 on_off) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

on_off I16

Setting the action of SVON signal. Value Meaning

0 Inactive 1 Active

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 37: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

37

4.4. _m134_set_ralm

Description Set the status of servo alarm reset signal. Syntax I16 _m134_set_ralm (U16 SwitchCardNo, U16 AxisNo, I16 on_off) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

on_off I16

On-off state of RALM signal. Value Meaning

0 Inactive 1 Active

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 38: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

38

4.5. _m134_set_ell

Description Set EL (End Limit) active mode & logic. Syntax I16 _m134_set_ell (U16 SwitchCardNo, U16 AxisNo, I16 ell_logic, I16 ell_mode) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

ell_logic I16

Action logic configuration for EL signal. Value Meaning

0 Low active 1 High active

ell_mode I16

The reaction when the EL signal is on. Value Meaning

0 Stop immediately 1 Decelerating to stop

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 39: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

39

4.6. _m134_set_sd

Description Set SD logic and operating mode. Syntax I16 _m134_set_sd (U16 SwitchCardNo, U16 AxisNo, I16 enable, I16 sd_logic, I16 sd_latch, I16 sd_mode) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

enable I16

Enable/disable the SD signal. Value Meaning

0 Disabled (default) 1 Enabled

sd_logic I16

Setting of active logic for SD signal. Value Meaning

0 Low active 1 High active

sd_latch I16

Setting of latch control for SD signal to hold velocity. Value Meaning

0 Do not latch 1 Latch

sd_mode I16

Setting the reacting mode of SD signal. Value Meaning

0 Slow down only 1 Slow down then stop

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 40: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

40

5. Pulse I/O Configuration Function name Description

_m134_set_pls_outmode Set pulse command output mode of axis. _m134_set_pls_iptmode Set encoder input mode & direction of axis. _m134_set_feedback_src Set the input source of position counters for axis. _m134_set_abs_reference Set absolute move reference (Command or Encoder) of the axis.

Page 41: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

41

5.1. _m134_set_pls_outmode

Description Set pulse command output mode of axis. Syntax I16 _m134_set_pls_outmode (U16 SwitchCardNo, U16 AxisNo, I16 pls_outmode) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

pls_outmode I16

Setting of command pulse output mode. Value Meaning

0 OUT/DIR: OUT falling edge, DIR+ is high level 1 Reserved 2 Reserved 3 OUT/DIR: OUT rising edge, DIR+ is low level 4 CW/CCW: falling edge 5 CW/CCW: rising edge 6 Reserved 7 Reserved

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 42: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

42

5.2. _m134_set_pls_iptmode

Description Set encoder input mode & direction of axis. Syntax I16 _m134_set_pls_iptmode (U16 SwitchCardNo, U16 AxisNo, I16 pls_iptmode, I16 pls_logic) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

pls_iptmode I16

Setting of encoder feedback pulse input mode. Value Meaning

0 1X A/B 1 2X A/B 2 4X A/B 3 CW/CCW

pls_logic I16

Direction of encoder feedback pulse. Value Meaning

0 Not inverse direction 1 Inverse direction

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 43: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

43

5.3. _m134_set_feedback_src

Description Set the input source of position counters for axis. Syntax I16 _m134_set_feedback_src (U16 SwitchCardNo, U16 AxisNo, I16 Src) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Src I16

Setting of encoder feedback pulse input mode. Value Meaning

0 External Feedback 1 Command Pulse

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 44: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

44

5.4. _m134_set_abs_reference

Description Set absolute move reference (Command or Encoder) of the axis. Syntax I16 _m134_set_abs_reference (U16 SwitchCardNo, U16 AxisNo, I16 Ref) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Ref I16

Setting the action of Ref signal. Value Meaning

0 Absolute command following current Encoder Counter 1 Absolute command following current Command Counter

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Follow by current position or command counter

Follow by target counter

Set Abs move command to Position A

Set Abs move command to Position B Position A Position B

Page 45: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

45

6. Axis Status Functions Function name Description

_m134_motion_done Return the motion status of motion slave. _m134_get_io_status Get the motion I/O status of the axis. _m134_check_error Check the error status which stops the axis motion.

Page 46: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

46

6.1. _m134_motion_done

Description Return the motion status of motion slave. Syntax I16 _m134_motion_done (U16 SwitchCardNo, U16 AxisNo) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Status Return

Function Name Description 0 Stop 1 Reserved 2 Reserved 3 Reserved 4 Reserved 5 Reserved 6 Reserved 7 Reserved 8 Reserved 9 Reserved 10 Reserved 11 In acceleration 12 In Max velocity motion 13 In deceleration 14 Reserved 15 Reserved Other Please reference to the Appendix error table.

Page 47: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

47

6.2. _m134_get_io_status

Description Get the motion I/O status of the axis. Syntax I16 _m134_get_io_status (U16 SwitchCardNo, U16 AxisNo, U16 *io_sts) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

io_sts U16 *

I/O status word. Where “1’ is ON and “0” is OFF. ON/OFF state is read based on the corresponding set logic.

Bit No. Meaning Description

0 RDY RDY pin input 1 ALM Alarm Signal 2 +EL Positive Limit Switch 3 -EL Negative Limit Switch 4 ORG Origin Switch 5 - Reserved 6 EMG Emergency signal input 7 - Reserved 8 ERC ERC pin output 9 - Reserved 10 - Reserved 11 - Reserved 12 SD Slow Down signal input 13 INP In-Position signal input 14 SVON Servo-ON output status 15 RALM Reset Alarm output status

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 48: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

48

7. Stop Motion Functions Function name Description

_m134_sd_stop Set axis from slow down to stop. _m134_imd_stop Stop the motion immediately without changing the motion status. _m134_emg_stop Stop the motion immediately which changes the motion status to

stop and raise the EMG flag.

Page 49: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

49

7.1. _m134_sd_stop

Description Set axis from slow down to stop. Syntax I16 _m134_sd_stop (U16 SwitchCardNo, U16 AxisNo, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 Tdec F32 Specified deceleration time in unit of second.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 50: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

50

7.2. _m134_imd_stop

Description Stop the motion immediately without changing the motion status. Syntax I16 _m134_imd_stop (U16 SwitchCardNo, U16 AxisNo) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 51: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

51

7.3. _m134_emg_stop

Description Stop the motion immediately which changes the motion status to stop and raise the EMG flag. Syntax I16 _m134_emg_stop (U16 SwitchCardNo, U16 AxisNo) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 52: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

52

8. Homing Function name Description

_m134_set_home_mode Stopping modes for home return. _m134_home_move Begin a home return action.

Page 53: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

53

8.1. _m134_set_home_mode

Description Stopping modes for home return. Syntax I16 _m134_set_home_mode(U16 SwitchCardNo, U16 AxisNo, I16 HomeMode) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 HomeMode I16 Stopping modes for home return, 0~2. See Note.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 54: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

54

NOTE In this mode, you can let the 4-axis output pulses until the condition to complete the home return is satisfied after writing the command ‘_m134_home_move’. There are 3 home moving modes provided by 4-axis. The “home_mode” of function _m134_set_home_mode is used to select one’s favorite. After completion of home move, it is necessary to keep in mind that all the position related information should be reset to be “0”. home_mode = 0

ORG Slow Down Stop

ORG

EL

Status1

Status2

Status3

Figure 8-1: home_mode = 0

Page 55: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

55

home_mode = 1

ORG Slow Down Stop at the end of ORG

ORG

EL

Status1

Status2

Status3

Figure 8-2: home_mode = 1

home_mode = 2

EL Slow Down Stop at the end of ORG

EL

Status1

Figure 8-3: home_mode = 2

Page 56: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

56

8.2. _m134_home_move

Description Begin a home return action. Syntax I16 _m134_home_move (U16 SwitchCardNo, U16 AxisNo, U8 Dir, U32 StrVel, U32 MaxVel, F32 Tacc) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Dir U8

Set the start motion direction of the homing sequence. Value Meaning

0 Negative (-) direction 1 Positive (+) direction

StrVel U32 Start velocity. MaxVel U32 Max velocity. Tacc F32 Acceleration time.

Status Return

Function Name ERR_NoError

Other

Page 57: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

57

9. Single Axis Motion Function name Description

_m134_start_tr_move Begin a relative move with trapezoidal profile. _m134_start_ta_move Begin an absolute trapezoidal profile move. _m134_start_sr_move Begin a relative S-curve profile move. _m134_start_sa_move Begin an absolute S-curve profile move.

Page 58: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

58

9.1. _m134_start_tr_move

Description Begin a relative move with trapezoidal profile. See note. Syntax I16 _m134_start_tr_move (U16 SwitchCardNo, U16 AxisNo, I32 Dist, U32 StrVel, U32 MaxVel, F32 Tacc, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 Dist I32 Specified relative distance of axis to move. StrVel U32 Start velocity. MaxVel U32 Max velocity. Tacc F32 Acceleration time in unit of second. Tdec F32 Deceleration time in unit of second.

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Function Name ERR_NoError

Other

Note

Figure 9-1: relative trapezoidal profile

Page 59: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

59

9.2. _m134_start_ta_move

Description Begin an absolute trapezoidal profile move. Syntax I16 _m134_start_ta_move (U16 SwitchCardNo, U16 AxisNo, I32 Pos, U32 StrVel, U32 MaxVel, F32 Tacc, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 Pos I32 Specified absolute position of axis to move. StrVel U32 Start velocity. MaxVel U32 Max velocity. Tacc F32 Acceleration time in unit of second. Tdec F32 Deceleration time in unit of second.

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 60: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

60

9.3. _m134_start_sr_move

Description Begin a relative S-curve profile move. Syntax I16 _m134_start_sr_move (U16 SwitchCardNo, U16 AxisNo, I32 Dist, U32 StrVel, U32 MaxVel, F32 Tacc, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 Dist I32 Specified relative distance of axis to move. StrVel U32 Start velocity. MaxVel U32 Max velocity. Tacc F32 Acceleration time in unit of second. Tdec F32 Deceleration time in unit of second.

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 61: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

61

9.4. _m134_start_sa_move

Description Begin an absolute S-curve profile move. Syntax I16 _m134_start_sa_move (U16 SwitchCardNo, U16 AxisNo, I32 Pos, U32 StrVel, U32 MaxVel, F32 Tacc, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 Pos I32 Specified absolute position of axis to move. StrVel U32 Start velocity. MaxVel U32 Max velocity. Tacc F32 Acceleration time in unit of second. Tdec F32 Deceleration time in unit of second.

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 62: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

62

10. Velocity Mode Motion Function name Description

_m134_tv_move Accelerate an axis to a constant velocity with trapezoidal profile. _m134_sv_move Accelerate an axis to a constant velocity with S-curve profile. _m134_v_change Change the velocity on the fly. _m134_fix_speed_range Fix the speed range. _m134_unfix_speed_range Release the speed range constrain. After finished the velocity change

procedure, you need to use this command to release the speed fixed range.

_m134_get_current_speed Get the current speed.

Page 63: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

63

10.1. _m134_tv_move

Description Accelerate an axis to a constant velocity with trapezoidal profile. See note. Syntax I16 _m134_tv_move (U16 SwitchCardNo, U16 AxisNo, U8 Dir, U32 StrVel, U32 MaxVel, F32 Tacc) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Dir U8

Set the motion direction. Value Meaning

0 Negative (-) direction 1 Positive (+) direction

StrVel U32 Start velocity. MaxVel U32 Max velocity. Tacc F32 Acceleration time.

Status Return

Function Name ERR_NoError

Other

Note

Figure 10-1: constant velocity with trapezoidal profile

Page 64: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

64

10.2. _m134_sv_move

Description Accelerate an axis to a constant velocity with S-curve profile, see note. Syntax I16 _m134_sv_move (U16 SwitchCardNo, U16 AxisNo, U8 Dir, U32 StrVel, U32 MaxVel, F32 Tacc) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Dir U8

Set the motion direction. Value Meaning

0 Negative (-) direction 1 Positive (+) direction

StrVel U32 Start velocity. MaxVel U32 Max velocity. Tacc F32 Acceleration time.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Note

Figure 10-2: constant velocity with S-curve profile

Page 65: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

65

10.3. _m134_v_change

Description Change the velocity on the fly. Syntax I16 _m134_v_change (U16 SwitchCardNo, U16 AxisNo, U32 NewVel, F32 Time) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 NewVel U32 The new velocity. Time F32 Acceleration time.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 66: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

66

10.4. _m134_fix_speed_range

Description Fix the speed range. Syntax I16 _m134_fix_speed_range (U16 SwitchCardNo, U16 AxisNo, U32 MaxVel) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 MaxVel U32 Max velocity.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Note

Figure 10-3: constant velocity with S-curve profile

Page 67: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

67

10.5. _m134_unfix_speed_range

Description Release the speed range constrain. After finished the velocity change procedure, you need to use this command to release the speed fixed range. Syntax I16 _m134_unfix_speed_range (U16 SwitchCardNo, U16 AxisNo) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 68: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

68

10.6. _m134_get_current_speed

Description Get the current speed. Syntax I16 _m134_get_current_speed (U16 SwitchCardNo, U16 AxisNo, U32 *speed) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 speed U32 * Get the current velocity of the axis.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 69: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

69

11. Counter Control Functions Function name Description

_m134_get_position Get the value of position counter. _m134_set_position Reset the value of error counter. _m134_get_command Get the value of command counter. _m134_set_command Set the value of command counter. _m134_set_move_ratio Set the ratio between command and feedback

Page 70: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

70

11.1. _m134_get_position

Description: Get the value of position counter. Syntax: I16 _m134_get_position (U16 SwitchCardNo, U16 AxisNo, I32 *pos) Argument:

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 pos [output] I32 * Position counter value.

Return:

Return value ERR_NoError

Other

Page 71: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

71

11.2. _m134_set_position

Description: Reset the value of error counter. Syntax: I16 _m134_set_position (U16 SwitchCardNo, U16 AxisNo, I32 pos) Argument:

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 pos I32 The value of position counter.

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 72: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

72

11.3. _m134_get_command

Description: Get the value of command counter. Syntax: I16 _m134_get_command (U16 SwitchCardNo, U16 AxisNo, I32 *cmd) Argument:

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 cmd [output] I32 * Command counter value.

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 73: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

73

11.4. _m134_set_command

Description: Set the value of command counter. Syntax: I16 _m134_set_command (U16 SwitchCardNo, U16 AxisNo, I32 cmd) Argument:

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 cmd I32 The value of command counter.

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 74: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

74

11.5. _m134_set_move_ratio

Description: Set the ratio between command and feedback. Syntax: I16 _m134_set_move_ratio (U16 SwitchCardNo, U16 AxisNo, F32 Ratio) Argument:

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 Axis number: 0 ~ 3 Ratio F32 ratio = Command / Feedback.

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 75: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

75

12. Axis Linear Motion Function name

_m134_start_tr_line2C _m134_start_ta_line2C _m134_start_tr_line3C _m134_start_ta_line3C _m134_start_tr_line4C _m134_start_ta_line4C

Page 76: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

76

12.1. _m134_start_tr_line2C

Description Begin a relative 2-Axis linear interpolation with trapezoidal profile. Syntax I16 _m134_start_tr_line2C(U16 SwitchCardNo, U16 *AxisArray, I32 DistX, I32 DistY, U32 StrVel, U32

MaxVel, F32 Tacc, F32 Tdec) Argument

Name SwitchCardNo

AxisArray

DistX DistY StrVel MaxVel Tacc Tdec

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 77: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

77

12.2. _m134_start_ta_line2C

Description Begin an absolute 2-Axis linear interpolation with trapezoidal profile. Syntax I16 _m134_start_ta_line2C(U16 SwitchCardNo, U16 *AxisArray, I32 PosX, I32 PosY, U32 StrVel, U32

MaxVel, F32 Tacc, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

AxisArray U16 *

Array of axis number to perform interpolation. Example: Int AxisArray[2] = {0,2}; // axis 0 & 2 Note: AxisArray[n] must be smaller than AxisArray[m], if n<m.

PosX I32 Specified absolute position of axis array 0 to move PosY I32 Specified absolute position of axis array 1 to move StrVel U32 Starting velocity in unit of pulse per second MaxVel U32 Maximum velocity in unit of pulse per second Tacc F32 Specified acceleration time in unit of second Tdec F32 Specified deceleration time in unit of second

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 78: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

78

12.3. _m134_start_tr_line3C

Description Begin a relative 3-Axis linear interpolation with trapezoidal profile. Syntax I16 _m134_start_tr_line3C(U16 SwitchCardNo, U16 *AxisArray, I32 DistX, I32 DistY, I32 DistZ, U32

StrVel, U32 MaxVel, F32 Tacc, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

AxisArray U16 *

Array of axis number to perform interpolation. Example: Int AxisArray[2] = {0,2}; // axis 0 & 2 Int AxisArray[3] = {0,1,3}; // axis 0,1,3 Note: AxisArray[n] must be smaller than AxisArray[m], if n<m.

DistX I32 Specified relative distance of axis array 0 to move DistY I32 Specified relative distance of axis array 1 to move DistZ I32 Specified relative distance of axis array 2 to move StrVel U32 Starting velocity in unit of pulse per second MaxVel U32 Maximum velocity in unit of pulse per second Tacc F32 Specified acceleration time in unit of second Tdec F32 Specified deceleration time in unit of second

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 79: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

79

12.4. _m134_start_ta_line3C

Description Begin an absolute 3-Axis linear interpolation with trapezoidal profile. Syntax I16 _m134_start_ta_line3C(U16 SwitchCardNo, U16 *AxisArray, I32 PosX, I32 PosY, I32 PosZ, U32

StrVel, U32 MaxVel, F32 Tacc, F32 Tdec) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

AxisArray U16 *

Array of axis number to perform interpolation. Example: Int AxisArray[2] = {0,2}; // axis 0 & 2 Int AxisArray[3] = {0,1,3}; // axis 0,1,3 Note: AxisArray[n] must be smaller than AxisArray[m], if n<m.

PosX I32 Specified absolute position of axis array 0 to move PosY I32 Specified absolute position of axis array 1 to move PosZ I32 Specified absolute position of axis array 2 to move StrVel U32 Starting velocity in unit of pulse per second MaxVel U32 Maximum velocity in unit of pulse per second Tacc F32 Specified acceleration time in unit of second Tdec F32 Specified deceleration time in unit of second

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Status Return

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 80: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

80

12.5. _m134_start_tr_line4C

Description: Begin a relative 4-axis linear interpolation with trapezoidal profile. Syntax: I16 _m134_start_tr_line4C(U16 SwitchCardNo, I32 DistX, I32 DistY, I32 DistZ, I32 DistU, U32 StrVel,

U32 MaxVel, F32 Tacc, F32 Tdec) Argument:

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. DistX I32 Specified relative distance of axis 0 to move DistY I32 Specified relative distance of axis 1 to move DistZ I32 Specified relative distance of axis 2 to move DistU I32 Specified relative distance of axis 3 to move StrVel U32 Starting velocity in unit of pulse per second MaxVel U32 Maximum velocity in unit of pulse per second Tacc F32 Specified acceleration time in unit of second Tdec F32 Specified deceleration time in unit of second

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 81: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

81

12.6. _m134_start_ta_line4C

Description: Begin an absolute 4-axis linear interpolation with trapezoidal profile. Syntax: I16 _m134_start_ta_line4C(U16 SwitchCardNo, I32 PosX, I32 PosY, I32 PosZ, I32 PosU, U32 StrVel,

U32 MaxVel, F32 Tacc, F32 Tdec) Argument:

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. PosX I32 Specified absolute position of axis 0 to move PosY I32 Specified absolute position of axis 1 to move PosZ I32 Specified absolute position of axis 2 to move PosU I32 Specified absolute position of axis 3 to move StrVel U32 Starting velocity in unit of pulse per second MaxVel U32 Maximum velocity in unit of pulse per second Tacc F32 Specified acceleration time in unit of second Tdec F32 Specified deceleration time in unit of second

Note: MaxVel > StrVel is necessary Tdec must be equal to Tacc. Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 82: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

82

13. Auto Compare Programming Function name Description

_m134_get_auto_compare_encoder Get the encoder value stored in the CPLD which is for auto compare triggering.

_m134_set_auto_compare_encoder Set the encoder value in the CPLD which is for auto compare triggering.

_m134_set_auto_compare_source Set the source of the compare trigger _m134_get_auto_compare_count Get the trigger counts since start auto compare triggering. _m134_get_auto_compare_status Get the current status of the auto compare trigger function. _m134_set_auto_compare_trigger Configure the level and triggering duration. _m134_set_auto_compare_function Configure the auto compare trigger profiles with regular

interval. _m134_set_auto_compare_table Configure the auto compare trigger profiles with non-regular

interval, i.e., programmable positions. _m134_start_auto_compare Enable/Disable the compare trigger function. _m134_force_trigger_output Output a triggering signal to the CMP immediately.

Page 83: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

83

13.1. _m134_get_auto_compare_encoder

Description: Get the encoder value stored in the CPLD which is for auto compare triggering. Syntax: I16 _m134_get_auto_compare_encoder (U16 SwitchCardNo, U16 AxisNo, I32 *EncPos) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3 EncPos I32 * The encoder position stored in the CPLD.

Return:

Return value ERR_NoError

Other

Page 84: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

84

13.2. _m134_set_auto_compare_encoder

Description: Set the encoder value in the CPLD which is for auto compare triggering. Syntax: I16 _m134_set_auto_compare_encoder (U16 SwitchCardNo, U16 AxisNo, I32 EncPos) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3 EncPos I32 The encoder position to store in the CPLD.

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

NOTE Make sure that auto compare encoder is equal to position counter, before any trigger operation. Eg. I32 pos = 0; _m134_set_position (SwitchCardNo, AxisNo, pos); _m134_set_auto_compare_encoder (SwitchCardNo, AxisNo, pos);

Page 85: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

85

13.3. _m134_set_auto_compare_source

Description: Set the source of the compare trigger. Syntax: I16 _m134_set_auto_compare_source(U16 SwitchCardNo, U16 AxisNo, U16 SrcAxisNo) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3 SrcAxisNo U16 Axis number to be compared: 0 ~ 3

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 86: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

86

13.4. _m134_get_auto_compare_count

Description: Get the trigger counts since start auto compare triggering. Syntax: I16 _m134_get_auto_compare_count (U16 SwitchCardNo, U16 AxisNo, U16 *Count) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3 Count U16 * The amounts of the trigger since start auto compare triggering.

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 87: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

87

13.5. _m134_get_auto_compare_status

Description: Get the current status of the auto compare trigger function. Syntax: I16 _m134_get_auto_compare_status (U16 SwitchCardNo, U16 AxisNo, U16 *OnOff) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3

OnOff U16 *

Current status of auto compare trigger. Value Meaning

0 Disabled 1 Enabled

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 88: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

88

13.6. _m134_set_auto_compare_function

Description: Configure the auto compare trigger profiles with regular interval. Syntax: I16 _m134_set_auto_compare_function (U16 SwitchCardNo, U16 AxisNo, U8 Dir, I32 StrPos, I32

Interval, U16 TrgCnt) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3

Dir U8

Motion direction which enables auto compare trigger. Value Meaning

0 Negative direction 1 Position direction

StrPos I32 The start position which auto compare trigger begins. Interval I32 The distance interval for regularly auto compare trigger. TrgCnt U16 The maximum trigger count need to invoke.

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Start Pos

Interval

Width

Count

Page 89: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

89

13.7. _m134_set_auto_compare_trigger

Description: Configure the level and triggering duration. Syntax: I16 _m134_set_auto_compare_trigger (U16 SwitchCardNo, U16 AxisNo, U16 Level, U16 Width) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3

Level U16

Trigger level Value Meaning

0 Normal Low 1 Normal High

Width U16 Width of the triggering duration. Value: 3 ~ 65535 micro-second

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

NOTE

Start Pos

Interval

Width

CountLevel = High

Level = Low

Page 90: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

90

13.8. _m134_set_auto_compare_table

Description: Configure the auto compare trigger profiles with non-regular interval, i.e., programmable positions. Syntax: I16 _m134_set_auto_compare_table (U16 SwitchCardNo, U16 AxisNo, U8 Dir, U16 Size, I32 *Table) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3

Dir U8

Motion direction which enables auto compare trigger. Value Meaning

0 Negative direction 1 Position direction

Size U16 The size of the programmed positions in the position array. The value ranges from 1 to 1024.

Table I32 * The array stores positions need to trigger the CMP signal. Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Size = 1024

User AP Memory

Memory On CardTrigger 0Trigger 1

Page 91: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

91

13.9. _m134_start_auto_compare

Description: Enable/Disable the compare trigger function. Syntax: I16 _m134_start_auto_compare (U16 SwitchCardNo, U16 AxisNo, U16 OnOff) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3

OnOff U16

Enable/Disable the compare trigger. Value Meaning

0 Disable 1 Enable

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 92: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

92

13.10. _m134_force_trigger_output

Description: Output a triggering signal to the CMP immediately. Syntax: I16 _m134_force_trigger_output (U16 SwitchCardNo, U16 AxisNo) Argument:

Name Type Description SwitchCardNo U16 Specified board. AxisNo U16 Axis number: 0 ~ 3

Return:

Return value Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 93: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

93

14. GPIO Access Function name Description

_m134_get_digital_input Obtain the input ON/OFF status of digital input channels _m134_get_digital_output Obtain the input ON/OFF status of digital output channels _m134_set_digital_output Set output data to the output channels. _m134_get_digital_input_bit Obtain the specified input bitno status. _m134_get_digital_output_bit Obtain the specified output bitno status. _m134_set_digital_output_bit Generate specified bitno output signal. _m134_toggle_digital_output_bit Toggle specified bitno output signal.

GPIO APIs only supported on PCE-M134-LD.

Page 94: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

94

14.1. _m134_get_digital_input

Description Obtain the input ON/OFF status of digital input channels Syntax I16 _m134_get_digital_input (U16 SwitchCardNo, U16 *Val) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

Val U16 * Return value representing the I/O status. 0xffff means that all channels are on.

Status Return

Function Name ERR_NoError

Other

Page 95: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

95

14.2. _m134_get_digital_output

Description Obtain the input ON/OFF status of digital output channels Syntax I16 _m134_get_digital_output (U16 SwitchCardNo, U16 *Val) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

Val U16 * Return value representing the I/O status. 0xffff means that all channels are on.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 96: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

96

14.3. _m134_set_digital_output

Description Set output data to the output channels. Syntax I16 _m134_get_digital_output (U16 SwitchCardNo, U16 Val) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.

Val U16 Status to be set to the I/O status. 0xffff means that all channels are on.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 97: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

97

14.4. _m134_get_digital_input_bit

Description Obtain the specified input bitno status. Syntax I16 _m134_get_digital_input_bit (U16 SwitchCardNo, U8 BitNo, U8 *Val) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. BitNo U8 BitNo of the specified channel.

Val U8* On_Off = 1 => BitNo is ON On_Off = 0 => BitNo is OFF

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 98: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

98

14.5. _m134_get_digital_output_bit

Description Obtain the specified output bitno status. Syntax I16 _m134_get_digital_output_bit (U16 SwitchCardNo, U8 BitNo, U8 *Val) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. BitNo U8 BitNo of the specified channel.

Val U8* Val = 1 => BitNo is ON Val = 0 => BitNo is OFF

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 99: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

99

14.6. _m134_set_digital_output_bit

Description Generate specified bitno output signal. Syntax I16 _m134_get_digital_output_bit (U16 SwitchCardNo, U8 BitNo, U8 Val) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. BitNo U8 BitNo of the specified channel.

Val U8 Val = 1 => BitNo is ON Val = 0 => BitNo is OFF

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 100: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

100

14.7. _m134_toggle_digital_output_bit

Description Toggle specified bitno output signal. Syntax I16 _m134_toggle_digital_output_bit (U16 SwitchCardNo, U8 BitNo) Argument

Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. BitNo U8 BitNo of the specified channel.

Status Return

Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.

Page 101: PCE-M134 Programming Manual - tpm-pac.comPCE-M134 series is Plug-and-Play card. The hardware must be installed under Windows operating system first. After successful hardware initialization,

TPM PCE-M134 Programming Manual

101

15. Appendix A – Error Codes

M134ERR_NoError 0 M134ERR_InvalidSwitchCardNumber -1 M134ERR_SwitchCardNumberRepeated -2 M134ERR_MapMemoryFailed -3 M134ERR_CardNotExist -4 M134ERR_CardNotInitYet -5 M134ERR_InvalidBoardID -6 M134ERR_InvalidAxisNumber -7 M134ERR_InvalidParameter1 -8 M134ERR_InvalidParameter2 -9 M134ERR_InvalidParameter3 -10 M134ERR_InvalidParameter4 -11 M134ERR_InvalidParameter5 -12 M134ERR_InvalidParameter6 -13 M134ERR_InvalidParameter7 -14 M134ERR_InvalidParameter8 -15 M134ERR_InvalidParameter9 -16 M134ERR_InvalidParameter10 -17 M134ERR_InvalidParameter11 -18 M134ERR_InvalidParameter12 -19 M134ERR_NotSupported -20 M134ERR_GetSecureIdFailed -21 M134ERR_GenAesKeyFailed -22 M134ERR_SetAutoCmpFifoFailed -23 M134ERR_LoadFileFailed -24