User's Manual: PMC Programmable Motion Controller
User's Manual: PMC Programmable Motion Controller
User’s Manual
Copyright
Adtech (Shenzhen) Technology Co., Ltd. (Adtech hereafter) is in possession of the
copyright of this manual. Without the permission of Adtech, the imitation, copy,
transcription and translation by any organization or individual are prohibited. This
manual doesn’t contain any assurance, stance or implication in any form. Adtech and
the employees are not responsible for any direct or indirect data disclosure, profits
loss or cause termination caused by this manual or any information about mentioned
products in this manual. In addition, the products and data in this manual are subject
to changes without prior notice.
-1-
PMC Programmable Motion Controller
Version Update
Remark: The three digits in version number have the following meanings:
0 1 0
Main version number of library / Secondary version number of library / Reserved
Remark:
1. Adtech has collated and checked this Manual strictly; however, we can’t guarantee that
there is no error or omission in this Manual.
2. Adtech is committed to continuously improving product function and service quality. The
product, software and Manual are subject to changes without prior notice.
-2-
PMC Programmable Motion Controller
Contents
1. PRODUCT OVERVIEW..................................................................................................... - 6 -
1.1. HARDWARE SYSTEM DESCRIPTION ........................................................................................- 6 -
1.2. PRODUCT SPECIFICATIONS .....................................................................................................- 7 -
1.3. OPERATING ENVIRONMENT....................................................................................................- 8 -
1.4. INSTALLATION LAYOUT ..........................................................................................................- 9 -
2. ELECTRICAL INTERFACE AND CONNECTION..................................................... - 10 -
2.1. IN1 WIRE NO. DESCRIPTION .................................................................................................- 10 -
2.2. IN2 WIRE NO. DESCRIPTION .................................................................................................- 10 -
2.3. OUT1 WIRE NO. DESCRIPTION ............................................................................................- 11 -
2.4. JDA1 WIRE NO. DESCRIPTION .............................................................................................- 12 -
2.5. X1, Y1, Z1, A1, B1, C1 DRIVE CONTROL INTERFACE WIRE NO. DESCRIPTION ..................- 13 -
2.6. IN3 WIRE NO. DESCRIPTION .................................................................................................- 16 -
2.7. OUT2 WIRE NO. DESCRIPTION ............................................................................................- 17 -
2.8. POWER WIRING MODE ..........................................................................................................- 18 -
2.9. SERIAL PORT 1 ......................................................................................................................- 18 -
2.10. SERIAL PORT 2 ......................................................................................................................- 19 -
2.11. STANDARD USB INTERFACE (USB) .....................................................................................- 20 -
2.12. STANDARD ETHERNET INTERFACE (RJ45)..........................................................................- 20 -
2.13. OTHER RESERVED INTERFACES ...........................................................................................- 20 -
2.14. WIRING MODE OF INPUT SIGNALS ........................................................................................- 20 -
2.15. WIRING MODE OF OUTPUT SIGNALS.....................................................................................- 21 -
3. MOTION FUNCTION....................................................................................................... - 22 -
3.1. QUANTITATIVE DRIVE ..........................................................................................................- 22 -
3.2. CONTINUOUS DRIVE ................................................................................................................- 23 -
3.3. SPEED CURVE ..........................................................................................................................- 23 -
3.4. CONSTANT SPEED DRIVE .........................................................................................................- 23 -
3.5. LINEAR ACCELERATION/DECELERATION DRIVE ...................................................................- 23 -
3.6. LOOK-AHEAD ALGORITHM AND S CURVE ACCELERATION/DECELERATION DRIVE ..............- 24 -
3.7. POSITION MANAGEMENT ........................................................................................................- 24 -
3.8. INTERPOLATION......................................................................................................................- 25 -
3.8.1 2-6 AXES LINEAR INTERPOLATION .......................................................................................- 25 -
-3-
PMC Programmable Motion Controller
3.8.2 HARDWARE INTERPOLATION CACHE ...................................................................................- 25 -
3.9. PULSE OUTPUT MODE .............................................................................................................- 26 -
3.10. HARDWARE LIMIT SIGNAL....................................................................................................- 26 -
3.11. SERVO MOTOR CORRESPONDING SIGNAL ............................................................................- 26 -
4. PMC SYSTEM ARCHITECTURE.................................................................................. - 27 -
5. SYSTEM REGISTER AND MODBUS PROTOCOL.................................................... - 29 -
6. CONSOLE FUNCTION DESCRIPTION ....................................................................... - 34 -
7. INSTRUCTION PROGRAMMING ................................................................................ - 42 -
7.1. PROGRAMMING BASICS ........................................................................................................- 42 -
7.1.1 KEYWORD AND INSTRUCTIONS TABLE .................................................................................- 42 -
7.1.2 MOTION DIRECTION AND NAMING OF CONTROL AXIS .........................................................- 45 -
7.1.3 COORDINATE SYSTEMS OF MACHINE TOOL AND WORKPIECE.............................................- 45 -
7.1.4 MODE AND MODELESS INSTRUCTIONS .................................................................................- 49 -
7.1.5 PROGRAM STRUCTURE AND OPERATION MECHANISM ........................................................- 49 -
7.1.6 MOTION INSTRUCTION .........................................................................................................- 53 -
7.1.7 OTHER MOTION RELATED INSTRUCTIONS ...........................................................................- 56 -
7.1.8 IO OPERATION INSTRUCTION ...............................................................................................- 59 -
7.2 MATHEMATICAL OPERATION INSTRUCTION .......................................................................- 60 -
7.1.10 OTHER SYSTEM INSTRUCTIONS ..........................................................................................- 62 -
8 ONLINE DEVELOPMENT .............................................................................................. - 65 -
8.1 BASIC LIBRARY FUNCTIONS LIST............................................................................ - 65 -
8.2 DETAILS OF BASIC LIBRARY FUNCTIONS............................................................. - 67 -
8.2.1 COMMUNICATION INTERFACE CATEGORY ........................................................ - 67 -
8.2.2 DRIVER STATUS CHECK CATEGORY ..................................................................... - 69 -
8.2.3 MOTION PARAMETER SETTING CATEGORY....................................................... - 70 -
8.2.4. MOTION PARAMETER CHECK CATEGORY ......................................................... - 74 -
8.2.5. DRIVER CATEGORY..................................................................................................... - 75 -
8.2.6. STOP CATEGORY .......................................................................................................... - 81 -
8.2.7. SWITCH QUANTITY I/O CATEGORY....................................................................... - 82 -
8.2.8. SYSTEM CATEGORY .................................................................................................... - 83 -
8.3 MOTION CONTROL FUNCTION LIBRARY GUIDE................................................ - 88 -
8.3.1. ADT-8860 FUNCTION LIBRARY DESCRIPTION .................................................... - 88 -
-4-
PMC Programmable Motion Controller
8.3.2. CALLING DLL IN WINDOWS...................................................................................... - 88 -
8.3.3. CALLING IN VC.............................................................................................................. - 88 -
8.3.4. CALLING IN VB .............................................................................................................. - 89 -
8.3.5 CALLING HELP WHEN USE APPLICATION DEVELOPMENT ........................... - 89 -
8.4 MOTION CONTROL DEVELOPMENT POINTS........................................................ - 89 -
8.4.1. CARD INITIALIZATION ............................................................................................... - 89 -
8.4.2. AXIS SPEED SETTING .................................................................................................. - 90 -
8.4.3 STOP0, STOP1 SIGNAL .................................................................................................. - 90 -
8.5 MOTION CONTROL DEVELOPMENT PROGRAMMING EXAMPLE ................. - 90 -
8.5.1. VB PROGRAMMING EXAMPLE................................................................................. - 91 -
8.5.2. VC PROGRAMMING EXAMPLE ................................................................................ - 91 -
9 NETWORK SETTINGS.................................................................................................. - 113 -
9.1 NETWORK ENVIRONMENT .....................................................................................................- 113 -
9.2 CONFIGURING NETWORK PARAMETERS ................................................................................- 113 -
9.3 NETWORK CONFIGURATION RELATED INFORMATION ..........................................................- 113 -
9.4 HOST (UPPER PC) NETWORK CONFIGURATION ....................................................................- 114 -
9.5 NETWORK TOPOLOGY STRUCTURE .......................................................................................- 116 -
9.6 COMMON NETWORK FAILURES..............................................................................................- 117 -
10 SYSTEM ALARM INFO................................................................................................. - 118 -
11 PRECAUTIONS AND TROUBLESHOOTING ........................................................... - 120 -
-5-
PMC Programmable Motion Controller
1. Product Overview
ADT-8860 is a multipurpose and onsite programmable six axes motion controller (PMC --
program motion control) with PLC function. It supports offline operating mode, online real-time
operating mode and console operating mode, and is widely used in various automation control
equipment.
When the controller is running in offline mode, it used C similar language style instruction
programming and control, and is partly compatible with G code motion instructions. When it is
in online running mode, any third party software can access PMC internal system register area
through standard Modbus communication protocol to control the various function of the motion
control card and provide flexible open architecture.
-6-
PMC Programmable Motion Controller
1.2. Product specifications
Function Name Description
Look-ahead Yes
-7-
PMC Programmable Motion Controller
system and
Instruction delay function ≥1ms
pause
Coordinate system setting Support 32 workpiece coordinate systems
Program storage capacity, number Total capacity: 256MB, single file up to 1MB,
Program storage
of stored program no limit on quantity of processing files
-8-
PMC Programmable Motion Controller
1.4. Installation layout
-9-
PMC Programmable Motion Controller
2. Electrical Interface and Connection
2.1. IN1 wire No. description
(17 lines input; refer to the silkscreen on the board for the sequence)
IN1
INCOM1 18
IN0 17 18
IN1 16 17
IN2 15 16
IN3 14 15
IN4 13 14
IN5 12 13
IN6 11 12
IN7 10 11
IN8 9 10
IN9 8 9
IN10 7 8
IN11 6 7
IN12 5 6
IN13 4 5
IN14 3 4
IN15 2 3
IN16 1 2
1
3.81mm
- 11 -
PMC Programmable Motion Controller
OUT1
1
EXT_24V_GND 1
OUT0 2
OUT1 3 2
OUT2 4 3
OUT3 5 4
OUT4 6 5
OUT5 7 6
OUT6 8 7
OUT7 9 8
OUT8 10 9
OUT9 11 10
OUT10 12 11
OUT11 13 12
OUT12 14 13
OUT13 15 14
OUT14 16 15
OUT15 17 16
OUT16 18 17
OUT17 19 18
20 19
EXT_24V 20
3.81mm
Wire
Name Function
No.
1 24VGND Output common terminal
2 OUT0
3 OUT1
4 OUT2
5 OUT3
6 OUT4
7 OUT5
8 OUT6
9 OUT7
10 OUT8
Output 0--17
11 OUT9
12 OUT10
13 OUT11
14 OUT12
15 OUT13
16 OUT14
17 OUT15
18 OUT16
19 OUT17
Load +24 power input terminal (require
20 +24V
external +12~ +24V power supply)
(Two lines analog voltage output; refer to the silkscreen on the board for the
sequence)
- 12 -
PMC Programmable Motion Controller
JDA1
1
DAGND DAOUT0 1
2
3 2
DAGND DAOUT1 3
4
4
3.81mm
2.5. X1, Y1, Z1, A1, B1, C1 drive control interface wire No. description
JCP1
PUCOM 1
XPU+
EXT_VCCA 9
2
XPU-
10
+24V
3
XDR+
24VGND 11
4
XDR-
12
XECA+
5
XALARM
13
XECA-
6
14 OUT18
XECB+
7
XECZ+
15
XECB-
8
XECZ-
DB15
15脚母头(与车铣床相同)
- 13 -
PMC Programmable Motion Controller
4 nDR- Direction signal -
10 EXT_24V
Provide 24V power supply externally
11 EXT_24V_GND
- 14 -
PMC Programmable Motion Controller
- 15 -
PMC Programmable Motion Controller
connect together the anodes of optical coupling. In this case, please connect the wires according
to the figure below, and do not connect PU+ and DR+ together, or else pulse interface will be
damaged.
CNC 控制器脉冲接口 CNC controller pulse interface 步进电机驱动器 Step motor drive
电源 Power supply 步进电机 Step motor
Wiring diagram of step motor drive with common anode input
- 17 -
PMC Programmable Motion Controller
Wire No. Name Function
1 EXT_24V_GND Power ground
2 OUT24
3 OUT25
4 OUT26
5 OUT27
6 OUT28
7 OUT29
8 OUT30
9 OUT31
Universal output 0--17
10 OUT32
11 OUT33
12 OUT34
13 OUT35
14 OUT36
15 OUT37
16 OUT38
17 OUT39
+24 power input terminal (require
18 EXT_24V
external switching power supply)
- 18 -
PMC Programmable Motion Controller
JCP6
1
6
TX1 2
7
RX1 3
8
VDD50
4
9
5
DB9 母头
2.10.Serial port 2
Serial port 2 is used for R232-based Modbus protocol communication at present
COM2
1
6 10
PE
TX1 2
7
D8 RX1 3
VDD5V 1 2 8
4
SS14 9
5
DB9弯脚母座
DB9 弯脚母座 DB9 bent pin female socket
- 19 -
PMC Programmable Motion Controller
5 GND Power ground
6 NC Null
7 VDD5V Provide 5V power supply externally
8 VDD5V Provide 5V power supply externally
9 NC Null
When the host is connected to the control card directly, please use crossover cable, i.e. use 568B
category cable on one end and use 568A category cable on the other end.
When the host is connected to the control card through router, use 568A category cable on both
ends.
Connect INCOM terminal to positive end of external power supply, and connect the input
signals to the pins of respective terminals.
In which, the common end of IN0—IN16 is INCOM1; the common end of IN17—IN33 is
INCOM2; please connect the common end to +24V power supply. The input points are low
voltage level valid. The current of single input shouldn’t exceed 15mA and shouldn’t be lower
than 5mA.
- 20 -
PMC Programmable Motion Controller
2.15.Wiring mode of output signals
The switch quantity output of this control system is collector open circuit output. The common
terminal is the first pin of JC1 and the GND of load power supply. Please connect pin-20 of JC1 to
+24V power supply. The output point is low voltage level valid. Please connect the load between
+24V and output point. The internal output circuit has relatively complete protection measures for
over-current, overvoltage, short circuit, overheating and freewheeling; however, if inductive load is
connected, e.g. relay, please connect freewheeling diodes on both ends of the relay coil, as shown
below:
EXTCOM 或 DOUTnGND
EXTCOM or DOUTnGND
Note: The recommended voltage is lower than 24V and shouldn’t exceed 30V. Do not short
connect the anode and cathode, and do not short circuit the load, or else it will damage the
module.
- 21 -
PMC Programmable Motion Controller
3. Motion Function
3.1. Quantitative drive
- 22 -
PMC Programmable Motion Controller
3.2. Continuous drive
During continuous driving, output driving pulse continuously until high level stop command or
external stop signal is valid. Use this function for home search and motor rotation control.
速度 Speed
初始速度 Start speed
驱动速度 Driving speed
定速驱动 Constant speed driving
时间 Time
- 23 -
PMC
速度Programmable
Speed Motion Controller
驱动速度 Driving speed
加速度 Acceleration
减速度 Deceleration
初始速度 Start speed
输出脉冲少达不到驱动速度
Output pulse is low and can’t reach driving speed
直线加减速驱动
Linear acceleration/deceleration driving
时间 Time
During continuous track processing, the user can enable the look-ahead algorithm integrated in
PMC. This algorithm can check the corner size or ending of the processing track ahead, and adjust
the feed speed automatically to avoid the system having frequent start-stop at the connection of
segments. It can significantly improve the processing efficiency, smooth processing speed, prevent
processing impact and lower user’s workload on processing speed control. In this mode, the user
also can select linear or S curve acceleration/deceleration mode.
- 24 -
PMC Programmable Motion Controller
3.8. Interpolation
短袖 Short axis
直线插补位置精确度
Linear interpolation position precision
长袖 Long axis
长袖 Long axis
长袖 Short axis
终点(X:20,Y:9)驱动脉冲输出例子
Example of end point (X: 20, Y: 9) driving pulse output
As shown in the picture above, the position precision of specified straight line is ±0.5LSB in the
entire interpolation range. Above picture also has an example of driving pulse output of linear
interpolation. In the set end point value, the axis with maximum absolute value is long axis, which
always outputs pulse during interpolation driving, and others are short axes. According to the result
of linear interpolation arithmetic, sometimes output pulse, and sometimes do not output pulse.
- 25 -
PMC Programmable Motion Controller
The hardware interpolation cache can effectively prevent the pause between two interpolations, and
have better effect even if the computer is very slow.
Driving output pulse has the following two pulse output modes below. When independent two
pulses mode is used, PU/CW outputs driving pulse in positive driving, and DR/CCW outputs
driving pulse in negative driving. When one pulse mode is used, PU/CW outputs driving pulse and
DR/CCW outputs direction signal.
Hardware limit signal (LMT+, LMT-) is the input signal that limits positive and negative driving
pulse. When the logical voltage level and limit signal are valid, the motion of the axis will be
stopped immediately.
The input signals connected to servo motor drive are in-position signal (INPOS) and alarm signal
(ALARM). The valid/invalid and logical level of every signal can be set.
INPOS input signal corresponds to the servo motor positioning complete signal. If the mode is set
to valid, wait INPOS input signal valid after one driving ends, the input signal is valid, the driving
state returns and ends. ALARM input signal receives alarm signal from servo motor drive. If it is
set to valid, it monitors ALARM input signal, and stops driving immediately if the signal is valid.
These input signals used for servo motor drive can be read with universal I/O function. Universal
output signals can be used for bias counter clear, alarm reset, servo on, etc.
- 26 -
PMC Programmable Motion Controller
4. PMC System Architecture
ADT-8860 is a multipurpose and onsite programmable six axes motion controller (PMC --
program motion control) with PLC function. It supports offline operating mode, online real-time
operating mode and console operating mode, and is widely used in various automation control
equipment.
Offline operating mode
When the controller is running in offline mode, it used C similar language style instruction
programming and control, and is partly compatible with G code motion instructions. The
programming is simple, flexible, support multi-task mode and can achieve complicated
calculation and control.
Online operating mode
When it is in online running mode, any third party software can access PMC internal system
register area through standard Modbus communication protocol to control the various function
of the motion control card and provide flexible open architecture.
Console operating mode
In the process of application development, the user can control the whole process of PMC
through serial communication based console and get desired system info, which is helpful to
program testing.
The framework diagram of PMC system follows:
- 27 -
PMC Programmable Motion Controller
different applications according to the specific requirement of product process, and then download
to PMC with development software tool to test and run.
The instruction function provided by the PMC system includes most of the operation expressions,
condition execution, cycle, goto, subroutine call, return and other commonly used program
execution structure in C language, and also increases motion control related instructions and
function according to the technical characteristics of motion control industry, e.g. quick shift
instruction, linear interpolation instruction, arc/helix interpolation instruction, read/write IO
instruction, logic axis mapping, coordinate system conversion, look-ahead and smoothing, pause
and resume, software/hardware limit, motion status query, motion conflict treatment mechanism,
delay waiting, auto-home, system configuration instructions and other advanced functions, so that
the user get rid of hardware design and low-level driver design when developing own control
system, and only needs to write related control programs according to process requirement. It will
help the customers to simplify system design, shorten system development period, reduce
development cost, and improve system maintenance performance.
The user programs written with C script language and instruction function provided by PMC can be
classified into startup programs, IO scanning programs, PLC programs, and motion control
programs according to the function. The programs may cross over and aren’t classified strictly. The
crossover of multiple or different types of user programs can achieve complicated system function.
In addition, the simultaneous running of multi-task can help users to save required controller
quantity in large control system.
Most instructions provided in PMC can be entered and executed directly in serial port console.
Console is a command line based human-computer interaction mode, and any standard serial I/O
software can be used as running interface of the console, regardless Windows, Linux or any other
operating systems. Through the console, the user can fully operate and monitor the system status in
the process of program development, improving the system testing efficiency significantly.
PMC system parameter area and open characteristics
PMC also provides various register areas for system configuration, function setting and calculation.
The console can access these register areas directly, and these registers are open to third party
software through Modbus communication protocol. PMC supports serial R232 based and Ethernet
based Modbus protocols at present, both of which support RTU and ASCII transmission mode,
while the Ethernet based Modbus protocol also supports TCP/IP or UTP protocol based mode. By
opening these register areas of special functions, PMC can be controlled by other controllers or
software. The PMC development kit CD provided by Adtech contains Modbus communication
protocol based VC and VB upper computer development kit, combines the functions based on
Modbus register operation, and re-package into API functions that can be called in VC and VB to
facilitate the online control and secondary development for users used to PC based control. The user
also can customize and package advanced API functions through most basic Modbus protocol
register operation based low-level function to achieve more complicated function control. Similarly,
the user also can use Modbus communication protocol supported and configuration software based
touch screen controller to control PMC online. Before this, these touch screen controllers are widely
used in PLC controller industry. Through opening these register areas, PMC achieves more flexible
system expansion characteristics, realizes controller network group consisting of several PMC
through Ethernet based Modbus communication protocol, and expands the application of PMC in
plant-level controller network system.
- 28 -
PMC Programmable Motion Controller
5. System Register and MODBUS Protocol
PMC register introduction
ATD-8860 PMC motion controller provides several register areas of special functions, used to
configure basic system parameters or participate in the calculation and control process. Most
register areas can use third party software or controller to access through Modbus
communication protocol, and ensure the perfect openness and scalability of the system.
The system registers consist of I register area, E register area, S register area, C register area, D
register area, F register area, and L register area, of which I, E, S, C, D, and F register areas are
global variables; L register area is internal variable of user program, and can’t be accessed by
external program. The register areas are described below.
I register area: input (global)
32bit unsigned integer data. The addressing range of the register is I0-I1023. This register area
also supports bit addressing and the addressing range is 0-32767, of which the lower 0-79 bits
corresponds to the real physical input IO of the controller, and other higher addressing bits are
used as virtual input IO in the program. The word access function code of I register area in
Modbus is x04 (read multiple input registers), the address range is 0-2046, and two words
(16bit) are combined into one unsigned integer (32bit); Modbus input point access function
code is x02 (read multiple input points state), and the address range is 0—32767. I register area
is usually used to process signal input and participate in the calculation or control process.
E register area: output (global)
32bit unsigned integer data. The addressing range of the register is E0-E8191. This register area
also supports bit addressing and the addressing range is 0-65535, of which the lower 0-23 bits
corresponds to the real physical input IO of the controller, and other higher addressing bits are
used as common bit registers in the program. The word access function code of E register area
in Modbus is x03 (read holding register), x10 (write multiple holding registers), the address
range is 0-16382, and two words (16bit) are combined into one unsigned integer (32bit);
Modbus output point access function code is x01 (read multiple output points state), x05(write
single output point state) and x0f(read multiple output points state), and the address range is
0—32767. E register area is usually used to process signal input and participate in the
calculation or control process.
S register area: signed integer (global)
32bit signed integer data. The addressing range of the register is S0-S8191, and doesn’t support
bit addressing. The word access function code of S register area in Modbus is x03 (read holding
register), x10 (write multiple holding registers), the address range is 16384-32766, and two
words (16bit) are combined into one unsigned integer (32bit). S register area is usually used to
process calculation or control process.
C register area: system configuration (global)
32bit unsigned integer data. The addressing range of the register is C0-C2047, and doesn’t
support bit addressing. The word access function code of C register area in Modbus is x03 (read
holding register), x10 (write multiple holding registers), the address range is 32768-36862, and
two words (16bit) are combined into one unsigned integer (32bit); C register area is usually
used to configure system parameters, e.g. serial port configuration info, network interface info,
- 29 -
PMC Programmable Motion Controller
startup options, system running info, special read/write area, etc. Other registers are reserved.
The registers in C register area are described below:
C0: serial port 0 baud rate, 9600/14400/19200/38400/56000/57600/115200 optional, default:
115200
C1: serial port 0 data bit, fixed at 8 (read-only)
C2: serial port 0 stop bit, 1 bit/2-bit optional, default: 1
C3: serial port 0 checksum mode, 0=None/1=Odd/2=Even optional, default: 0
C4: serial port 0, 0 – hide testing info, 1 – show program execution process, 2 — show testing
info
C5-C9: reserved
C10: card No. address, 0-127, default: 0
C11: serial port 1 baud rate, 9600/14400/19200/38400/56000/57600/115200 optional, default:
115200
C12: serial port 1 data bit, fixed at 8 (read-only)
C13: serial port 1 stop bit, 1 bit/2-bit optional, for Modbus-RTU protocol, select 2
C14: serial port 1 checksum mode, 0=None/1=Odd/2=Even optional, default: 0
C15-C19: reserved for serial port 3
C20-C39: reserved
C40: IP address, default: 192.168.0.123
C41: IP address mask, default: 255.255.255.0
C42: gateway IP address, default: 192.168.0.1
C43-C44: NIC physical address, default: 00-AB-CD-00-12-03
C45: network communication port No., default: registered port No. of Modbus: 502
C46-C49 reserved
C50-C59: second network interface parameter area, reserved
C60: quantity of current used coordinate systems, (read-only)
C61: mask of used coordinate system No., (read-only)
C62: quantity of currently running programs, (read-only)
C63: mask of currently running program No., (read-only)
C64: quantity of currently opened programs, (read-only)
C65: mask of currently opened program No., (read-only)
C66: No. of currently running program
C67-C69 reserved
C70: MODBUS IO read/write mode, 0 - read/write IO cache, 1 - read/write real IO and refresh
cache
C71: load specified program after startup, 0 - No, 1 - Yes
C72: run specified program after startup, 0 - No, 1 - Yes
C73-C76 specify startup file name, 8+3 file name format, default file name is “START.BAT”
C77: write 1 — load and run the startup file
C79: write 1 — load system parameters from power failure memory, write 2 -- load system
parameters from file system,
C80: write 1 — save system parameters in power failure memory, write 2 -- save system
parameters in file system
C96: alarm state word 1: No. of task that has error
C97: alarm state word 2: position of error code
C98: alarm state word 3: error code
C99-C1023: reserved
- 30 -
PMC Programmable Motion Controller
C1024-C1535: Modbus special write function area, used to realize special function instructions
that require writing multiple registers of discrete address simultaneously and improve the
instruction efficiency
C1536-C2013: Modbus special read function area, used to realize special function instructions
that require reading multiple registers of discrete address simultaneously and improve the
instruction efficiency
- 31 -
PMC Programmable Motion Controller
deceleration segments; 2—implement speed forward smoothing for continuous motion
command according to its motion track; default: 0
D40: Feed starting speed (dimension unit/unit time)
D41: Feed operating speed (dimension unit/unit time)
D42: Maximum feed speed (dimension unit/unit time)
D43-D45: reserved
D46: Linear acceleration (dimension unit/unit time^2)
D47: S variable acceleration time (ms)
D48: S variable acceleration (read-only); this register is calculated according to D47
and D48 (dimension unit/unit time^2)
Dx00: reserved
Dx01: Axis pulses per rotation (pulse/rotation)
Dx02: Encoder lines (line/rotation)
Dx03: Axis pulse equivalent – numerator (pulse)
Dx04: Axis pulse equivalent – denominator (dimension unit)
Dx05: Axis home starting speed (dimension unit/unit time)
Dx06: Axis home maximum speed (dimension unit/unit time)
Dx07: Axis home scanning speed (dimension unit/unit time)
Dx08-Dx10: reserved
Dx11: Axis home acceleration (dimension unit/unit time^2)
Dx12: reserved
Dx13: Axis home maximum stroke (dimension unit)
Dx14: Axis home scanning stroke (dimension unit)
Dx15: Axis starting operating speed (dimension unit/unit time)
Dx16: Axis maximum operating speed (dimension unit/unit time)
Dx17: Axis starting operating speed (rotation/unit time)
Dx18: Axis maximum operating speed (rotation/unit time)
Dx19: Linear acceleration (dimension unit/unit time^2)
Dx20-DX24: reserved
Dx25: Position error limit – alarm (pulse)
Dx26-Dx28: reserved
Dx29: Deceleration time of abnormal stop (ms)
Dx30: Hardware positive/negative limit signal setting
■ 2bit—limit signal level, 0: low, 1: high
■ 1bit—0: negative limit valid, 1: negative limit invalid
■ 0bit—0: positive limit valid, 1: positive limit invalid
Dx31: Hardware home signal; stop immediately if effective, or else the software executes
■ 1bit— set effective signal lvel, 0: low, 1: high
■ 0bit—0: Hardware home signal invalid, 1: Hardware home signal valid
Dx32: Hardware Z phase signal valid; if valid, stop when encounters Z phase signal in home
scanning process;
■ 1bit— set effective level of hardware Z phase signal, 0: low, 1: high
■ 0bit—0: Hardware Z phase signal invalid, 1: Hardware Z phase signal valid
Dx33: Home step
- 32 -
PMC Programmable Motion Controller
Dx34: If the logical position of the axis is near zero point or home, and is executing home
motion, the axis first moves the millimeters forward at half speed
Dx35: When the axis is several unit distance from the home of logical position and is
executing home motion, the axis first moves the distance set by Dx34 forward at half
speed, and then executes the home motion.
Dx36: Pulse mode setting
■ 2bit- pulse mode setting, 0: pulse + pulse, 1: pulse + direction
■ 1bit- pulse logic setting, 0: positive logic pulse, 1: negative logic pulse
■ 0bit- pulse direction logic setting, 0: direction outputs positive logic, 1: direction
outputs negative logic
Dx37: reserved
Dx38: Get axis driven state (read-only), 0 = no drive, 1 = driving
Dx39-Dx46: reserved
Dx47: Get axis feed speed
Dx48: Get axis logical position of machine tool coordinate system (pulse)
Dx49: Get axis actual position of machine tool coordinate system (line)
Dx50: Get or set the axis logical position of the coordinate system specified in D4 register,
and the value of Dx51 register will be changed synchronously when setting this
register. Multiple coordinate systems share this register address in virtual mode
Dx51: Get or set the axis offset position of the coordinate system specified in D4 register, and
the value of Dx50 register will be changed synchronously when setting this register.
Multiple coordinate systems share this register address in virtual mode
F register area: double-precision floating point (global)
64bit double-precision floating point data. The addressing range of the register is F0-F4095,
and doesn’t support bit addressing. The word access function code of F register area in Modbus
is x03 (read holding register), x10 (write multiple holding registers), the address range is
40960-49148, and four words (16bit) are combined into one double-precision floating point
(64bit). F register area is usually used to process calculation or control process.
L register area: internal variables (global)
32bit signed integer data, and doesn’t support bit addressing. The addressing range of the
register is L0-L1023, and every task the register independently. L register area can’t be
accessed in Modbus, because it is private register area of every task. L register area is usually
used to process calculation or control process.
- 33 -
PMC Programmable Motion Controller
6. Console Function Description
Console is a serial communication and command line based basic human-computer interaction
mode. The consoled bases on serial RS232 communication media and can be run in any serial
testing software, e.g. the Hyper Terminal in Windows. Through the console, the user can fully
operate and monitor the system status in the process of program development, improving the
system testing efficiency significantly. The SSCOM32.EXE serial testing tool provided in this
system CD even can be used in Linux.
The following screenshots describe how to create Hyper Terminal in windows and set the
parameters.
- 34 -
PMC Programmable Motion Controller
- 35 -
PMC Programmable Motion Controller
In the console, the user can get desired system info or operate the control system directly by
entering related commands, e.g. read/write variables in every register area of the system,
load/start/stop programs, view system and running info, set system operating mode, etc. It even
supports common mathematical expressions and instruction help info, and the powerful console
function is helpful to user in testing program and controlling system status.
After executing TASK command in above picture, the interface follows:
- 36 -
PMC Programmable Motion Controller
At this moment, the system isn’t running any user program, and then we will execute LOAD 31
“START.BAT”; RUN 31;
This command will load and run a user program named “START.BAT”, the No. of which is 31.
This program is actually text file program written in C similar language style script supported
by PMC controller. The function of this program is to load and run other programs in batch
written by the user. Now, we will execute this command and then use the TASK command to
view system operating status.
- 37 -
PMC Programmable Motion Controller
- 38 -
PMC Programmable Motion Controller
PMC console supports commands with various functions. If the user doesn’t know the function
and writing of instructions, please use HELP command to get the information of all commands
and keywords in the console, as shown below:
- 39 -
PMC Programmable Motion Controller
可在控制台中使用的控制类关键字,此类关键字同样可以在用户程序中使用
Control keywords allowed in the console; these keywords also can be used in user program
命令样例 Command example
获取关键字帮助信息 Get help info on keywords
系统复位重启 Reset and restart the system
载入客户程序文件 MOTION.NC 到指定任务 2 的程序缓存空间中
Load client program file MOTION.NC into the program cache of specified task 2
运行已经载入程序的 2 号任务 Run the #2 task loaded in the program
终止正在运行的 2 号任务程序,但程序缓存继续保留 Stop running #2 task program, but the program cache is retained
释放已经停止的 2 号任务 Release the program cache of stopped #2 task
终止正在运行的 2 号任务程序,程序缓存将同时被释放 Stop running #2 task program, and the program cache is also released
指定开机自动执行的程序文件 Specify the startup program file
指定开机自动执行程序的运行方式为自动载入、自动运行
Specify the running mode of the startup program as auto-load or auto-run
连接控制器中的虚拟 U 盘 Connect to the virtual USB disk in the controller
关闭已连接的虚拟 U 盘 Close connected virtual USB disk
立即停止运动,同时停止系统中指定的任务,可缩写为 ST
Stop motion immediately, and also stop the specified task in the system, can abbreviate to ST
暂停正在运行的运动,可缩写为 PAPause running motion, can abbreviate to PA
恢复被暂停的运动,可缩写为 REResume the motion, can abbreviate to RE
指定某个任务在系统发生错误或紧急停止时终止程序运行
Specify the task to stop program running when the system has error or stops in emergency
- 40 -
PMC Programmable Motion Controller
从铁电或 rom 中载入系统配置参数 Load system configuration parameters from ferroelectric RAM or ROM
保存系统配置参数到铁电或 romSave system configuration parameters in ferroelectric RAM or ROM
恢复默认系统参数 Restore default system parameters
设置系统速度时间单位—0 为秒、1 为分钟 Set system speed time unit: 0: second, 1: minute
新建坐标系 1 Create new coordinate system 1
删除坐标系 1 Delete coordinate system 1
显示 1 号轴配置信息 Show the configuration info of #1 axis
为寄存器 D36 赋值 Evaluate register D36
将逻辑轴 X 配给物理轴 1,同时相对机床坐标偏移 10 个脉冲
Assign logic axis X to physical axis 1, and the relative machine tool coordinate system offsets 10 pulses
查看所有坐标系的参数 View the parameters of all coordinate systems
将坐标系 0 设为当前任务的当前坐标系,并显示当前坐标系信息
Set coordinate system 0 as the current coordinate system of current task, and show the info of current coordinate system
将当前位置作为当前坐标系的原点 Set current position as the home of current coordinate system
设置当前坐标系为增量模式或绝对模式 Set current coordinate system to increment mode or absolute mode
设置当前坐标系为增量模式 Set current coordinate system to increment mode
设置当前坐标系为绝对模式 Set current coordinate system to absolute mode
设置当前坐标系的工作平面为 XY 平面 Set working plane of current coordinate system as XY plane
设置当前坐标系的工作平面为 XZ 平面 Set working plane of current coordinate system as XZ plane
设置当前坐标系的工作平面为 YZ 平面 Set working plane of current coordinate system as YZ plane
查看所有任务的运行状态 View the running status of all tasks
将任务 1 设为当前任务 Set task 1 as current task
设置速度模式,分别为单段加减速、匀速、速度前瞻平滑
Set the speed mode, including single section acceleration/deceleration, constant, look-ahead, smoothing
三轴联合点位运动 Three axes joint point motion
三轴插补运动 Three axes interpolation motion
顺时针插补运动 Clockwise interpolation motion
顺时针插补运动 Clockwise interpolation motion
三轴联动 Three axes linkage
三轴插补运动 Three axes interpolation motion
顺时针插补运动 Clockwise interpolation motion
逆时针插补运动 Counterclockwise interpolation motion
参看当前坐标系的当前位置 View current position of current coordinate system
参看机床坐标系的当前位置和反馈位置 View current position and feedback position of machine tool coordinate system
将指定物理轴 1 的逻辑位置设为 0 Set the logic position of specified physical axis 1 to 0
将指定物理轴 1 的电机反馈位置设为 0 Set the motor feedback position of specified physical axis 1 to 0
将指定物理轴 1、2、5 的逻辑位置和电机反馈位置清除为 0
Clear the logic position and motor feedback position of specified physical axis 1, 2, 5
将所有物理轴的逻辑位置和电机反馈位置清除为 0 Clear the logic position and motor feedback position of all physical axes
All console commands and detailed function of program keywords are described in Instruction
Programming.
- 41 -
PMC Programmable Motion Controller
7. Instruction Programming
7.1. Programming basics
In the programming instruction system of this PMC, all instructions and keywords are in capitalized
letters, the keywords are separated with space or tab, the instructions are ended with ‘;’ or newline
symbol, character strings are contained with “”, and program files are named in 8+3 short file name.
Use {...} as the block boundary, and support using () to nest expressions. If the program has
non-defined instructions, the program will report error automatically when executing.
- 43 -
PMC Programmable Motion Controller
Evaluate tangent function, input unit is
TAN Yes TAN(30)
circumferential angle
Evaluate arcsine function, return unit is
ASIN Yes ASIN(0.5)
circumferential angle
Evaluate arc cosine function, return unit is
ACOS Yes ACOS(0.5)
circumferential angle
Evaluate arc tangent function, input unit is
ATAN Yes ATAN(0.5)
circumferential angle
SQRT Yes SQRT(2) Evaluate square root function
Evaluate the exponential function with natural
EXP Yes EXP(2)
number e as the base
Evaluate the logarithmic function with natural
LN Yes LN(2)
number e as the base
Evaluate the logarithmic function with 10 as the
LOG Yes LOG(2)
base
ABS Yes ABS(-123) Evaluate absolute value function
&& Yes 1&&2 Logical AND operator
|| Yes 1||2 Logical OR operator
^^ Yes 1^^2 Logical XOR operator
! Yes !2 Logical NOT operator
& Yes 1&2 Bitwise AND operator
| Yes 1|2 Bitwise OR operator
^ Yes 1^2 Bitwise XOR operator
~ Yes ~1 Bitwise negation operator
1+2 Addition arithmetic operator
+ Yes
+ Positive value symbol
3-2 Subtraction arithmetic operator
- Yes
-2 Negative value symbol
* Yes 2*3 Multiplication arithmetic operator
/ Yes 3/2 Division arithmetic operator
% Yes 3%2 Remainder operator
IF No IF(IN(0)) {…} Check whether the expression condition is true
If the IF expression isn’t true, execute the
ELSE No ELSE {…}
sentence after ELSE
ELSE IF No ELSE IF {…} ELSE…IF condition nesting
WHILE No WHILE(1) {…} Cycling condition determination
DO-WHILE No DO{…}WHILE(…) DO-WHILE loop structure
BREAK No BREAK Out of the WHILE loop
GOTO No GOTO N1111 Jump to N1111 program label unconditionally
CALL No CALL O123 Call subroutine O123
RETURN No RETURN Return from subroutine
Instruction end symbol; the function is same to
; Yes ; Enter; generally used to differentiate multiple
instructions in same line of code
(…) Yes (3*(2+1)-4)/3 Expression boundary symbol
{…} No {…} Block boundary symbol
Program note symbol, ignoring the later content
// No //……
of the program
- 44 -
PMC Programmable Motion Controller
7.1.2 Motion direction and naming of control axis
+Z
+Y
+X
台
作
工
工件 X-
Y
底座
This system can control the quick motion of random six axes, feed interpolation of random
one, two or three axes, and first four, five or six axes interpolation.
Axis direction definition uses Cartesian coordinate system, as follows (facing to the machine
tool):
Z: The upward/downward motion of the tool relative to the workpiece is Z axis motion;
the upward motion is Z axis positive motion, and the downward motion is Z axis
negative motion.
X: The leftward/rightward motion of the tool relative to the workpiece is X axis motion;
the leftward motion is X axis negative motion, and the rightward motion is X axis
positive motion.
Y: The frontward/backward motion of the tool relative to the workpiece is Y axis motion;
the frontward motion is Y axis positive motion, and the backward motion is Y axis
negative motion.
A,B,C: They are usually used as rotation coordinate axes, as well as other auxiliary motion.
As rotation coordinate axis, the positive direction is the positive direction of axis X, Y,
Z, and is determined according to the forward direction of right hand thread.
Note: The motion of axis X, Y, Z, A, B, C in this Manual is always the motion of tool relative
to the workpiece, i.e. suppose that the workpiece coordinate system has been set.
- 45 -
PMC Programmable Motion Controller
1) Machine tool coordinate system
The machine tool coordinate system is the fixed coordinate system of the machine tool. The
coordinate system is established through the operation of returning to reference point when NC
is electrified every time. The default mapping relationship between logic axes and physical axes
of the machine tool coordinate system is #1:=X, #2:=Y, #3:=Z, #4:=A, #5:=B, #6:=C; COORD
0 instruction is used to select machine tool coordinate system.
+Y +Y +Y
+X +X +X
+X
机械参考点
:工件坐标系 Workpiece coordinate system :机械参考点 Mechanical reference point
New coordinate system instruction
Format: NEW_COORD n
N: workpiece coordinate system code 0-31; new coordinates are consistent with machine
tool coordinate system by default. The user can set the offset of every workpiece coordinate
system relative to machine tool coordinate system and mapping of logic axes through axis
configuration instruction.
Axis configuration instruction
Format: #n:=x+n
The first parameter n is specified physical axis, the range of which is 1-6
The second parameter x is specified logic axis, the range of which is X, Y, Z, A, B, C
The third parameter n indicates the offset of current axis in current workpiece coordinate
system relative to machine tool coordinate system.
A typical example of coordinate system setting instruction is #1:=X+10, i.e. logic axis X is
adapted to #1 physical axis, and this axis offsets +10 dimension units relative to machine
tool coordinate system.
Select current coordinate system instruction
Format: COORD n
n is the specified workpiece coordinate system
Every task can use specified coordinate system as current coordinate system of the task
through COORD n instruction. If this coordinate system isn’t established, the system reports
error automatically. Current motion must be stopped before changing current coordinate
system.
Delete coordinate system instruction
- 47 -
PMC Programmable Motion Controller
Format: DEL_COORD n
n is the specified workpiece coordinate system
The user can use DEL_COORD n instruction to delete a redundant workpiece coordinate
system and trim related statistics info.
View system coordinates info instruction
Format: COORD no parameter
This command can be used to view the configuration info of all coordinate systems in the
system in the console, as shown below
- 48 -
PMC Programmable Motion Controller
3) By setting the value of register D36, 0- increment mode coordinates, 1- absolute mode
coordinates
Example diagram
Y
终 点
绝 对 值 指 令 编 程 :
1 2 0 .0 G 9 0 X 2 0 . Y 1 2 0 .;
增 量 值 指 令 编 程 :
G 9 1 X -7 0 . Y 8 0 .;
4 0 .0
起 点
2 0 .0 9 0 .0
The mode properties of all instructions can be viewed 7.1.1 Instruction Table.
When PMC is electrified, the system will check C71 and C72 register parameters
automatically. If the two parameter values are valid, load and execute the startup program
- 50 -
PMC Programmable Motion Controller
files specified in C73-C76. The function of this program is to load or run other applications
written by the user, and make the system establish working state. C71 and C72 parameters
of PMC are 1 by default. The system loads and runs default startup program “START.BAT”
automatically, the program No. is 31, and the priority is the lowest. The user can modify
startup mode through command console, and use SAVE_SYS 1/2/5/6/7 to save system
parameters.
Generally, the startup program runs only once and exits automatically, but the program cache
will be always valid. If the user wants to destruct useless program cache, it can be realized in
console or other programs with CLOSE 31; before destructing a program cache, this
program should be stopped first.
PLC program usually achieves IO motion control through scanning the state of IO or register
variables. A typical demonstration code of the PLC program follows:
//Flash LED demonstration program, 8 output IO output high voltage level in turn, at
200ms interval
#E100=0 // initialization parameter
#E101=0
WHILE(1) // the program has been running and never exits
{
IF(IN(10)) //if input point 10 is in high voltage level, execute flash LED
{
IF(#E100==0) //check variable value of #E100 to initialize state of flash
LED
{
OUT(0,0)
OUT(1,0)
OUT(2,0)
OUT(3,0)
OUT(4,0)
OUT(5,0)
OUT(6,0)
OUT(7,0)
- 51 -
PMC Programmable Motion Controller
#E100=1 // flash LED has initialized the label
#E101=0 // flash LED S/N
}
OUT(#E101,0) // clear last flash LED state
IF(#E101>=7) // check whether flash LED arrives at boundary
#E101=0
ELSE
#E101=#E101+1 // prepare this action for the flash LED
OUT(#E101,1) // this flash LED outputs high voltage level
}ELSE
{
#E100=0
#E101=0
}
DELAY(200) //delay 200ms
}
2) Subroutine
PMC subroutines are the modular function codes written in main programs. Subroutine name
starts with character O, followed by four-digit value, e.g. O1234. Subroutine No. must start
from the top line. The program No. is the subroutine entry address used to call subroutine. The
program No. can be in any value, but can’t repeat.
When PMC is executing main program and encounters subroutine calling instruction (CALL),
PMC will call and execute the subroutine directly, and return to previous program when the
subroutine executes the return instruction (RETURN). To send parameters to subroutine or
return, please use the local variables in L register area to prevent the variable values modified
by other tasks.
When a main program calls a subroutine, this subroutine can nest and call itself or another
subroutine, and allow up to 100 levels of subroutine nesting.
A typical subroutine calling demonstration code follows:
#E100=0 // initialization parameter
CALL O123 // call subroutine O123
EXIT // exit main program
- 52 -
PMC Programmable Motion Controller
#E100=#E100+1 // accumulated calling times
IF(#E100<10)
CALL O123 // nest calling self
RETURN // return to previous program
When the processing program needs to run same track for several times, please edit this track
into subroutine and save in the program storage of the machine tool, and this subroutine can
be called if this track should be executed in the program every time.
- 53 -
PMC Programmable Motion Controller
Cutting feeding instruction includes linear interpolation and arc interpolation. The axes in feed
have interpolation relationship, and their motion combination is cutting feeding motion. The
speed control of cutting feeding has three modes, which is determined by the content of
register D39. When D39 is 0 or 1, the cutting feeding speed is specified by the F address in the
instruction, and the default unit is mm/min. In processing program, F is a mode value, i.e.
originally programmed F value is always valid before new F value is specified. When PMC
system is just electrified, the F value is specified by register D41. The maximum value of F is
controlled by register D42. If the programmed F value is larger than this value, the actual
feeding cutting speed will be maintained at this value.
■ When D39 is 0, every motion has independent acceleration/deceleration process, next
interpolation instruction will wait previous instruction to complete and then execute; the
system software will analyze and execute interpolation instructions one by one.
■ When D39 is 1, the interpolation will execute constant speed motion; the system
software will save the analyzed interpolator instructions in hardware interpolation cache
and the hardware interpolator executes automatically; the system software won’t wait
previous instruction to complete and execute later interpolation instructions directly.
■ When D39 is 2, the system will use look-ahead arithmetic, adjust feed speed
automatically according to feed track and ending, and the maximum speed is determined
by register D41. When executing look-ahead arithmetic, the system will analyze track
segment of specified quantity (in register D7) in advance, and the motion starts when
reaching specified quantity or encountering WAIT instruction or reaching program end.
Note: at present, look-ahead arithmetic only supports random three axes feed mode; if more
than three axes are in motion, the system will report error and stop.
Linear interpolation instruction
Format: LINE/G01 X_Y_Z_A_B_C_F_
LINE and G01: the two instruction keywords have exactly the same function.
X_Y_Z_A_B_C: coordinate values; determine whether absolute position value or increment
position value according to the mode value of current coordinate system
F: instruction following speed
Function: LINE/G01 instruction makes current motion mode become linear interpolation mode,
the tool moves to specified position to current position, its track is a straight line, F- specifies
the speed of the tool in linear motion, and the unit is mm/min.
LINE/G01 program example:
Suppose that the position of current tool is X-50. Y-75., and the block follows
N1 G01 X150. Y25. F100;
N2 X50. Y75.;
The tool will run the track shown in the figure below.
- 54 -
PMC Programmable Motion Controller
In X--Z plane
G18 {G02/G03} X__ Z__ {(I__ K__)/R__} F__
In Y--Z plane
G19 {G02/G03} Y__ Z__ {(J__ K__)/R__} F__
Here, for plane X—Y, the arc direction is the direction of plane X--Y from positive direction of
Z axis to negative direction of Z axis; similarly, for plane X—Z or plane Y—Z, the direction is
from the positive direction of Y axis or X axis to the negative direction of Y axis or X axis
(right hand coordinate system is shown below).
The ending point of the arc is determined by addresses X, Y and Z. In G90 mode, i.e. absolute
value mode, addresses X, Y, Z specify the coordinates of arc ending point in current coordinate
system; in G91 mode, i.e. increment value mode, addresses X, Y, Z specify the distance
between the position of current tool and the ending point in every coordinate axis direction.
In X direction, address I specifies the distance between the position of current tool and the circle
center; in Y and Z direction, the distance between the position of current tool and the circle
- 55 -
PMC Programmable Motion Controller
center is specified by J and K, and the symbols of I, J, K values are determined by their motion
direction.
To program an arc, in addition to specifying end position and circle center position, we can also
program an arc by specifying radius and circle center, specify the radius with address R, and
replace the address of specified circle center position. The value of R may be positive and
negative. A positive R value is used to program an arc less than 180°, and a negative R value is
used to program an arc bigger than 180°. A full circle only can be programmed by specifying
the circle center.
Above tracks are programmed in absolute value mode and increment mode respectively:
(1) Absolute value mode
G00 X200.0 Y40.0 Z0
G90 G03 X140.0 Y100.0 I-60.0 F300.0
G02 X120.0 Y60.0 I-50.0
or
G00 X200.0 Y40.0 Z0
G90 G03 X140.0 Y100.0 R60.0 F300.0
G02 X120.0 Y60.0 R50.0
(2) Increment mode
G91 G03 X-60.0 Y60.0 I-60.0 F300.0
G02 X-20.0 Y-40.0 I-50.0
or
G91 G03 X-60.0 Y60.0 R60.0 F300.0
G02 X-20.0 Y-40.0 R50.0
The feed speed of arc interpolation is specified with F, which is the speed of the tool in arc tangent
direction.
Resume instruction
Format: RESULT
No parameter
- 56 -
PMC Programmable Motion Controller
Function: resume the paused motion at certain acceleration rate. This command is equal to
D33=0.
- 58 -
PMC Programmable Motion Controller
The second parameter is positive limit signal enable symbol, of which 0 indicates valid and 1
indicates invalid
The third parameter is negative limit signal enable symbol, of which 0 indicates valid and 1
indicates invalid
The third parameter is limit signal effective level, of which 0 indicates low level and 1
indicates high level
Function: hardware limit is usually used to prevent the device exceeding the valid motion
range unexpectedly during running; if hardware limit signal is valid, the motion stops
immediately. If doesn’t want to use hardware limit signal, the user can use PLC program to
achieve software limit.
- 59 -
PMC Programmable Motion Controller
■ If n is 0-23, the status of real physical output IO is rewritten, and the write state is
saved in IO cache
■ If n is 24-65535, the status of virtual physical output IO (i.e. output IO cache) is
rewritten
Actually, the IO address in OUT instruction corresponds to the bit address in E register area,
which is readable/writable, and can be rewritten by register evaluation or OUT() evaluation. In
PMC, the bit address in E register area is rewritten in virtual output IO mode. The addressing
range of the virtual output IO can be accessed with function code 0x05, 0xf in Modbus
protocol.
- #E100=123-321 Subtraction
#E100=#E100-123
#E100=#E101-#E102
* #E100=#E101*#E102 Multiplication
/ #E100=#E101/#E102 Division
- 60 -
PMC Programmable Motion Controller
<< #E100=#E100<<8 Left shift operation
>> #E100=#E100>>8 Right shift operation
Function #F100=SIN(#E100) Sine calculation
calculation #F100=COS(#E100) Cosine calculation
#F100=TAN(#E100) Tangent
#F100=ASIN(#E100) Arcsine
#F100=ACOS(#E100) Arc tangent
#F100=ATAN(#E100) Arc cosine
#F100=SQRT(#E100) Square root
#E100=ABS(#S100) Absolute value
#F100=LN(#E100) Natural logarithm
#F100=EXP(#E100) Exponent with e(=2.718…) as the base
#F100=LOG(#E100) Logarithm with 10 as the base
< IF(#E100<100) Operator of less than
> IF(#E100)100) Operator of larger than
<= IF(#E100<=100) Operator of less than or equal to
>= IF(#E100>=100) Operator of larger than or equal to
== IF(#E100==100) Operator of equal to
!= IF(#E100!=100) Operator of not equal to
Combined #F100=(((#E100+2)/3)-5)*SIN(30) Multiple nested mathematical
expression expressions
z The calculation expressions of same priority shall follow the principle of from left to
right.
z Calculation expressions have multiple levels of priority. The calculation expression is
long, please force the priority with ().
z () can be nested in the calculation for up to five levels.
Calculation accuracy
- 61 -
PMC Programmable Motion Controller
The value of macro variable has seven significant digits, and therefore the accuracy will be
reduced if the value is too large or too small (9999999.000~0.0000001), and repeated
calculation will accumulate the error. Therefore, the variable values should be in a reasonable
range;
- 62 -
PMC Programmable Motion Controller
The fifth parameter n is the stop bit width of serial transmission, and the virtual value is 0 or 2,
0: stop bit width is 1, 2: stop bit width is 2, 1: stop bit width is 1.5 (unavailable at present);
default: 0.
Function: set serial communication parameters.
serial port 0 is used for PMC console operation, and serial port 1 is used for Modbus data
communication. Actually, these parameters will be written into C0-C3 (serial port 0) or
C11-C14 (serial port 1) registers. Serial parameter setting takes effect immediately, but hasn’t
been saved in system parameter file. If the parameter setting isn’t proper, the system will
restore original setting after restarted. If the user confirms that the parameter configuration is
appropriate, please save with the SAVE_SYS command.
- 63 -
PMC Programmable Motion Controller
Format: SAVE_SYS n
Parameter n is saving mode, the range of which is 1, 2, 3, 5, 6, 7
Function: the system registers in key areas will be saved in ferroelectric RAM (Nonvolatile
Memory) or ROM. The saved register areas are I0-I127, E0-E127, S0-S127, C0-C127,
D0-D700, F0-F127.
■ If n=1, the system parameters will be saved in ferroelectric RAM.
■ If n=2, the system parameters will be saved in ROM.
■ If n=3, the system parameters will be saved in ferroelectric RAM and ROM.
■ If n=5, the system parameters and current coordinates of the machine tool will be
saved in ferroelectric RAM.
■ If n=6, the system parameters and current coordinates of the machine tool will be
saved in ROM.
■ If n=7, the system parameters and current coordinates of the machine tool will be
saved in ferroelectric RAM and ROM.
- 64 -
PMC Programmable Motion Controller
8 Online Development
PMC system opens its internal register area to any third party software or controller, accesses these
registers through standard MODBUS communication protocol and executes related control
functions. PMC supports R232 serial based and Ethernet media based MODBUS communication,
as well as ASIC and RTU data stream modes; Ethernet media based MODBUS communication also
supports TCP/IP or UDP protocol mode.
This PMC system development kit also provides upper computer API function library based on
Windows-PC online development mode, and corresponding engineering DEMO and related tools.
Actually, most of these API functions are achieved by operating the system registers in PMC
through Modbus protocol, and we also provides basic functions to operate these registers, so that
the users can extend the functions according to actual requirements and improve system flexibility.
The development process connected to third party controller depends on the software development
environment of the third party controller. Generally, if only it supports standard R232 or Ethernet
Modbus protocol, it is possible to access with the0x1, 0x2, 0x03, 0x04, 0x5, 0x06, 0xf, 0x10
function code in Modbus protocol according to the system register address and offset described in
Chapter 5, and thus control the PMC. This Manual only describes the development method based
on Windows-PC online mode.
- 65 -
PMC Programmable Motion Controller
Set the values of logic position counters of multiple
pmc_set_command_posExt 47
axes
pmc_set_actual_pos Set the value of actual position counter of every axis 47
Set the values of actual position counters of multiple
pmc_set_actual_posExt 48
axes
pmc_coord_mode Set current coordinate mode of current task 48
pmc_multaxis_conftmode Multitask axis motion conflict treatment mode 48
pmc_command_executmode Motion command execution mode 49
pmc_get_axis_pos Get logic and actual position status of every axis 49
Motion
pmc_get_command_pos Get all logic position 49
parameter
Get or set axis logic position of the coordinate system
check pmc_get_register_pos 50
specified in D4 register
pmc_pmove Quantitative drive of every axis 51
pmc_pmoveExt Quantitative drive of multi-axis 51
pmc_continue_move Continuous drive of every axis 51
pmc_continue_moveExt Continuous drive of multi-axis 52
pmc_line2 Random two axes interpolation 52
pmc_line3 Random three axes interpolation 52
pmc_line4 Four axes interpolation 53
pmc_line5 Five axes interpolation 53
Drive
pmc_line6 Six axes interpolation 53
category
pmc_fifo1 Random one axis interpolation motion 57
Random two axes constant speed cache interpolation
pmc_fifo2 57
motion
Random three axes constant speed cache interpolation
pmc_fifo3 58
motion
pmc_fifo4 Four axes constant speed cache interpolation motion 59
pmc_fifo5 Five axes constant speed cache interpolation motion 59
pmc_fifo6 Six axes constant speed cache interpolation motion 59
Home pmc_go_home Home 54
pmc_stop Stop processing and give up current processing task 55
pmc_pause Pause 55
Stop category
pmc_resume Resume processing 55
pmc_axis_stop Select an axis to stop 56
Switching pmc_read_Inbit Read single input point 56
quantity pmc_write_Outbit Set single output point 56
category pmc_read_Outbit Read single output point 57
Data pmc_set_cpara Set system register parameters 60
operation pmc_get_cpara Get system register parameters 60
category pmc_set_dpara Set drive register parameters 61
pmc_get_dpara Get drive register parameters 61
pmc_run Write data 61
pmc_set_timeout Set the timeout and repeat times of corresponding port 62
pmc_get_timeout Get the timeout and repeat times of corresponding port 62
- 66 -
PMC Programmable Motion Controller
pmc_read_data As client port, read server data 62
pmc_write_data As client port, write data to server 63
pmc_rfile_data Read file data according to frame No. 63
pmc_read_file Read info of specified file 64
pmc_write_file Write info of specified file 64
pmc_wfile_data Write file data according to frame No. 64
File operation
pmc_read_dir Read directory info 65
category
pmc_create_dir Create directory 65
pmc_del_dir Delete directory 66
pmc_create_file Create file 66
pmc_delete_file Delete file 66
pmc_modpara_init ( )
pmc_serial_init ( )
pmc_set_signle_para()
Function name int pmc_set_signle_para(INT8U port, INT32U mode)
Description Set basic parameters
port: corresponding communication port No.
Input parameter mode: communication mode of writing data and data type configuration parameter; default
data access mode: readable/writable
Output parameter None
- 67 -
PMC Programmable Motion Controller
Return 0: normal, -1: error
pmc_net_conn ( )
Function name int pmc_net_conn(INT8U NetPort, INT32S iDevNum, INT32U uiConIp, INT16U nConPort)
Description Connect TCP/UDP of Modbus, and map with device No. and IP address respectively
NetPort: network port No., only the port No. for TCP and UDP connection, uiConIp:
connected server IP address
Input parameter
nConPort: connected server communication port No. (Modbus communication is fixed
at 502 generally)
Output parameter None
Return 0: normal, -1: error
pmc_clos_netdev ( )
Function name int pmc_clos_netdev(INT8U NetPort, INT32S iDevNum)
Description Close the communication port
NetPort: communication port No. (only valid for TCP/UPD network port)
Input parameter
iDevNum: device No. corresponding to network communication
Output parameter None
Return 0: normal, -1: error
pmc_set_consleport ( )
Function name int pmc_set_consleport(INT8U Port)
Description Set console command communication port
Input parameter Port: the set port No.
Output parameter None
Return 1: true, 0: false
pmc_uart_recv ( )
Function name int pmc_uart_recv(INT8U Port, INT8U *rbuff, INT16U length)
Description Serial port reading data function
Port: communication port No.
Input parameter *rbuff: storage area of read data
length: specify the length of read data
Output parameter None
Return the length of received data
pmc_get_consleport ( )
Function name int pmc_get_consleport(void)
Description get console command communication port No.
Input parameter None
Output
None
parameter
Return the set console command communication port No.
pmc_close_port ( )
Function name int pmc_close_port(INT8U Port)
- 68 -
PMC Programmable Motion Controller
Description Close the corresponding connection port of Modbus
Input parameter Port: communication port No. (including serial port and network port)
Output
None
parameter
Return 0: normal, -1: error
pmc_get_run_status ( )
Note None
pmc_get_back_status ( )
pmc_get_axis_status()
pmc_get_inp_status( )
- 69 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
Input parameter
No. should be set for UDP transmission
Output parameter status: interpolation status read of the system (0: idle, 1: interpolating)
Return 0: execute successfully, -1: send failed
Note None
pmc_set_speed ( )
int pmc_set_speed( INT32S id, INT16U axis, INT32S sv, INT32U speed, INT32U
Function name
acc, INT32U pmm)
Description Set the parameters of every axis
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
axis: axis number (1 - 6)
Input parameter sv: axis starting speed
speed: axis driving speed
acc: axis acceleration
pmm: axis pulse equivalent numerator
Output parameter None
Return 0: execute successfully, -1: send failed
pmc_set_speedExt( )
int pmc_set_speedExt( INT32S id, INT16U *axis, INT32U *sv, INT32U *speed,
Function name
INT32U *acc, INT32U *pmm, INT16U num);
Description Set parameters of multi-axis
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
*axis: save the array of axis number (1-6)
Input parameter *sv: save the array of axis starting speed
*speed: save the array of axis driving speed
*acc: save the array of axis acceleration
*pmm: save the array of axis pulse equivalent numerator
Output parameter None
Return 0: execute successfully, -1: send failed
pmc_set_command_pos ( )
Function name int pmc_set_command_pos( INT32S id, INT16U axis, INT32S pulse);
Description Set the logical position counter value of every axis
- 70 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input parameter axis: axis number (1 - 6)
pulse: set pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
Note The logical position counter can be written and read at any time
pmc_set_command_posExt ( )
int pmc_set_command_posExt( INT32S id, INT16U *axis, INT32S *pulse,
Function name
INT16U num);
Description Set the logical position counter value of multi-axis
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
*axis: save the array of axis number (1-6)
Input parameter *pulse: save the array of set pulses, >0: motion in positive direction, <0: motion in
negative direction
Range (-268435455~+268435455)
Num: corresponding axis number
Output parameter None
Return 0: execute successfully, -1: send failed
Note The logical position counter can be written and read at any time
pmc_set_actual_pos ( )
Function name int pmc_set_actual_pos( INT32S id, INT16U axis, INT32S pulse);
Description Set the value of actual position counter
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input parameter axis: axis number (1 - 6)
pulse: set pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
Note The actual position counter can be written and read at any time
pmc_set_actual_posExt( )
- 71 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
*axis: axis number (1 - 6)
Input parameter
*pulse: set pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Num: corresponding axis number
Output parameter None
Return 0: execute successfully, -1: send failed
Note The actual position counter can be written and read at any time
pmc_coord_mode( )
pmc_multaxis_conftmode( )
pmc_command_executmode ( )
- 72 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
executmode: 0 – execute current motion instruction in real-time and then execute next
motion instruction; every motion instruction has independent
acceleration / deceleration segment;
Input parameter 1 – send continuous motion instruction to hardware cache, and then
hardware executes continuous interpolation motion; every
motion instruction is at constant speed, and there is no
acceleration / deceleration segment;
2 – Smooth the continuous motion instruction according to its
motion track. Default: 0
Output parameter None
Return 0: execute successfully, -1: send failed
pmc_set_stop0_mode ( )
Function name int pmc_set_stop0_mode( INT32S id, INT16U axis,INT16U value,INT16U logic)
Description Set valid/invalid and logical voltage level of stop0 signal
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input parameter axis: axis number (1 - 6)
value: 0: invalid 1: valid
logic: 0: low voltage level effective 1: high voltage level effective
Output parameter None
pmc_set_stop1_mode ( )
Function name int pmc_set_stop1_mode( INT32S id, INT16U axis,INT16U value,INT16U logic)
Description Set valid/invalid and logical voltage level of stop1 signal
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
Input parameter axis: axis number (1 - 6)
value: 0: invalid 1: valid
logic: 0: low voltage level effective 1: high voltage level effective
Output parameter None
Return 0: execute successfully, -1: send failed
When initializing, the state is signal invalid, stop at low voltage level
Note
The stop mode is immediate; STOP1 signal is also the same
pmc_set_limit_mode ( )
pmc_set_pulse_mode ( )
pmc_get_axis_pos ( )
int pmc_get_axis_pos( INT32S id, INT16U axis, INT32S *compos, INT32S *actpos,
Function name
INT32U *speed)
- 74 -
PMC Programmable Motion Controller
Description Get the logical and actual position status of every axis
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
Input parameter should be set for UDP transmission
axis: axis number (1 - 6)
*compos: read logical position of the axis, range (-268435455~+268435455)
Output parameter *actpos: read actual position of the axis, range (-268435455~+268435455)
*speed: read drive speed of the axis, range (-268435455~+268435455)
Return 0: execute successfully, -1: send failed
This function can get the logical position, actual position and driving speed of the axis at
Note
any time, and can indicate the current position of the axis when the motor isn’t out of step
pmc_get_command_pos ( )
This function can get the logical position, actual position and driving speed of the axis
Note at any time, and can indicate the current position of the axis when the motor isn’t out
of step
pmc_get_register_pos( )
Note None
pmc_pmove ( )
Function name int pmc_pmove( INT32S id, INT16U axis, INT32S pulse)
Description Quantitative drive
- 75 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input parameter axis: axis number (1 - 6)
pulse: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
Note The parameters of speed curve must be set properly before writing drive command
pmc_pmoveExt( )
Function name int pmc_pmoveExt( INT32S id, INT16U *axis, INT32S *pulse, INT16U num)
Description Multi-axis quantitative drive
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
*axis: save the array of axis number (1-6)
Input parameter
*pulse: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Num: axis number
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note The parameters of speed curve must be set properly before writing drive command
pmc_continue_move( )
Function name int pmc_continue_move( INT32S id, INT16U axis, INT16S dir)
Description Continuous drive of every axis
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
Input parameter
axis: axis number (1 - 6)
dir: running direction, 0: positive, non-zero: negative
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note The parameters of speed curve must be set properly before writing drive command
pmc_continue_moveExt( )
Function name int pmc_continue_moveExt( INT32S id, INT16U *axis, INT16S *dir, INT16U num);
Description Multi-axis quantitative drive
- 76 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
Input parameter *axis: save the array of axis number (1-6)
*dir: save the array of running direction, 0: positive, non-zero: negative
Num: axis number
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note The parameters of speed curve must be set properly before writing drive command
pmc_line2( )
int pmc_line2( INT32S id, INT16U axis1, INT32S pulse1, INT16U axis2, INT32S
Function name
pulse2)
Description Two-axis linear interpolation
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
axis1: axis number (1 - 6)
pulse1: output pulses, >0: motion in positive direction, <0: motion in negative direction
Input parameter
Range (-268435455~+268435455)
axis2: axis number (1 - 6)
pulse2: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
Support random two-axis interpolation, and the interpolation speed bases on the
Note
minimum axis speed
pmc_line3 ( )
int pmc_line3( INT32S id, INT16U axis1, INT32S pulse1, INT16U axis2, INT32S
Function name
pulse2, INT16U axis3, INT32S pulse3)
Description Three-axis linear interpolation
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
axis1: axis number (1 - 6)
pulse1: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Input parameter axis2: axis number (1 - 6)
pulse2: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
axis3: axis number (1 - 6)
pulse3: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
- 77 -
PMC Programmable Motion Controller
Support random three-axis interpolation, and the interpolation speed bases on the
Note
minimum axis speed
pmc_line4 ( )
int pmc_line4( INT32S id, INT32S pulse1, INT32S pulse2, INT32S pulse3, INT32S
Function name
pulse4)
Description Four-axis linear interpolation
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input parameter pulse1, pulse2, pulse3, pulse4:
output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
Note The speed of four-axis interpolation bases on X axis speed
pmc_line5( )
int pmc_line5( INT32S id, INT32S pulse1, INT32S pulse2, INT32S pulse3, INT32S
Function name
pulse4, INT32S pulse5)
Description Five-axis linear interpolation
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input parameter pulse1, pulse2, pulse3, pulse4, pulse5:
output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
Note The speed of five-axis interpolation bases on X axis speed
pmc_line6( )
int pmc_line6( INT32S id, INT32S pulse1, INT32S pulse2, INT32S pulse3, INT32S
Function name
pulse4, INT32S pulse5, INT32S pulse6)
Description Six-axis linear interpolation
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
Input parameter pulse1, pulse2, pulse3, pulse4, pulse5, pulse6:
output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Output parameter None
Return 0: execute successfully, -1: send failed
Note The speed of six-axis interpolation bases on X axis speed
- 78 -
PMC Programmable Motion Controller
pmc_fifo1 ( )
Function name int pmc_fifo1( INT32S id, INT16U axis1, INT32S pulse1, INT32U speed)
Description Cache random single axis interpolation motion
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
axis1: axis number (1 - 6)
Input parameter
pulse1: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
speed: operating speed value (1 - 2000000)
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note
pmc_fifo2 ( )
int pmc_fifo2( INT32S id, INT16U axis1, INT32S pulse1, INT16U axis2, INT32S pulse2,
Function name
INT32U speed)
Description Cache random two-axis interpolation motion
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
axis1: axis number (1 - 6)
pulse1 output pulses, >0: motion in positive direction, <0: motion in negative direction
Input parameter Range (-268435455~+268435455)
axis2: axis number (1 - 6)
pulse2: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
speed: operating speed value (1 - 2000000)
Output parameter None
Return 0: execute successfully, -1: send failed
Note
pmc_fifo3()
int pmc_fifo3( INT32S id, INT16U axis1, INT32S pulse1, INT16U axis2, INT32S pulse2,
Function name
INT16U axis3, INT32S pulse3, INT32U speed)
Description Cache random three-axis interpolation motion
- 79 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
axis1: axis number (1 - 6)
pulse1: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
Input axis2: axis number (1 - 6)
parameter pulse2: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
axis3: axis number (1 - 6)
pulse3: output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
speed: operating speed value (1 - 2000000)
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note None
pmc_fifo4 ()
int pmc_fifo4( INT32S id, INT32S pulse1, INT32S pulse2, INT32S pulse3, INT32S
Function name
pulse4, INT32U speed)
Description Cache four-axis interpolation motion
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
Input pulse1, pulse2, pulse3, pulse4:
parameter output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
speed: operating speed value (1 - 2000000)
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note None
pmc_fifo5 ()
int pmc_fifo5( INT32S id, INT32S pulse1, INT32S pulse2, INT32S pulse3, INT32S
Function name
pulse4, INT32S pulse5, INT32U speed)
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
Input pulse1, pulse2, pulse3, pulse4, pulse5:
parameter output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
speed: operating speed value (1 - 2000000)
- 80 -
PMC Programmable Motion Controller
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note None
pmc_fifo6 ()
int pmc_fifo5( INT32S id, INT32S pulse1, INT32S pulse2, INT32S pulse3, INT32S
Function name
pulse4, INT32S pulse5, INT32S pulse6,INT32U speed)
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
pulse1, pulse2, pulse3, pulse4, pulse5, pulse6:
Input parameter
output pulses, >0: motion in positive direction, <0: motion in negative direction
Range (-268435455~+268435455)
speed: operating speed value (1 - 2000000)
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note None
pmc_go_home()
pmc_stop ()
- 81 -
PMC Programmable Motion Controller
pmc_pause ( )
pmc_resume( )
pmc_axis_stop( )
pmc_read_Inbit( )
Function
int pmc_read_Inbit( INT32S id, INT16U bit_start, INT16U bit_num, INT8U *status)
name
Description Read the status of single input point
- 82 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
Input No. should be set for UDP transmission
parameter bit_start: input port No.
bit_num: continuously read input port number
Output
*status: number of saving input status
parameter
Return 0: execute successfully, -1: send failed
Refer to the hardware manual of respective controller for the range of input point and
Note
corresponding function
pmc_write_Outbit( )
pmc_read_Outbit ()
pmc_set_cpara( )
Function
int pmc_set_cpara( INT32S id, INT16U addr, INT32U *data, INT16U len)
name
Description Set parameters of system register
- 83 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input
addr: register address corresponding to system parameter (32-bit double-word address)
parameter
*data: save the parameter values to be set
len: set parameter length
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note
pmc_get_cpara( )
Function name int pmc_get_cpara( INT32S id, INT16U addr, INT32U *data, INT16U len)
Description Get parameters of system register
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
Input No. should be set for UDP transmission
parameter addr: register address corresponding to system parameter (32-bit double-word address)
len: get parameter length
Output
*data: save the parameter values
parameter
Return 0: execute successfully, -1: send failed
Note
pmc_set_dpara( )
Function name int pmc_set_dpara( INT32S id, INT16U addr, INT32U *data, INT16U len)
pmc_get_dpara( )
Function name int pmc_get_dpara( INT32S id, INT16U addr, INT32U *data, INT16U len)
Description Get parameters of drive register
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input parameter
addr: register address corresponding to system parameter (32-bit double-word address)
len: get parameter length
- 84 -
PMC Programmable Motion Controller
Output
*data: save the parameter values
parameter
Return 0: execute successfully, -1: send failed
Note None
pmc_run( )
Input id: slave station No.; invalid for TCP/UDP transmission; connection address and port
parameter No. should be set for UDP transmission
Output
None
parameter
Return 0: execute successfully, -1: send failed
Note None
pmc_set_timeout ( )
pmc_read_data ( )
- 85 -
PMC Programmable Motion Controller
pmc_write_data( )
pmc_rfile_data( )
pmc_read_file()
pmc_write_file()
- 86 -
PMC Programmable Motion Controller
int pmc_write_file( INT32S id, char *pFilePath, INT32U pFrameTotal, INT32U
Function name
pFileSize)
Description write information of specified file
id: slave station No.; invalid for TCP/UDP transmission; connection address and
port No. should be set for UDP transmission
Input
pFilePath: path of written file
parameter
FrameTotal: frames of file to be transmitted
FileSize: size of written file
Output
parameter
Return 0: normal, -1: send failed
Note
pmc_wfile_data ()
Function int pmc_wfile_data( INT32S id, INT32U FrameCnt, INT8U *pWriteBuff, INT16U
name DataSize)
Description write file data according to frame No.
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input FrameCnt: frame No. of writing file data; the maximum byte length of write data once
parameter is FileFrameSize
pWriteBuff: storage area of write file frame data
DataSize: size of frame data written once
Output
parameter
Return 0: normal, -1: send failed
Note
pmc_read_dir()
Function
int pmc_read_dir( INT32S id, char *pDirPath, CDir *pDirList, INT32U *pDirNum)
name
Description read directory info
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
No. should be set for UDP transmission
Input
*pDirPath: read directory path
parameter
*pDirList: save read directory info
*pDirNum: save the directory or file number in read directory info
Output
parameter
Return 0: normal, -1: send failed
Note
pmc_create_dir ()
- 87 -
PMC Programmable Motion Controller
Function
int pmc_create_dir( INT32S id, char *pDirPath)
name
Description create directory
id: slave station No.; invalid for TCP/UDP transmission; connection address and port
Input
No. should be set for UDP transmission
parameter
*pDirPath: the directory path to be created
Output
parameter
Return 0: normal, -1: send failed
Note
pmc_del_dir()
ADT-8860 function library is the interface for users operating motion control card. The users
can control the motion card to complete corresponding function by calling interface
functions.
8.3.3. Calling in VC
8.3.4. Calling in VB
Use serial testing tool to show the actually received input parameters in the control card and
the execution result. Serial testing display is enabled or disabled through pmc_uart_recv()
parameter, and the default state is off. When serial testing is enabled, it will take up more
system resource of the control card, and affect the execution speed, but it will help developers
check the reason of control card execution failure caused by illegal parameters.
Call pmc_modpara_init () function at the beginning of the program to initialize the device
address, and then check the network connection through pmc_net_conn () function and
check whether ADT8860 card is connected properly. If yes, the system will return a
device No. Then, set the pulse output mode and limit switch mode according to the
configuration of the device. pmc_modpara_init t() should be called only once when the
application is initialized. When the application is ended, please call pmc_close_port ()
function to release all network resource.
Note: library functions “pmc_modpara_init()” and “pmc_net_conn()” are the “door” to
ADT8860 card. Calling other functions has meaning only after calling this function and
initializing the motion control card successfully.
- 89 -
PMC Programmable Motion Controller
8.4.2. Axis speed setting
STOP0 and STOP1 are the signals that every axis has, and thus there are eight STOP signals
totally. These signals are mainly used for home operation. Home mode can use one or several
signals accordingly. However, please note that this signal is decelerating stop. For high speed
home operation, please add a deceleration switch before the home switch, that is to say, use
two STOP signals, one home switch and one deceleration switch. It is also possible to use one
signal, which decelerates stop after meeting STOP signal, moves reversely at constant speed
and stops after meeting again.
Although the programming languages are multifarious, they have same nature. In summary,
it is three structures and one idea. The three structures are order structure, loop structure
and branch structure, which are emphasized in all programming languages, and one idea is
the algorithm and module division used to complete design task, which is the important and
difficult point of the entire program design.
To ensure the generality, standardized, scalability and easy maintenance, the examples
below focus on project design. The examples are divided into the following modules:
- 90 -
PMC Programmable Motion Controller
motion control module (further package the library function provided by the control card),
function realization module (coordinating the code segment of specific process), monitoring
module and stop processing module.
Below is the introduction of ADT8860 card function library application in programming
languages VB and VC. For other programming languages, please refer to the example of
VB and VC.
1.1 PREPARATION
(1) Create a new item and save as “test.vbp”;
(2) Add “adt8860.bas” module in the item according to above method;
1.2 Motion control module
(1) Add a new module in the item and save as “ctrlcard.bas”;
(2) In motion control module, first customize the initialization function of the control card and
initialize the library function that needs to be packaged in initialization function;
(3) Continue customizing related motion control functions, such as speed setting function,
single axis motion function, interpolation motion function, etc.;
(4) The source code of ctrcard.bas follows:
//Content should be added 3-25 ?????
1.3 Function realization module
Interface design
??????
1.4 Monitoring module
//??????
Monitoring module is used to get the driving info of all axes in real-time, display motion info,
and control to restricting sending new driving instruction during driving. Monitoring module is
completed with timer event, and the code follows:
//????????????
1.5 Stop module
Stop module is used to control the emergencies in the driving process, and the driving of all
axes must be stopped immediately. The code of stop module is in the click event of CmdStop
button, and the code follows:
//??????????
1.1 Preparation
(1) Create a new item and save as “VCExample.dsw”;
(2) Load static library “ADT8860.lib” into the item according to above method;
1.2 Motion control module
(1) Add a new category in the item, save the header file as “CtrlCard.h” and save the
source file as “CtrlCard.cpp”;
- 91 -
PMC Programmable Motion Controller
(2) In motion control module, first customize the initialization function of the control card
and initialize the library function that needs to be packaged in initialization
function;
(3) Continue customizing related motion control functions, such as speed setting function,
single axis motion function, interpolation motion function, etc.;
/********************************************************
Function feature: set communication mode
Input parameter:
port: corresponding communication port No.
mode: communication mode of writing data and data type configuration parameter; default
data access mode: readable/writable
Output parameter: None
Return: 0: send successfully, -1: send failed
*********************************************************/
int CCtrlCard::Set_Basic_Para(unsigned char port,int mode)
{
Result = pmc_set_signle_para(port, mode);
return Result;
}
/*********************************************************
Function feature: serial port initialization
Input parameter: port: serial port (0,1,2,3)
baud: set the baud rate corresponding to serial port
databit: serial port data bit (5, 6, 7, 8-bit)
stopbit: serial port stop bit (1, 2-bit)
Parity: serial port parity bit (no, odd, even)
Output parameter: None
Return: 0: normal, -1: send failed
**********************************************************/
int CCtrlCard::Set_Serial_Init(unsigned char port,unsigned int baud, unsigned char databit,
unsigned char stopbit, unsigned char parity)
{
Result = pmc_serial_init(port,baud, databit,stopbit,parity,TRUE);
return Result;
}
/**********************************************************
Function feature: initialize TCP/UDP network connection of Modbus
- 94 -
PMC Programmable Motion Controller
Input parameter:
port: network port No., only the port No. for TCP and UDP connection
devnum: device No. corresponding to network communication
conip: connected server IP address
conport: connected server communication port No. (Modbus communication is fixed at 502
generally)
Output parameter: None
Return: 0: normal, -1: send failed
***********************************************************/
int CCtrlCard::Get_Net_Conn(unsigned char port,int devnum,int conip,unsigned short
conport)
{
Result = pmc_net_conn(port, devnum, conip, conport);
return Result;
}
/********************************************************
Function feature: close communication port
Input parameter: port: communication port No. (only valid for TCP/UPD network port)
devnum: device No. corresponding to network communication
Output parameter: None
Return: 0: normal, -1: send failed
*********************************************************/
int CCtrlCard::Close_NetDev(unsigned char port,int devnum)
{
Result = pmc_clos_netdev(port, devnum);
return Result;
}
/********************************************************
- 95 -
PMC Programmable Motion Controller
Function feature: serial port read data function
Input parameter:
Port: communication port No.
rbuff: storage area of read data
length: specify the length of read data
Output parameter: None
Return: actually received data length
*********************************************************/
int CCtrlCard::Get_Uart_Recv(unsigned char port,unsigned char &rbuff ,int length)
{
Result = pmc_uart_recv(port, &rbuff,length);
return Result;
}
/****************************************************************
Function name: ModbusClosePort()
Description: close corresponding connection port of Modbus
Input parameter:
Port: communication port No. (including serial port and network port)
Output parameter: None
Return: 0: normal, -1: send failed
*****************************************************************/
return Result;
}
- 96 -
PMC Programmable Motion Controller
/***************************************************************
Function feature: get timeout and repeat times of corresponding port
Input parameter:
*timeouts: timeout (unit: ms)
*repeat_times: repeat times
Output parameter: None
Return: TRUE: normal
***************************************************************/
int CCtrlCard::Get_TimeOut(unsigned short *time,unsigned char *renum)
{
Result = pmc_get_timeout(time,renum);
return Result;
}
/*************************************************************
Function feature: set timeout and repeat times of corresponding port
Input parameter:
time: timeout (unit:ms) > 500ms
renum: repeat times
Output parameter: None
Return: TRUE: normal
**************************************************************/
int CCtrlCard::Set_TimeOut(unsigned short time,unsigned char renum)
{
Result = pmc_set_timeout(time,renum);
return Result;
}
/*************************************************************
Function feature: set starting speed, driving speed and acceleration of the axis
Input parameter:
Id: slave station No.
Axis: axis number
Startv: starting speed
Speed: driving speed
Add: acceleration
Pmm: pulse equivalent numerator
Return: 0: true, 1: false
- 97 -
PMC Programmable Motion Controller
*************************************************************/
int CCtrlCard::Setup_Speed(int id, int axis, int startv, unsigned int speed, unsigned int add ,
unsigned int pmm)
{
if (startv - speed >= 0) //constant speed motion
{
Result = pmc_set_speed(id,axis,startv,startv,add,pmm);
}
else //acceleration/deceleration motion
{
Result = pmc_set_speed(id,axis,startv,speed,add,pmm);
}
return Result;
}
/**********************************************************
Function feature: set starting speed, driving speed and acceleration of multi-axis
Parameter:
Id: slave station No.
Axis: axis number
startv: starting speed
speed: driving speed
add: acceleration
pmm: pulse equivalent numerator
Return: 0: true, 1: false
************************************************************/
int CCtrlCard::Setup_SpeedExt(int id, unsigned short *axis, unsigned int *startv, unsigned
int *speed, unsigned int *add , unsigned int *pmm)
{
Result = pmc_set_speedExt(id,axis,startv,speed,add,pmm,6);
return Result;
}
/******************************************************
Function feature: this function is used to drive multi-axis motion
Parameter:
Id: slave station No.
Value: output pulses
Return=0: true, Return=1: false
*******************************************************/
int CCtrlCard::MultAxis_Pmove(int id,unsigned short *axis, int *pulse)
{
Result = pmc_pmoveExt(id, axis, pulse,6);
return Result;
}
/******************************************************
Function feature: random two axes interpolation motion
Parameter:
Id: slave station No.
axis1, axis2: axis number 1-6
pulse1, pulse2: pulses
Return: 0: true, 1: false
*******************************************************/
int CCtrlCard::Interp_Move2(int id,int axis1, long pulse1,int axis2, long pulse2)
{
Result = pmc_line2(id, axis1, pulse1,axis2, pulse2);
return Result;
}
/******************************************************
Function feature: random three axes interpolation motion
Parameter:
Id: slave station No.
axis1, axis2, axis3: axis number
pulse1, pulse2, pulse3: pulses
- 99 -
PMC Programmable Motion Controller
Return: 0: true, 1: false
*******************************************************/
int CCtrlCard::Interp_Move3(int id,int axis1, long pulse1,int axis2, long pulse2,int axis3,
long pulse3)
{
Result = pmc_line3(id, axis1, pulse1,axis2,pulse2, axis3, pulse3);
return Result;
}
/**********************************************************
Function feature: first four axes interpolation motion
Parameter:
Id: slave station No.
pulse1, pulse2, pulse3, pulse4: pulses
Return: 0: true, 1: false
***********************************************************/
int CCtrlCard::Interp_Move4(int id,long pulse1, long pulse2, long pulse3, long pulse4)
{
Result = pmc_line4(id, pulse1, pulse2, pulse3, pulse4);
return Result;
}
/**********************************************************
Function feature: drive first five axes interpolation motion
Parameter:
Id: slave station No.
pulse1,pulse2,pulse3,pulse4,pulse5: pulses
Return: 0: true, 1: false
***********************************************************/
int CCtrlCard::Interp_Move5(int id,long pulse1, long pulse2, long pulse3, long pulse4, long
pulse5)
{
Result = pmc_line5(id, pulse1, pulse2, pulse3, pulse4, pulse5);
return Result;
}
/**********************************************************
Function feature: six axes interpolation motion
- 100 -
PMC Programmable Motion Controller
Parameter:
Id: slave station No.
pulse1, pulse2, pulse3, pulse4, pulse5, pulse6: pulses
Return: 0: true, 1: false
***********************************************************/
int CCtrlCard::Interp_Move6(int id,long pulse1, long pulse2, long pulse3, long pulse4, long
pulse5, long pulse6)
{
Result = pmc_line6(id, pulse1, pulse2, pulse3, pulse4, pulse5, pulse6);
return Result;
}
/***********************************************************
Function feature: this function provides immediate stop mode and decelerating stop mode
Parameter:
Id: slave station No.
mode: 0-immediate stop, 1-pause, 2-resume
Return: 0: true, 1: false
************************************************************/
int CCtrlCard::StopRun(int id,int mode )
{
if(mode==0)
{
Result = pmc_stop(id);
}
else if(mode==1)
{
Result = pmc_pause(id);
}
else if(mode==2)
{
Result = pmc_resume(id);
}
return Result;
}
/***********************************************************
Function feature: this function is used to get the driving state of single axis
Parameter:
Id: slave station No.
- 101 -
PMC Programmable Motion Controller
status1, status2, status3, status4, status5, status6: status indicator (0- driving ends, non-0 -
driving)
Return: 0: true, 1: false
************************************************************/
int CCtrlCard::Get_ONLY_Status(int id, short int &status1,short int &status2, short int
&status3,short int &status4,short int &status5,short int &status6)
{
Result=pmc_get_axis_status(id,&status1,&status2,&status3,&status4,&status5,&status6);
return Result;
}
/************************************************************
Function feature: this function is used to get the driving state or interpolation driving state of
the axis
Parameter:
Id: slave station No.
Value: status indicator (0- driving ends, non-0 - driving)
Mode: 0- get interpolation driving state, 1- get home driving state, 2- get system driving state
Return: 0: true, 1: false
************************************************************/
int CCtrlCard::Get_Status(int id, unsigned int &value, int mode)
{
if (mode==0) // get interpolation driving state
{
Result=pmc_get_inp_status(id,&value);
}
else if (mode==1) // get home driving state
{
Result=pmc_get_back_status(id,&value);
}
else if(mode==2) // get system driving state
{
Result=pmc_get_run_status(id,&value);
}
return Result;
}
/***********************************************************
Function feature: get or set axis logic position of the coordinate system specified in D4 register
Input parameter:
- 102 -
PMC Programmable Motion Controller
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
regpos: axis logic position of the coordinate system specified in the register
Return: 0: send successfully, -1: send failed
************************************************************/
int CCtrlCard::Get_RegisterPos(int id, unsigned int ®pos )
{
Result = pmc_get_register_pos(id, ®pos);
return Result;
}
/************************************************************
Function feature: used to feed back current logic position, actual position and running speed of
the axis
Parameter:
Axis: axis number
LogPos: logic position
ActPos: actual position
Speed: operating speed
Return: 0: true, 1: false
************************************************************/
int CCtrlCard::Get_CurrentInf(int id, int *LogPos, int *ActPos, unsigned int *Speed )
{
Result = pmc_get_command_pos(id, LogPos,ActPos,Speed);
return Result;
}
/*************************************************************
Function feature: read single input point
Parameter:
id: slave station No.
svbit: input port No.
number: continuously read input port number
status: number of saving input status, 0 – low voltage level, 1 – high voltage level
Return: 0: true, -1: false
**************************************************************/
int CCtrlCard::Read_Input(int id,int svbit,int number,unsigned char *status)
{
Result = pmc_read_Inbit(id,svbit, number,status);
- 103 -
PMC Programmable Motion Controller
return Result;
}
/**************************************************************
Function feature: output signal of single point
Parameter:
id: slave station No.
svbit: input port No.
number: continuously read input port number
status: save the array of input status 0- low, 1- high
Return: 0: true, 1: false
**************************************************************/
int CCtrlCard::Write_Output(int id,int svbit,int number,unsigned char *status)
{
Result = pmc_write_Outbit(id,svbit, number,status);
return Result;
}
/***************************************************************
Function feature: set logic position and actual position
Parameter:
id: slave station No.
axis: axis number
pos: set position value
mode: 0- set logic position, non-0- set actual position
Return: 0: true, 1: false
****************************************************************/
- 104 -
PMC Programmable Motion Controller
return Result;
}
/***********************************************************
Function feature: set the working mode of pulse
Parameter id: slave station No.
axis: axis number (1 – 6)
value: 0- pulse + pulse 1- pulse + direction
logic: 0- positive logic pulse 1- negative logic pulse
dir-logic: 0- direction signal positive logic 1- direction signal negative logic
Return: 0: send successfully, -1: send failed
************************************************************/
int CCtrlCard::Setup_PulseMode(int id,int axis, int value,int logic,int dir_logic)
{
Result = pmc_set_pulse_mode(id, axis, value, logic, dir_logic);
return Result;
}
/***********************************************************
Function feature: set the mode of positive/negative limit input nLMT signal
Parameter:
id: slave station No.
axis: axis number
value1: 0- positive limit valid 1- positive limit invalid
value2 0- negative limit valid 1- negative limit invalid
logic 0 - low voltage level effective 1 - high voltage level effective
Default mode: positive limit valid, negative limit valid, low voltage level effective
Return: 0: true, 1: false
************************************************************/
int CCtrlCard::Setup_LimitMode(int id,int axis, int value1, int value2, int logic)
{
Result = pmc_set_limit_mode(id, axis, value1, value2, logic);
return Result;
}
/**********************************************************
Function feature: set the mode of stop0 signal
Parameter:
id: slave station No.
Axis: axis number
- 105 -
PMC Programmable Motion Controller
Value: 0 - invalid 1 - valid
Logic: 0 - low voltage level effective 1 - high voltage level effective
Default mode: invalid
Return: 0: true, 1: false
**********************************************************/
int CCtrlCard::Setup_Stop0Mode(int id,int axis, int value, int logic)
{
Result = pmc_set_stop0_mode(id, axis, value ,logic);
return Result;
}
/*********************************************************
Function feature: set the mode of stop1 signal
Parameter:
id: slave station No.
axis: axis number
value: 0- invalid 1 - valid
logic: 0 - low voltage level effective 1 - high voltage level effective
Default mode: invalid
Return: 0: true, 1: false
*********************************************************/
int CCtrlCard::Setup_Stop1Mode(int id,int axis, int value, int logic)
{
Result = pmc_set_stop1_mode(id, axis, value ,logic);
return Result;
}
- 106 -
PMC Programmable Motion Controller
Result=pmc_read_Outbit( id, svbit, number,&status);
return Result;
}
/******************************************
Function feature: continuous driving of every axis
Parameter:
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
axis: axis number (1 - 6)
dir: running direction, 0: positive, non-zero: negative
Output parameter: None
Return: 0: send successfully, -1: send failed
********************************************************/
int CCtrlCard::Continue_Move( int id, unsigned short int axis, short int dir)
{
Result=pmc_continue_move( id, axis, dir);
return Result;
}
/**************************************************************
Function feature: set current coordinate mode of current task
Parameter:
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
mode: 0: increment coordinate mode, 1: absolute coordinate mode
Return: 0: send successfully, -1: send failed
*************************************************************/
int CCtrlCard::Coord_Mode( int id, unsigned int mode)
{
Result=pmc_coord_mode( id, mode);
return Result;
}
/*************************************************************
Function feature: set multitask axis motion conflict treatment mode
Input parameter:
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
conftmode: 0: pause and report error
1: execute new motion when the system is in idle,
2: if there is no axis conflict in non-interpolation state, allow executing
multi-axis linkage again
- 107 -
PMC Programmable Motion Controller
Return: 0: send successfully, -1: send failed
*************************************************************/
int CCtrlCard::MultAxis_ConfMode( int id, unsigned int conftmode)
{
Result=pmc_multaxis_conftmode( id, conftmode);
return Result;
}
/************************************************************
Function feature: motion instruction execution mode
Parameter:
id: slave station No.; invalid for TCP/UDP transmission; connection address and port No.
should be set for UDP transmission
executmode: 0 - execute next motion command only after execution of the current motion
command in real-time, and each motion command has independent acceleration
and deceleration segments;
1 - send continuous motion commands to hardware cache, and then the hardware
executes continuous interpolation motion; each motion command is uniform
motion, and doesn’t have acceleration and deceleration segments;
2 - implement speed forward smoothing for continuous motion command
according to its motion track; default: 0
Return: 0: send successfully, -1: send failed
***********************************************************/
int CCtrlCard::Command_ExeMode( int id, unsigned int executmode)
{
Result=pmc_command_executmode( id, executmode);
return Result;
}
1.3 Function realization module
1.3.1 Interface design
- 108 -
PMC Programmable Motion Controller
本地 MAC 地址 MAC address / 本地 IP 地址 IP address / 客户端 IP Client IP
联动 Linkage \ 暂停 Pause \ 缓冲 Buffer 插补 Interpolate \ 恢复 Resume \位置清零 Clear position
连续运行 Continuous running \ IO 测试 IO test \ 停止 Stop
座标方式 Coordinate mode 增量坐标 Increment \ 绝对坐标 Absolute
原点 home / 正限位 positive limit / 负限位 negative limit
运动参数设置(pules/s)Motion parameter setting (pulse/s)
轴号 Axis No. \ 初始速度 Starting speed \ 驱动速度 Driving speed \ 加速度 Acceleration \ 当量分子 Equivalent numerator
运动状态 Motion status / 轴号 Axis No. \ 目标位置 Target position \ 逻辑位置 Logic position \ 实际位置 Actual position \ 运
行速度 Running speed
模式选择 Mode selection / 设置当前座标方式 Set current coordinate mode \ 运动指令执行方式 Motion instruction execution
mode \ 多轴运动冲突方式 Multi-axis motion conflict mode
Note:
(1) Speed setting—used to set the start speed, driving speed and acceleration of every axis;
position setting—set the driving pulse of every axis; driving info—display the logical
position, actual position and running speed of every axis in real-time.
(2) Driving object—confirm the axis for linkage or interpolation by selecting driving
object;
(3) Linkage—send single axis driving instruction to all axes of selected driving object;
interpolation—send interpolation instruction to all axes of selected driving object;
stop—stop the pulse output of all axes;
All above data use pulse as the unit.
1.3.2 Initialization code of motion control card
int ret;
ret=g_CtrlCard.Init_Board(m_iNoid);
if(!ret)
{
AfxMessageBox("Motion control card initialization succeeded!");
}
else
{
AfxMessageBox("Motion control card initialization failed!");
}
1.3.3 Monitoring module
Monitoring module is used to get the driving info of all axes in real-time, display motion info,
and control to restricting sending new driving instruction during driving. Monitoring module
is completed with timer event, and the code follows:
void CMy8860DemoDlg::OnTimer(UINT nIDEvent)
{
CString str;
CStatic *lbl;
int logpos[6];
int actpos[6];
UINT speedpos[6];
UINT
nID1[]={IDC_LOG_POSX,IDC_LOG_POSY,IDC_LOG_POSZ,IDC_LOG_POSA,IDC_
LOG_POSB, IDC_LOG_POSC};
- 109 -
PMC Programmable Motion Controller
UINT
nID2[]={IDC_ACT_POSX,IDC_ACT_POSY,IDC_ACT_POSZ,IDC_ACT_POSA,IDC_
ACT_POSB,IDC_ACT_POSC};
UINT
nID3[]={IDC_RUNSPEED_X,IDC_RUNSPEED_Y,IDC_RUNSPEED_Z,IDC_RUNSPE
ED_A,IDC_RUNSPEED_B,IDC_RUNSPEED_C};
int ret=g_CtrlCard.Get_CurrentInf(m_iNoid,logpos,actpos,speedpos);
if(ret == 0)
{
for (int i=1; i<7; i++)
{
::DoEvent();
lbl=(CStatic*)GetDlgItem(nID1[i-1]);
str.Format("%ld",logpos[i-1]);
lbl->SetWindowText(str);
lbl=(CStatic*)GetDlgItem(nID2[i-1]);
str.Format("%ld",actpos[i-1]);
lbl->SetWindowText(str);
lbl=(CStatic*)GetDlgItem(nID3[i-1]);
str.Format("%ld",speedpos[i-1]);
lbl->SetWindowText(str);
}
UINT
nIDIN5[12]={IDC_HOME_X,IDC_HOME_Y,IDC_HOME_Z,IDC_HOME_A,
IDC_PLIMT_X,IDC_NLIMT_X,IDC_PLIMT_Y,IDC_NLIMT_Y,IDC_PLIMT_Z,
IDC_NLIMT_Z,IDC_PLIMT_A,IDC_NLIMT_A };
UINT
nIDIN2[6]={IDC_HOME_B,IDC_HOME_C,IDC_PLIMT_B,IDC_NLIMT_B,IDC_PLIM
T_C,IDC_NLIMT_C};
INT16U bit_start=0;
INT16U bit_num=85;
INT8U status3[86];
int ii=0;
- 110 -
PMC Programmable Motion Controller
CButton *btn;
CButton *btn2;
int ret2;
ret2=g_CtrlCard.Read_Input(m_iNoid, bit_start, bit_num, status3);
if(ret2 == 0)
{
for( ii=0;ii<12;ii++)
{
if(status3[ii]==0)
{
btn=(CButton*)GetDlgItem(nIDIN5[ii]);
btn->SetCheck(1);
}
else
{
btn=(CButton*)GetDlgItem(nIDIN5[ii]);
btn->SetCheck(0);
}
}
for(ii=0;ii<6;ii++)
{
btn2=(CButton*)GetDlgItem(nIDIN2[ii]);
if(status3[ii+17]==0)
{
btn2->SetCheck(1);
}
else
{
btn2->SetCheck(0);
}
}
}
INT32U regpos=0;
g_CtrlCard.Get_RegisterPos(m_iNoid,regpos);
lbl=(CStatic*)GetDlgItem(IDC_REG_POS);
str.Format("%ld",regpos);
lbl->SetWindowText(str);
- 111 -
PMC Programmable Motion Controller
CDialog::OnTimer(nIDEvent);
}
1.3.4 Stop module
Stop module is used to control the emergencies in the driving process, and the driving of all
axes must be stopped immediately. The code of stop module is in the click event of CmdStop
button, and the code follows:
void CMy8860DemoDlg::OnButtonStop()
{
g_CtrlCard.StopRun(m_iNoid,0);
}
- 112 -
PMC Programmable Motion Controller
9 Network Settings
9.1 Network environment
ADT-8860 control card can run in the LAN that consists of several subnets, but it is recommended
to run in dedicated subnet. The subnet shouldn’t be accessed by irrespective network to avoid
communication delay or failure due to busy network. When the host controls in real-time, please
close other applications to ensure that the host has a better response performance.
Since the client LAN may have different environments, we can’t ensure that the IP address and NIC
address (MAC) of the controller device are unique in client network before the device is delivered.
The controller only has one default IP address and NIC address (MAC) before delivery, and
therefore all new control cards should be confirmed with serial testing tool SSCOM32.EXE
(supplied) or the network option should be re-configured, and ensure that the IP address and NIC
address are unique in the LAN.
Default network configuration follows:
IP address: 192.168.0.123
Subnet mask: 255.255.255.0
Default gateway: 192.168.0.1
NIC address (MAC): 0B-16-21-2C-37-42
- 113 -
PMC Programmable Motion Controller
9.4 Host (upper PC) network configuration
The network configuration of control host should be modified in TCP/IP Protocol Properties dialog
box. The method to open the TCP/IP Protocol Properties dialog box in Windows XP follows:
In the Start menu or on the desktop, find My Network Places -> right click My Network Places and
click Properties -> open the Network Connections window -> right click Local Area Connection
and click Properties -> open Local Area Connection Properties window -> activate General tab ->
select Internet Protocol (TCP/IP) -> click Properties to open the Internet Protocol (TCP/IP)
Properties window, as shown below.
Fig. 7
Fig. 8
- 114 -
PMC Programmable Motion Controller
Fig. 9
Fig. 10
- 115 -
PMC Programmable Motion Controller
Fig. 11
In Internet Protocol (TCP/IP) Properties window, select “Use the following IP address”, and then
the user can set the IP address, Subnet mask and Default gateway of the control host according to
the subnet number in the LAN. If the subnet doesn’t have real gateway, set the gateway to the first
host number in the subnet, e.g.: 192.168.0.1.
In actual application, the subnet number of the control card should be consistent with the subnet
number of control host. If the subnet number of the control card is inconsistent with the subnet
number of control host, please modify the network configuration file of the control card through
serial software tool. If the control card and the control host are connected directly through crossover
cable, it is also possible to adapt to the control card by modifying the IP address of the control host.
- 116 -
PMC Programmable Motion Controller
Control host and the device are connected through switch or hub with 568A straight-through
cable. While building network, the industrial Ethernet standard is recommended.
- 117 -
PMC Programmable Motion Controller
10 System Alarm Info
All system alarms can be shown in the console, including alarm source, alarm ID, alarm code,
code position, and alarm reason, and write these data into the register area started with C96
register.
Alarm source
This is the task program that the alarm originates, and the task number (0-31) is the alarm
source. If the error originates from the console, the alarm source will be 32.
Alarm ID
Every type of alarm corresponds to an alarm ID so as to confirm the alarm type according to
alarm ID table.
Alarm code
If the alarm reason originates from console or program code keywords, the console will record
the error code.
Code position
If the alarm reason originates from console or program code keywords, the console will record
the offset position of the error code in the program.
Alarm reason
Simple description of system alarm reason
000 No error
001 Keyword error
002 Motion axis conflict error
003 Axis No. error
004 Logic axis isn’t configured
005 Modbus command axis No. error
006 Motion end point position and target position error overtravel
007 Arc calculation error
008 Arc parameter error
009 Limit alarm error
010 Speed is zero
011 Variable name error
012 Parameter error
- 118 -
PMC Programmable Motion Controller
013 Bit address overtravel error
014 Register address overtravel error
015 Workpiece coordinate system doesn’t exist
016 New workpiece coordinate system repeats
017 Subroutine label error
018 Block No. error
019 Parameter file operation error
020 File name error
021 File doesn’t exist
022 Coordinate system clear error
023 Serial parameter setting error
024 IP address parameter error
025 MAC address parameter error
026 Speed mode setting error
027 Four bytes of Modbus access address aren’t aligned
028 Task doesn’t exist
029 Task already exists
030 Program loading error
031 Program file doesn’t exist
032 Task is running and can’t execute other conflicting actions
033 Program isn’t loaded
034 Task No. illegal overtravel error
035 Task uninstallation error
036 Task isn’t run
- 119 -
PMC Programmable Motion Controller
11 Precautions and troubleshooting
Precautions
Safety precautions:
1. Do not open the enclosure without permission.
2. Please cut off the power supply if the card won’t be used.
3. Do not let liquid, dust or ferrous powder enter the card.
Precautions for proper operation:
Improper operation will cause abnormal working, and even damage the card; therefore, please
follow the precautions below to operate the offline card properly.
1. If the output relay is non-solid-state relay, please connect a freewheeling diode to the relay
coil in parallel. Check whether the power supply complies with the requirement to avoid
burning the card.
2. Card life depends on the ambient temperature. If the temperature on the processing site is
too high, please install a cooling fan.
3. Avoid operating in the environment with high temperature, moisture, dust or corrosive gas.
4. Add a rubber pad for buffering in the places with strong vibration.
5. The power supply of offline card is 24VDC.
6. The voltage of output circuit is 12VDC ~ 24VDC and 24VDC is recommended.
Maintenance
Maintenance precautions
1. Before maintaining the offline card, please cut off the power supply of the main loop.
2. The operator should make sure that the power supply has been cut off to avoid accidents.
Startup precautions
Before connecting to the power supply, check whether the wires is connected properly, and
pay attention to the influence of strong current and weak current while wiring (please refer to
the circuit diagram of the control box for details).
1. Check whether the current of the drive is proper, and whether the subdivision setting is
appropriate
2. Check whether the motor and corresponding motion axis are proper
3. Check the correlation of input and output circuits
4. Check whether the power switch of the control box is disconnected
- 120 -
PMC Programmable Motion Controller
Troubleshooting
z Motion axis XYZA doesn’t act
1) Check whether XYZA output mode, direction, pulses and millimeter per rotation in [Basic
Parameter Settings] are appropriate.
2) Check whether XYZA has limit input signal in [I/O Testing]; if yes, check the wiring
3) Check whether the motor and the drive are connected properly, whether the drive and the
card are connected properly, and whether the drive provides sufficient current to drive
the motor; for servo, check whether the control mode of servo is set properly (this
software supports position control mode)
4) Check whether the motor load of XYZA is too high
z Motion axis XYZA screaming
1) Check whether the speed of XYZA is too high; generally, the step motor should run at 5-6
rotations per second when there is no load, and servo should be higher.
2) Check whether the current provided by the drive is sufficient or too high.
z The processed graphs do not have accurate size and the position has error.
1) Check whether motion axis XYZU has gap or belt toughness error.
2) Check whether the pulses and millimeter per rotation of motion axis XYZU are accurate.
- 121 -