TPM PCX-M114 Programming Manual
PCX-M114 Series
PCE/PCI-M114 PCE/PCI-M114GH/GM/GL
PCE-M118GL
Programming Manual Version: V1.3 2015N15
To properly use the product, read this manual thoroughly is necessary.
Part No.: 81-05114XX10-010
1
TPM PCX-M114 Programming Manual
2
TPM PCX-M114 Programming Manual
Revision History Date Revision Description
2014/4/23 1.0 Document Creation 2015/07/21 1.1 Add PCX-M114GM/GL description 2015/09/21 1.2 Add Compare Trigger description 2015/11/15 1.3 Add PCE-M118GL description
3
TPM PCX-M114 Programming Manual © 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.
4
TPM PCX-M114 Programming Manual 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.
5
TPM PCX-M114 Programming Manual
Contents CONTENTS .................................................................................................................................................................................. 6
1. OPERATIONAL PRINCIPLE ...................................................................................................................................................... 12
1.1. SYSTEM INITIALIZATION ............................................................................................................................................................... 12 1.2. AUTOMATIC MOTION CONTROL .................................................................................................................................................... 13
1.2.1. Velocity Mode Motion ......................................................................................................................................... 13 1.2.2. Point-to-Point (PTP) Mode Motion ..................................................................................................................... 14 1.2.3. Linear Interpolation Mode Motion ...................................................................................................................... 15 1.2.4. Circular Interpolation Mode Motion .................................................................................................................... 16 1.2.5. Continuous Interpolation Mode Motion ............................................................................................................... 17 1.2.6. Command Change On-The-Fly ............................................................................................................................ 18
1.3. MISCELLANEOUS FUNCTIONS ................................................................................................................................................ 20 1.3.1. Machine I/O ......................................................................................................................................................... 20 1.3.2. Driver I/O Signals ................................................................................................................................................ 22 1.3.3. Counters ............................................................................................................................................................... 24
1.4. ADVANCED FUNCTIONS ............................................................................................................................................................... 26 1.4.1. Auto-Compared Trigger Output Operation .......................................................................................................... 26 1.4.2. Project Encryption ............................................................................................................................................... 27
2. SOFTWARE PROCEDURE ....................................................................................................................................................... 28
2.1. MOTION SYSTEM INITIATION ........................................................................................................................................................ 28 2.1.1. Hardware Dependent Setting ............................................................................................................................... 29 2.1.2. Input Pulse Setting ............................................................................................................................................... 30 2.1.3. Position Mode Motion ......................................................................................................................................... 31 2.1.4. Single Axis Operation .......................................................................................................................................... 32 2.1.5. Linear Interpolation Operation ............................................................................................................................. 33 2.1.6. Circular Interpolation Operation .......................................................................................................................... 34 2.1.7. Helical Interpolation Operation ........................................................................................................................... 35
3. HARDWARE INITIALIZATION.................................................................................................................................................. 36
3.1. _M114_OPEN ........................................................................................................................................................................... 37 3.2. _M114_CLOSE .......................................................................................................................................................................... 38 3.3. _M114_GET_SWITCH_CARD_NUM ............................................................................................................................................... 39 3.4. _M114_CHECK_SWITCH_CARD_NUM ........................................................................................................................................... 40 3.5. _M114_INITIAL ......................................................................................................................................................................... 41 3.6. _M114_GET_CPLD_VERSION ....................................................................................................................................................... 42 3.7. _M114_GET_CARD_TYPE ........................................................................................................................................................... 43 3.8. _M114_CONFIG_FROM_FILE ....................................................................................................................................................... 44
4. MOTIONNET MASTER CONFIGURATION ............................................................................................................................... 45
4.1. _M114_SET_RING_CONFIG ......................................................................................................................................................... 46
6
TPM PCX-M114 Programming Manual
4.2. _M114_OPEN_MNET ................................................................................................................................................................. 47 4.3. _M114_GET_START_RING_NUM .................................................................................................................................................. 48
5. GPIO ACCESS ......................................................................................................................................................................... 49
5.1. _M114_GET_AXIS_INPUT ........................................................................................................................................................... 50 5.2. _M114_GET_AXIS_OUTPUT ........................................................................................................................................................ 51 5.3. _M114_SET_AXIS_OUTPUT ......................................................................................................................................................... 52 5.4. _M114_TOGGLE_AXIS_OUTPUT ................................................................................................................................................... 53 5.5. _M114_START_AXIS_OUTPUT ...................................................................................................................................................... 54 5.6. _M114_STOP_AXIS_OUTPUT ....................................................................................................................................................... 55 5.7. _M114_GET_AXIS_OUTPUT_COUNT ............................................................................................................................................. 56
6. SOFTWARE ENCRYPTION FUNCTIONS ................................................................................................................................... 57
6.1. _M114_GET_SECURE_ID ............................................................................................................................................................ 58 6.2. _M114_GEN_AES_KEY ............................................................................................................................................................... 59 6.3. _M114_CHECK_AES_KEY ............................................................................................................................................................ 60
7. INTERFACE I/O CONFIGURATION .......................................................................................................................................... 62
7.1. _M114_SET_ALM ...................................................................................................................................................................... 63 7.2. _M114_SET_INP ....................................................................................................................................................................... 64 7.3. _M114_SET_ERC ....................................................................................................................................................................... 65 7.4. _M114_SET_AUTO_ERC ............................................................................................................................................................. 66 7.5. _M114_SET_ERC_ON ................................................................................................................................................................ 67 7.6. _M114_SET_SERVO ................................................................................................................................................................... 68 7.7. _M114_SET_RALM .................................................................................................................................................................... 69 7.8. _M114_SET_ELL ....................................................................................................................................................................... 70 7.9. _M114_SET_SD ........................................................................................................................................................................ 71 7.10. _M114_SET_MECHANICAL_INPUT_FILTER .................................................................................................................................... 72
8. PULSE I/O CONFIGURATION .................................................................................................................................................. 73
8.1. _M114_SET_PLS_OUTMODE ....................................................................................................................................................... 74 8.2. _M114_SET_PLS_IPTMODE ......................................................................................................................................................... 75 8.3. _M114_SET_FEEDBACK_SRC ....................................................................................................................................................... 76 8.4. _M114_SET_ABS_REFERENCE ...................................................................................................................................................... 77
9. AXIS STATUS FUNCTIONS ...................................................................................................................................................... 78
9.1. _M114_MOTION_DONE ............................................................................................................................................................. 79 9.2. _M114_GET_IO_STATUS ............................................................................................................................................................. 80 9.3. _M114_CHECK_ERROR ............................................................................................................................................................... 81
10. STOP MOTION FUNCTIONS ................................................................................................................................................. 82
10.1. _M114_SD_STOP .................................................................................................................................................................... 83 10.2. _M114_IMD_STOP .................................................................................................................................................................. 84 10.3. _M114_EMG_STOP ................................................................................................................................................................. 85
7
TPM PCX-M114 Programming Manual 11. HOMING ............................................................................................................................................................................. 86
11.1. _M114_SET_HOME_CONFIG ..................................................................................................................................................... 87 11.2. _M114_HOME_MOVE .............................................................................................................................................................. 94 11.3. _M114_HOME_SEARCH............................................................................................................................................................ 95 11.4. _M114_ESCAPE_HOME ............................................................................................................................................................ 96 11.5. _M114_SEARCH_EZ ................................................................................................................................................................. 97
12. JOG FUNCTIONS .................................................................................................................................................................. 98
12.1. _M114_JOG_SWITCH_CONTINUE ............................................................................................................................................... 99 12.2. _M114_JOG_SWITCH_STEP ..................................................................................................................................................... 100 12.3. _M114_JOG_PULSER_STEP ..................................................................................................................................................... 101 12.4. _M114_JOG_STOP ................................................................................................................................................................ 102 12.5. _M114_GET_JOGIO_STATUS .................................................................................................................................................... 103
13. VELOCITY MODE MOTION ................................................................................................................................................. 104
13.1. _M114_TV_MOVE ................................................................................................................................................................. 105 13.2. _M114_SV_MOVE ................................................................................................................................................................. 106 13.3. _M114_V_CHANGE ............................................................................................................................................................... 107 13.4. _M114_FIX_SPEED_RANGE ..................................................................................................................................................... 108 13.5. _M114_UNFIX_SPEED_RANGE ................................................................................................................................................. 109 13.6. _M114_GET_CURRENT_SPEED ................................................................................................................................................ 110
14. SINGLE AXIS MOTION ....................................................................................................................................................... 111
14.1. _M114_START_TR_MOVE ....................................................................................................................................................... 112 14.2. _M114_START_TA_MOVE ....................................................................................................................................................... 113 14.3. _M114_START_SR_MOVE ....................................................................................................................................................... 114 14.4. _M114_START_SA_MOVE ....................................................................................................................................................... 115 14.5. _M114_TR_MOVE_AFTER_AXIS ............................................................................................................................................... 116 14.6. _M114_TA_MOVE_AFTER_AXIS ............................................................................................................................................... 117 14.7. _M114_SR_MOVE_AFTER_AXIS ............................................................................................................................................... 118 14.8. _M114_SA_MOVE_AFTER_AXIS ............................................................................................................................................... 119 14.9. _M114_P_CHANGE ............................................................................................................................................................... 121
15. 2-AXIS LINEAR MOTION .................................................................................................................................................... 122
15.1. _M114_START_TR_LINE2 ....................................................................................................................................................... 124 15.2. _M114_START_TA_LINE2 ....................................................................................................................................................... 125 15.3. _M114_START_SR_LINE2 ....................................................................................................................................................... 126 15.4. _M114_START_SA_LINE2 ....................................................................................................................................................... 127 15.5. _M114_START_TR_MOVE_XY .................................................................................................................................................. 128 15.6. _M114_START_TA_MOVE_XY .................................................................................................................................................. 129 15.7. _M114_START_SR_MOVE_XY .................................................................................................................................................. 130 15.8. _M114_START_SA_MOVE_XY .................................................................................................................................................. 131 15.9. _M114_START_TR_MOVE_ZU ................................................................................................................................................. 132
8
TPM PCX-M114 Programming Manual
15.10. _M114_START_TA_MOVE_ZU ............................................................................................................................................... 133 15.11. _M114_START_SR_MOVE_ZU ............................................................................................................................................... 134 15.12. _M114_START_SA_MOVE_ZU ............................................................................................................................................... 135 15.13. _M114_START_TR_MOVE_AB ............................................................................................................................................... 136 15.14. _M114_START_TA_MOVE_AB ............................................................................................................................................... 137 15.15. _M114_START_SR_MOVE_AB ............................................................................................................................................... 138 15.16. _M114_START_SA_MOVE_AB ............................................................................................................................................... 139 15.17. _M114_START_TR_MOVE_CD ............................................................................................................................................... 140 15.18. _M114_START_TA_MOVE_CD ............................................................................................................................................... 141 15.19. _M114_START_SR_MOVE_CD ............................................................................................................................................... 142 15.20. _M114_START_SA_MOVE_CD ............................................................................................................................................... 143
16. 3-AXIS LINEAR MOTION .................................................................................................................................................... 144
16.1. _M114_START_TR_LINE3 ....................................................................................................................................................... 145 16.2. _M114_START_TA_LINE3 ....................................................................................................................................................... 146 16.3. _M114_START_SR_LINE3 ....................................................................................................................................................... 147 16.4. _M114_START_SA_LINE3 ....................................................................................................................................................... 148
17. 4-AXIS LINEAR MOTION .................................................................................................................................................... 149
17.1. _M114_START_TR_LINE4 ....................................................................................................................................................... 150 17.2. _M114_START_TA_LINE4 ....................................................................................................................................................... 151 17.3. _M114_START_SR_LINE4 ....................................................................................................................................................... 152 17.4. _M114_START_SA_LINE4 ....................................................................................................................................................... 153 17.5. _M114_START_TR_LINE4_ABCD .............................................................................................................................................. 154 17.6. _M114_START_TA_LINE4_ABCD .............................................................................................................................................. 155 17.7. _M114_START_SR_LINE4_ABCD .............................................................................................................................................. 156 17.8. _M114_START_SA_LINE4_ABCD .............................................................................................................................................. 157
18. CIRCULATION MOTION ..................................................................................................................................................... 158
18.1. _M114_GET_CENTER ............................................................................................................................................................. 159 18.2. _M114_START_TR_ARC2 ........................................................................................................................................................ 160 18.3. _M114_START_TA_ARC2 ........................................................................................................................................................ 161 18.4. _M114_START_SR_ARC2 ........................................................................................................................................................ 162 18.5. _M114_START_SA_ARC2 ........................................................................................................................................................ 163 18.6. _M114_START_TR_ARC_XY ..................................................................................................................................................... 164 18.7. _M114_START_TA_ARC_XY ..................................................................................................................................................... 165 18.8. _M114_START_SR_ARC_XY ..................................................................................................................................................... 166 18.9. _M114_START_SA_ARC_XY ..................................................................................................................................................... 167 18.10. _M114_START_TR_ARC_ZU .................................................................................................................................................. 168 18.11. _M114_START_TA_ARC_ZU .................................................................................................................................................. 169 18.12. _M114_START_SR_ARC_ZU .................................................................................................................................................. 170 18.13. _M114_START_SA_ARC_ZU .................................................................................................................................................. 171 18.14. _M114_START_TR_ARC_AB .................................................................................................................................................. 172
9
TPM PCX-M114 Programming Manual
18.15. _M114_START_TA_ARC_AB .................................................................................................................................................. 173 18.16. _M114_START_SR_ARC_AB .................................................................................................................................................. 174 18.17. _M114_START_SA_ARC_AB .................................................................................................................................................. 175 18.18. _M114_START_TR_ARC_CD .................................................................................................................................................. 176 18.19. _M114_START_TA_ARC_CD .................................................................................................................................................. 177 18.20. _M114_START_SR_ARC_CD .................................................................................................................................................. 178 18.21. _M114_START_SA_ARC_CD .................................................................................................................................................. 179
19. CYLINDER SURFACE MOVE ................................................................................................................................................ 180
19.1. _M114_START_TR_ARC_XYZ ................................................................................................................................................... 181 19.2. _M114_START_TA_ARC_XYZ ................................................................................................................................................... 182 19.3. _M114_START_TR_ARC_ABC................................................................................................................................................... 183 19.4. _M114_START_TA_ARC_ABC ................................................................................................................................................... 184
20. COUNTER CONTROL FUNCTIONS ...................................................................................................................................... 185
20.1. _M114_GET_POSITION .......................................................................................................................................................... 186 20.2. _M114_SET_POSITION ........................................................................................................................................................... 187 20.3. _M114_GET_COMMAND ........................................................................................................................................................ 188 20.4. _M114_SET_COMMAND ........................................................................................................................................................ 189 20.5. _M114_GET_ERROR_COUNTER ............................................................................................................................................... 190 20.6. _M114_RESET_ERROR_COUNTER ............................................................................................................................................. 191 20.7. _M114_GET_GENERAL_COUNTER ............................................................................................................................................ 192 20.8. _M114_SET_GENERAL_COUNTER ............................................................................................................................................. 193 20.9. _M114_GET_TARGET_POS ...................................................................................................................................................... 194 20.10. _M114_SET_TARGET_POS .................................................................................................................................................... 195
21. RING COUNTER CONTROL FUNCTIONS .............................................................................................................................. 196
21.1. _M114_ENABLE_COMMAND_RING_COUNTER ............................................................................................................................ 197 21.2. _M114_DISABLE_COMMAND_RING_COUNTER ........................................................................................................................... 198 21.3. _M114_ENABLE_POSITION_RING_COUNTER .............................................................................................................................. 199 21.4. _M114_DISABLE_POSITION_RING_COUNTER .............................................................................................................................. 200
22. SOFT LIMIT CONFIGURATION ............................................................................................................................................ 201
22.1. _M114_SET_SOFT_LIMIT ........................................................................................................................................................ 202 22.2. _M114_ENABLE_SOFT_LIMIT .................................................................................................................................................. 203 22.3. _M114_DISABLE_SOFT_LIMIT .................................................................................................................................................. 204
23. COUNTER LATCH FUNCTIONS ............................................................................................................................................ 205
23.1. _M114_SET_LTC_LOGIC ......................................................................................................................................................... 206 23.2. _M114_GET_LATCH_DATA ...................................................................................................................................................... 207
24. COUNTER COMPARATOR FUNCTIONS ............................................................................................................................... 208
24.1. _M114_SET_GENERAL_COMPARATOR ....................................................................................................................................... 209 24.2. _M114_CHECK_COMPARE_DATA .............................................................................................................................................. 210
10
TPM PCX-M114 Programming Manual
24.3. _M114_CHECK_COMPARE_STATUS ........................................................................................................................................... 211
25. COUNTER COMPARATOR TRIGGER FUNCTIONS ................................................................................................................ 212
25.1. _M114_SET_TRIGGER_TYPE .................................................................................................................................................... 213 25.2. _M114_ENABLE_TRIGGER_COMPARATOR .................................................................................................................................. 214 25.3. _M114_DISABLE_TRIGGER_COMPARATOR .................................................................................................................................. 215 25.4. _M114_GET_TRIGGER_AVAILABLE_BUFFER ................................................................................................................................ 216 25.5. _M114_ADD_TRIGGER_COMPARATOR ....................................................................................................................................... 217 25.6. _M114_CANCEL_TRIGGER_BUFFER ........................................................................................................................................... 218
26. AUTO COMPARE PROGRAMMING .................................................................................................................................... 219
26.1. _M114_GET_AUTO_COMPARE_ENCODER .................................................................................................................................. 220 26.2. _M114_SET_AUTO_COMPARE_ENCODER................................................................................................................................... 221 26.3. _M114_SET_AUTO_COMPARE_SOURCE ..................................................................................................................................... 222 26.4. _M114_GET_AUTO_COMPARE_COUNT ..................................................................................................................................... 223 26.5. _M114_GET_AUTO_COMPARE_STATUS ..................................................................................................................................... 224 26.6. _M114_SET_AUTO_COMPARE_TRIGGER .................................................................................................................................... 225 26.7. _M114_SET_AUTO_COMPARE_FUNCTION ................................................................................................................................. 226 26.8. _M114_SET_AUTO_COMPARE_TABLE ....................................................................................................................................... 227 26.9. _M114_GET_AUTO_COMPARE_TABLE_CAPACITY......................................................................................................................... 229 26.10. _M114_START_AUTO_COMPARE ............................................................................................................................................ 230 26.11. _M114_FORCE_TRIGGER_OUTPUT ......................................................................................................................................... 231
27. CONTINUOUS MOTION CONTROL ..................................................................................................................................... 233
27.1. _M114_CHECK_CONTINUOUS_BUFFER ...................................................................................................................................... 234 27.2. _M114_GET_CONTINUOUS_BUFFER_STATUS .............................................................................................................................. 235 27.3. _M114_CANCEL_CONTINUOUS_BUFFER .................................................................................................................................... 236
28. INTERRUPT CONTROL FUNCTIONS .................................................................................................................................... 237
28.1. _M114_INT_CONTROL ........................................................................................................................................................... 238 28.2. _M114_INT_WAIT ................................................................................................................................................................. 239 28.3. _M114_INT_CHECK ............................................................................................................................................................... 240 28.4. _M114_SET_INT_FACTOR ....................................................................................................................................................... 241 28.5. _M114_GET_INT_STATUS ....................................................................................................................................................... 242
29. APPENDIX A – ERROR CODES ............................................................................................................................................ 246
11
TPM PCX-M114 Programming Manual
1. Operational Principle PCE/PCI-M114 series and PCE/PCI-M118 are motion control cards equipped with a 4-axis and 8-Axis motion ASIC respectively as well as 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 PCE/PCX-M114. (hereinafter referred to as PCX-M114.)
1.1. System Initialization
M114 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: S-curve velocity mode motion
The PCX-M114 would be fully functioned after the hardware initialization call, _m114_open().
Card Index = 0 SwitchCardNo = 2
Card Index = 1 SwitchCardNo = 4
Card Index = 2 SwitchCardNo = 6
_m114_openExistCard = 3
Figure 1-2: S-curve velocity mode motion
Relative functions: _m114_open, _m114_close
12
TPM PCX-M114 Programming Manual
1.2. Automatic Motion Control
6 main types of automatic motion control are supported as listed in the following. a. Velocity mode motion: 1 ~ 8 axes. b. Point-to-Point movement: 1 axis above, non-synchronized. c. Linear interpolation: 2~ 4 axes, synchronized. d. Circular interpolation: 2 axes, synchronized. e. Continuous interpolation: 2 axes, synchronized. f. Command change on-the-fly, non-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: _m114_tv_move, _m114_sv_move, _m114_v_change, _m114_sd_stop, _m114_emg_stop, _m114_fix_speed_range, _m114_unfix_speed_range, _m114_get_current_speed
Tacc(sec) Tdec(sec)
StrVel
MaxVel
Time
Velocity (pps)
Svac
Svac Svde
Svde
13
TPM PCX-M114 Programming Manual
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, PCX-M114 supports either T-curve or S-curve velocity profile under relative or absolute coordinates. For multiple axes PTP motion, PCX-M114 supports axes not only on the PCX-M114 itself but also for axes between multiple PCX-M114 cards. PCX-M114 supports this technique by STA/STP hardware pins on board. The wiring of STA/STP is necessary to multiple axes at different cards.
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: _m114_start_tr_move, _m114_start_ta_move, _m114_start_sr_move, _m114_start_sa_move
P0 P1
14
TPM PCX-M114 Programming Manual
1.2.3. Linear Interpolation Mode Motion
PCX-M114 supports 2 ~ 4 axes linear interpolation with T-curve or S-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: _m114_start_tr_line2, _m114_start_ta_line2 _m114_start_sr_line2, _m114_start_sa_line2 3-D Interpolation _m114_start_tr_line3, _m114_start_ta_line3 _m114_start_sr_line3, _m114_start_sa_line3 4-axis Interpolation _m114_start_tr_line4, _m114_start_ta_line4 _m114_start_sr_line4, _m114_start_sa_line4
X
P0(X0,Y0)
P1(X1,Y1)
dX
dY
Y
15
TPM PCX-M114 Programming Manual
1.2.4. Circular Interpolation Mode Motion
PCX-M114 supports any 2 axes circular interpolation with T-curve or S-curve velocity profile under relative or absolute coordinates. Please refer to the following figure. The start point P0 is at (X0, Y0) and the end point P1 is at (X1, Y1). The path connecting P0 and P1 is an arc, and the MaxVel is the tangent speed. To initiate a circular interpolation movement, the following parameters must be defined, center point, end point and the direction.
Figure 1-6: circular interpolation mode motion
The acceleration / deceleration time is adjustable with the following API’s. Relative functions: Circular interpolation with acceleration / deceleration _m114_start_tr_arc2, _m114_start_ta_arc2 _m114_start_sr_arc2, _m114_start_sa_arc2 Circular interpolation with another linear moving _m114_start_tr_arc_xyz, _m114_start_ta_arc_xyz
P1
P0
Cent
16
TPM PCX-M114 Programming Manual
1.2.5. Continuous Interpolation Mode Motion
PCX-M114 supports continuous interpolation with 2 hardware pre-registers inside the motion ASIC. Please refer to the following diagram.
Figure 1-7: continuous interpolation inside the motion ASIC
User can complete the continuous path as shown in the figure by following steps.
Figure 1-8: continuous interpolation path
Please follow steps to do continuous interpolation movement: 1. Set bit 2 of INT factor to TRUE. 2. Set the Conti_logic to 1. 3. Call the first three motion segments. 4. Wait for pre-register_2 empty event. 5. Call the 4th motion segment. 6. Repeat steps 4 to 5. 7. Call the last motion segment and wait for motion complete. Relative functions: _m114_set_abs_reference, _m114_check_continuous_buffer, _m114_get_continuous_buffer_status, _m114_cancel_continuous_buffer
RunningRegister
Pre-register2
Host PCProgram
Empty Interrupt
Command ReloadMotionASIC
Pre-register1
Contiuous Interpolation
X Axis
Y Axis
17
TPM PCX-M114 Programming Manual
1.2.6. Command Change On-The-Fly
Velocity change on-the-fly
Figure 1-9: velocity change on-the-fly
Position change on-the-fly
Figure 1-10: new position > P-Change Point position
Figure 1-11: new position > P-Change Point position
Velocity (pps)
StrVel
Tacc
MaxVel
Time (second)Time
NewVel
18
TPM PCX-M114 Programming Manual
Figure 1-12: new position < P-Change Point position
Relative functions: _m114_v_change, _m114_fix_speed_range, _m114_unfix_speed_range, _m114_get_current_speed, _m114_verify_speed, _m114_p_change
19
TPM PCX-M114 Programming Manual
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,LTC 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-13: machine I/O
20
TPM PCX-M114 Programming Manual 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. There are 2 types of stop modes, one is immediate stop and the other is decelerating to stop. 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 is usually 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-14: CMP application
LTC The LTC is an input signal. When the LTC is active the counter value can be latched in the same time instantly by hardware. One of the LTC applications is shown in the following figure. It is used to measure the tool length. The probe signal is connected to the LTC. When the LTC is active the counter value of the specified encoder feedback will be latched. The _m114_get_latch_data is used to read the counter value.
Comparator
Trigger Circuit
P2 P1 Data Interrupt to Host PC
T2 T1
Encoder Feedback
Encoder Motor
Object
21
TPM PCX-M114 Programming Manual
Figure 1-15: LTC applications
STA / STP (External start / stop, simultaneous start / stop) The STA signal is an external input signal. Axis will start when this signal is triggered. When users want to control multiple axes using more than one card to start at the same time, it needs to connect the STA terminal on each card and run synchronous motion API functions. After that, users can trigger all axes to start at the same time by the STA terminal signal. The STP signal is an external input signal. Axis will stop when this signal is triggered. When users want to control multiple axes using more than one card to stop at the same time, it needs to connect the STP terminal on each card and run synchronous motion API functions. After that, users can trigger all axes to stop at the same time by the STP terminal signal.
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 _m114_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 PCX-M114.
The occurrence of INP at servo driver 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.
The processing of INP at PCX-M114 The processing of INP at PCX-M114 is a hardware built-in function. When the INP function is enabled at PCX-M114, the motion completion will be delayed not just after the pulse command has been executed but until the INP signal is on. In other words, motion is completed until the servo driver/motor has reached the desired target position.
WORK
Measurement
Command
Feedback
22
TPM PCX-M114 Programming Manual ERC ERC signal is to be used together with position mode servo driver / motor. It is an output signal from PCX-M114 to servo driver / motor. The occurrence of ERC will happen under the following conditions 1. Home return is completed. 2. The EL is active. 3. ALM happens. 4. EMG is issued by software. 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-16: 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
23
TPM PCX-M114 Programming Manual
1.3.3. Counters
PCX-M114 provides 4 type counters for each axis.There are command position counter, feedback position counter, position error counter and general purpose counter. Axis encoder counter is only supported by Axis #0, Axis #1and Axis #2. Command Position Counter The command position counter is a 28-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 _m114_set_command and read by _m114_get_command function. Feedback Position Counter The feedback position counter is a 28-bit up/down counter. Its input source is from the external encoder
24
TPM PCX-M114 Programming Manual feedback from EA + and EB+ pins. 2 Types of encoder feedback signal is supported. One is CW/CCW the other is A/B Phase. For A/B Phase mode signal the multiplier factor x1/x2/x4 can be selected.
Figure 1-17: feedback position counter
Position Error Counter The position error counter is a 16-bit counter. The difference between command position and feedback position is recorded here. This is useful to the step-loss detection in the application of step motor and external encoder. The counter value can be read or clear by the _m114_get_error_counter and _m114_reset_error_counter respectively. General Purpose Counter The general purpose counter is a 28-bit up/down counter. The input source can be Command output pulse / encoder feedback pulse / Manual pulse generator / Clock. Axis Encoder Counter The axis encoder counter is a 28-bit up/down counter. It is used as the source counter of auto-compared trigger output function and FIFO latch function. Relative functions: _m114_get_position, _m114_set_position, _m114_get_command, _m114_set_command, _m114_get_error_counter, _m114_reset_error_counter, _m114_get_general_counter, _m114_set_general_counter, _m114_get_target_pos, _m114_set_target_pos, _m114_get_rest_command, _m114_set_axis_counter, _m114_get_axis_counter
MUX
FB Counter
Command
FeedBack
25
TPM PCX-M114 Programming Manual
1.4. Advanced Functions
Advanced functions are listed below. Auto-compared trigger output operation Security 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-18: auto-compare trigger output application
Relative functions: _m114_set_auto_compare_trigger, _m114_start_auto_compare, _m114_set_auto_compare_table, _m114_set_auto_compare_function, _m114_force_trigger_output
26
TPM PCX-M114 Programming Manual
1.4.2. Project Encryption
PCX-M114 series equipped an identification chip with unique serial number. The unique serial number plays the role as the content for AES algorithm. We call the unique serial number the hardware id from now on. Another key held by the system integrator is called the SI key, used for encryption/decryption for the AES algorithm to make the registration key. The illustration of the making of the registration is as the following figure.
Figure 1-19: generation of the registration key
Relative functions: _m114_get_secure_id, _m114_gen_aes_key, _m114_check_aes_key
27
TPM PCX-M114 Programming Manual
2. Software Procedure
2.1. Motion System Initiation
Application Start
Hardware Dependent Setting
Output Pulse Setting
_m114_set_pls_outmode(SwitchCardNo, AxisNo, pls_outmode)
Input Pulse Setting
Clear Driver Deviation Counter
_m114_set_erc(SwitchCardNo, AxisNo, erc_logic, erc_on_time)
NOTE: ERC should output before Servo ON
Driver Servo On
_m114_set_servo(SwitchCardNo, AxisNo, on_off)
Start Motion Control
Figure 2-1: Hardware Dependent Setting
28
TPM PCX-M114 Programming Manual
2.1.1. Hardware Dependent Setting
Start Hardware Dependent Setting
End Hardware Dependent Setting
Use Inp Fun .?
Set INP Active Logic
_m114_set_inp(SwitchCardNo, AxisNo, 1, inp_logic)
Set INP Active Logic
_m114_set_inp(SwitchCardNo, AxisNo, 0, inp_logic)
Initialize Card
_m114_open(existcards)_m114_initial(SwitchCardNo)
Set Correct EL Logic & Mode
_m114_set_ell(SwitchCardNo, AxisNo, ell_logic, ell_mode)
Set Correct Alarm Input Logic
_m114_set_alm(SwitchCardNo, AxisNo, alm_logic, alm_mode)
Set Correct Alarm Input Logic
_m114_set_alm(SwitchCardNo, AxisNo, alm_logic, alm_mode)
Set SD Active Logic
_m114_set_sd(SwitchCardNo, AxisNo, enable, sd_logic, sd_latch, sd_mode)
NOYES
Use Inp Fun .?
Set Latch Logic
_m114_set_ltc_logic(SwitchCardNo, AxisNo, ltc_logic)
Correct Alarm Logic &Correct EL Logic &
Correct SD Logic
YES
YES
NO
NO
HardwareDependent
Figure 2-2: Hardware Dependent Setting
29
TPM PCX-M114 Programming Manual
2.1.2. Input Pulse Setting
Start Input Pulse Setting
Cotinuous Mode Motion Setting
Set Pulse Input Mode
_m114_set_pls_iptmode(SwitchCardNo, AxisNo, pls_iptmode, pls_logic)
Set Command As Feedback Source
Absolute Moving Functions follow Command counter_m114_set_feedback_src(SwitchCardNo, AxisNo, 1)_m114_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_m114_set_feedback_src(SwitchCardNo, AxisNo, 0)_m114_set_abs_reference(SwitchCardNo, AxisNo, 1)
Set Encoder As Feedback Source
Absolute Moving Functions follow position counter_m114_set_feedback_src(SwitchCardNo, AxisNo, 0)_m114_set_abs_reference(SwitchCardNo, AxisNo, 0)
Follow Position CounterFollow Command Counter
NO
YES
NO
YES
Figure 2-3: Input Pulse Setting
30
TPM PCX-M114 Programming Manual
2.1.3. Position Mode Motion
Position Mode Motion
Interpolation?
Linear Interpolation Circle InterpolationHelical Interpolation
Position Mode Motion
YES
NO
Figure 2-4: Position Mode Motion
31
TPM PCX-M114 Programming Manual
2.1.4. Single Axis Operation
Start Position Mode Motion
VelocityProfile choice
Absolute or Relative Moving ?
Absolute Moving
_m114_start_ta_move(SwitchCardNo, AxisNo, Pos, StrVel, MaxVel, Tacc, Tdec)
Relative Moving
_m114_start_tr_move(SwitchCardNo, AxisNo, Dist, StrVel, MaxVel, Tacc, Tdec)
Absolute or Relative Moving ?
Absolute Moving
_m114_start_sa_move(SwitchCardNo, AxisNo, Pos, StrVel, MaxVel, Tacc, Tdec)
Relative Moving
_m114_start_sr_move(SwitchCardNo, AxisNo, Dist, StrVel, MaxVel, Tacc, Tdec)
S-Curve
Absolute Relative
RelativeAbsolute
T-Curve
STOP ?
Check Motion Status
_m114_motion_done(SwitchCardNo, AxisNo)
MoSt == 0 ?
Stop Command
_m114_sd_stop(SwitchCardNo, AxisNo, Tdec)_m114_emg_stop(SwitchCardNo, AxisNo)
End Position Mode Motion
NO
YES
YES
NO
Figure 2-5: Single Axis Operation
32
TPM PCX-M114 Programming Manual
2.1.5. Linear Interpolation Operation
Start linear Interpolation Motion
VelocityProfile choice
Absolute or Relative Moving ?
Absolute Moving_m114_start_ta_line2(…)_m114_start_ta_line3(…)_m114_start_ta_line4(…)
Relative Moving_m114_start_tr_line2(…)_m114_start_tr_line3(…)_m114_start_tr_line4(…)
Absolute or Relative Moving ?
Absolute Moving_m114_start_sa_line2(…)_m114_start_sa_line3(…)_m114_start_sa_line4(…)
Relative Moving_m114_start_sr_line2(…)_m114_start_sr_line3(…)_m114_start_sr_line4(…)
S-Curve
Absolute Relative
RelativeAbsolute
T-Curve
STOP ?
Check Motion Status
_m114_motion_done(SwitchCardNo, AxisNo)
MoSt == 0 ?
Stop Command
_m114_sd_stop(SwitchCardNo, AxisNo, Tdec)_m114_emg_stop(SwitchCardNo, AxisNo)
End linear Interpolation Motion
NO
YES
YES
NO
Figure 2-6: Linear Interpolation Operation
33
TPM PCX-M114 Programming Manual
2.1.6. Circular Interpolation Operation
Start Circle Interpolation Motion
VelocityProfile choice
Absolute or Relative Moving ?
Absolute Moving
_m114_start_ta_arc2(…)
Relative Moving
_m114_start_tr_arc2(…)
Absolute or Relative Moving ?
Absolute Moving
_m114_start_sa_arc2(…)
Relative Moving
_m114_start_sr_arc2(…)
S-Curve
Absolute Relative
RelativeAbsolute
T-Curve
STOP ?
Check Motion Status
_m114_motion_done(SwitchCardNo, AxisNo)
MoSt == 0 ?
Stop Command
_m114_sd_stop(SwitchCardNo, AxisNo, Tdec)_m114_emg_stop(SwitchCardNo, AxisNo)
End Circle Interpolation Motion
NO
YES
YES
NO
Figure 2-7: Circular Interpolation Operation
34
TPM PCX-M114 Programming Manual
2.1.7. Helical Interpolation Operation
Start Helical Interpolation Motion
VelocityProfile choice
Absolute or Relative Moving ?
Absolute Moving
_m114_start_ta_arc_xyz(…)
Relative Moving
_m114_start_tr_arc_xyz(…)
Absolute or Relative Moving ?
Absolute Moving
_m114_start_sa_arc_xyz(…)
Relative Moving
_m114_start_sr_arc_xyz(…)
S-Curve
Absolute Relative
RelativeAbsolute
T-Curve
STOP ?
Check Motion Status
_m114_motion_done(SwitchCardNo, AxisNo)
MoSt == 0 ?
Stop Command
_m114_sd_stop(SwitchCardNo, AxisNo, Tdec)_m114_emg_stop(SwitchCardNo, AxisNo)
End Helical Interpolation Motion
NO
YES
YES
NO
Figure 2-8: Circular Interpolation Operation
35
TPM PCX-M114 Programming Manual
3. Hardware Initialization Function name Description
_m114_open Allocate hardware resources and get the amount of the master card. _m114_close Release hardware resources _m114_get_switch_card_num Get the card number from the card index _m114_check_switch_card_num Check the existence of the PCX-M114 with a card number. _m114_initial Initialize the resource of PCX-M114 _m114_get_cpld_version Get the software version of the CPLD. _m114_get_card_type Get the PCX-M114 card type. _m114_config_from_file Initialize the resource of PCX-M114
Card Type Motionnet Ring Number of Axes PCI-M114 0 4 PCI-M114GH 2 4 PCI-M114GM 2 4 PCI-M114GL 1 4 PCE-M114 0 4 PCE-M114GH 2 4 PCE-M114GM 2 4 PCE-M114GL 1 4 PCI-M118GL 1 8 PCE-M118GL 1 8
36
TPM PCX-M114 Programming Manual
3.1. _m114_open
Description Allocate hardware resources and get the amount of the master card. Syntax I16 _m114_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.
37
TPM PCX-M114 Programming Manual
3.2. _m114_close
Description Release hardware resources Syntax: I16 _m114_close () Argument N/A Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
38
TPM PCX-M114 Programming Manual
3.3. _m114_get_switch_card_num
Description Get the card number from the card index. Syntax I16 _m114_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 PCX-M114 master cards installed in PC, we can get the SwitchCardNo by API.
Card Index = 0 SwitchCardNo = 2
Card Index = 1 SwitchCardNo = 4
Card Index = 2 SwitchCardNo = 6
39
TPM PCX-M114 Programming Manual
3.4. _m114_check_switch_card_num
Description Check the existence of the PCX-M114 with a card number. Syntax I16 _m114_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.
40
TPM PCX-M114 Programming Manual
3.5. _m114_initial
Description Check the existence of the PCX-M114 with a card number. Syntax I16 _m114_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.
41
TPM PCX-M114 Programming Manual
3.6. _m114_get_cpld_version
Description Get the software version of the CPLD. Syntax I16 _m114_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.
42
TPM PCX-M114 Programming Manual
3.7. _m114_get_card_type
Description Get the PCX-M114 card type. Syntax I16 _m114_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_PCI_M114 2 CARD_PCI_M114GH 3 CARD_PCI_M114GM 4 CARD_PCI_M114GL 5 CARD_PCE_M114 6 CARD_PCE_M114GH 7 CARD_PCE_M114GM 8 CARD_PCE_M114GL 10 CARD_PCI_M118GL 12 CARD_PCE_M118GL
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
43
TPM PCX-M114 Programming Manual
3.8. _m114_config_from_file
Description Load the parameters of axis configuration from the ini file which is generated by the MyLink utility Syntax I16 _m114_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. Note. The configuration file is saved as *.ini format by MyLink.
44
TPM PCX-M114 Programming Manual
4. Motionnet Master Configuration Function name Description
_m114_set_ring_config Set the baud rate of Motionnet Rings in the specified card. _m114_open_mnet Link and enable Motionnet functionalities. _m114_get_start_ring_num Get the amount of the Motionnet Rings of the specified card.
45
TPM PCX-M114 Programming Manual
4.1. _m114_set_ring_config
Description Set the baud rate of Motionnet Rings in the specified card. Syntax I16 _m114_set_ring_config (U16 SwitchCardNo, U16 RingOfCard, U8 BaudRate) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the PCX-M114. RingOfCard U16 Ring Number 0 ~1 BaudRate U8 Baud rate settings.
Argument Baud rate 0 2.5Mbps 1 5Mbps 2 10Mbps 3 20Mbps
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
46
TPM PCX-M114 Programming Manual
4.2. _m114_open_mnet
Description Link and enable Motionnet functionalities. Syntax I16 _m114_open_mnet (U16 SwitchCardNo) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the PCX-M114.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
47
TPM PCX-M114 Programming Manual
4.3. _m114_get_start_ring_num
Description Get the amount of the Motionnet Rings of the specified card. Syntax I16 _m114_get_start_ring_num (U16 SwitchCardNo, U16 *RingNo) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the PCX-M114.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
48
TPM PCX-M114 Programming Manual
5. GPIO Access Function name Description
_m114_get_axis_input Get the input signal status of the specified axis. _m114_get_axis_output Get the output signal status of the specified axis. _m114_set_axis_output Set the output signal of the specified axis. _m114_toggle_axis_output Toggle the output signal of the specified axis. _m114_start_axis_output Make the axis general purposed output signal toggle for a specified
on time, off time intervals and amount of the signal switching times. _m114_stop_axis_output Stop the axis output signal triggered by calling
_m114_start_axis_output. _m114_get_axis_output_count Get the cycle count of the axis output signal.
Each axis has two GPIO signals for each axis (1 input and 1 output) except the first axis. The input signal of the first axis is reserved for the EMG signal.
Card Type DO Ch. DI Ch. PCI-M114 ╳ ╳ PCI-M114GH 4 3 PCI-M114GM 4 3 PCI-M114GL 4 3 PCE-M114 ╳ ╳ PCE-M114GH 4 3 PCE-M114GM 4 3 PCE-M114GL 4 3 PCI-M118GL ╳ ╳ PCE-M118GL ╳ ╳
The GPIO signals are open collector as shown below.
49
TPM PCX-M114 Programming Manual
5.1. _m114_get_axis_input
Description Get the input signal status of the specified axis. Syntax I16 _m114_get_axis_input (U16 SwitchCardNo, U16 AxisNo, U16 *OnOff) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Axis 0 to axis 3 can be applied. OnOff U16 * Return value representing the I/O status.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
50
TPM PCX-M114 Programming Manual
5.2. _m114_get_axis_output
Description Get the output signal status of the specified axis. Syntax I16 _m114_get_axis_output (U16 SwitchCardNo, U16 AxisNo, U16 *OnOff) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Axis 0 to axis 3 can be applied. OnOff U16 * Return value representing the I/O status.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
51
TPM PCX-M114 Programming Manual
5.3. _m114_set_axis_output
Description Set the output signal of the specified axis. Syntax I16 _m114_set_axis_output (U16 SwitchCardNo, U16 AxisNo, U16 OnOff) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Axis 0 to axis 3 can be applied. OnOff U16 Status to be set to the I/O status.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
52
TPM PCX-M114 Programming Manual
5.4. _m114_toggle_axis_output
Description Toggle the output signal of the specified axis. Syntax I16 _m114_toggle_axis_output (U16 SwitchCardNo, U16 AxisNo) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Axis 0 to axis 3 can be applied.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
53
TPM PCX-M114 Programming Manual
5.5. _m114_start_axis_output
Description Make the axis general purposed output signal toggle for a specified on time, off time intervals and amount of the signal switching times. Syntax I16 _m114_start_axis_output (U16 SwitchCardNo, U16 AxisNo, U16 OnTime, U16 OffTime, U16 Count) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Only axis 0 or 1 can be applied.
OnTime U16 The time interval of the output signal to be on. OnTime: 100 ~ 65535 (the timer base is 1us). 100 means 100us interval.
OffTime U16 The time interval of the output signal to be off. OffTime: 100 ~ 65535 (the timer base is 1us). 100 means 100us interval.
Count U16 The amount of the switch times. 0 for infinite counting. Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table. Note the count of the signal switch times is as the figure below .
ON
OFF OFF OFF OFF
ON ON ON
Count = 4
0V
+Vdd
54
TPM PCX-M114 Programming Manual
5.6. _m114_stop_axis_output
Description Stop the axis output signal triggered by calling _m114_start_axis_output. Syntax I16 _m114_stop_axis_output (U16 SwitchCardNo, U16 AxisNo) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Only axis 0 or 1 can be applied.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
55
TPM PCX-M114 Programming Manual
5.7. _m114_get_axis_output_count
Description Get the cycle count of the axis output signal. Syntax I16 _m114_get_axis_output_count (U16 SwitchCardNo, U16 AxisNo, U16 *Count) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Only axis 0 or 1 can be applied.
Count U16 * The amount of the switch times as the return value. It will always get 0 if the axis output is in infinite counting mode.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
56
TPM PCX-M114 Programming Manual
6. Software Encryption Functions Function name Description
_m114_get_secure_id Get the secure id from the security ASIC on PCX-M114 card. _m114_gen_aes_key Generate AES key by inputting SI key using Rijndael algorithm. _m114_check_aes_key Check the validity of the calculated AES key.
57
TPM PCX-M114 Programming Manual
6.1. _m114_get_secure_id
Description Get the secure id from the security ASIC on PCX-M114 card. Syntax I16 _m114_get_secure_id (U16 SwitchCardNo, U8 SecureID[8]) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card. AxisNo U16 The axis number. Axis 0 to axis 3 can be applied.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
58
TPM PCX-M114 Programming Manual
6.2. _m114_gen_aes_key
Description Generate AES key by inputting SI key using Rijndael algorithm. Syntax I16 _m114_gen_aes_key (U16 SwitchCardNo, U8 SI_Key[16], U8 SecureID[8], U8 AES_Key[16]) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.
SI_Key [8] U8 Pointer to a 16-element byte-array indicating SI key, every element is an integer ranged from 0 to 9.
SecureID[8] U8 Pointer to a 8-element byte-array indicating Secure ID, if SecureID is NULL, the data read from Security ASIC will be used to generate AES_Key.
AES_Key[16] U8 Pointer to a 16-element byte-array indicating AES key. Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
59
TPM PCX-M114 Programming Manual
6.3. _m114_check_aes_key
Description Check the validity of the calculated AES key. Syntax I16 _m114_check_aes_key (U16 SwitchCardNo, U8 SI_Key[16], U8 AES_Key[16], U8* Validity) Argument
Name Type Description SwitchCardNo U16 The rotary switch set number of the master card.
SI_Key [8] U8 Pointer to a 16-element byte-array indicating SI key, every element is an integer ranged from 0 to 9.
AES_Key[16] U8 Pointer to a 16-element byte-array indicating AES key.
Validity U8 * Pointer to a variable that receives the validity of the AES_Key. 1: valid, 0: invalid.
Status Return
Function Name Description ERR_NoError The function finished execution successfully. Other Please reference to the Appendix error table.
60
TPM PCX-M114 Programming Manual Sample Code: U8 SID[8]; U8 SIK[16] = {1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8}; // every element is an integer ranged from 0 to 9 U8 AesKey[16]; U8 Validity; // Generate AES Key _m114_get_secure_id(SID); _ m114_gen_aes_key(SIK, SID, AesKey); // Check AES Key _ m114_check_aes_key(SIK, AesKey, &Validity);
Secure ID Array
6d 00 00 06 c7 d2 8b 09
[7] [6] [5] [4] [3] [2] [1] [0]
SI Key Array
8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1
[15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] [0]
AES Key Array
84 b7 2b 44 03 8e d0 e6 82 ef 17 54 24 0a f2 96
[15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] [0]
61
TPM PCX-M114 Programming Manual
7. Interface