DELTA ELECTRONICS CO., LTD.
PCI-DMC-A01
PCI-DMC-B01
High-Speed PCI 12-Axis Motion Control Card
Programming Manual
Version: 1.11.1
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
About this Manual
User Information
Please keep this manual in a safe place.
This manual is subject to change without notice due to the release of new products,
improvements and changes in technologies, and/or modifications to data and forms.
This manual may not be copied or reproduced in whole or in part without the express written
consent of Delta Electronics.
Trademarks
Windows NT/2000/XP, Visual Studio, Visual C++, Visual BASIC are all registered trademarks of
Microsoft Corporation.
BCB (Borland C++ Builder) is a registered trademark of Borland Corporation.
The names of other products are only used for identification purposes and the registered
trademarks remain the property of their respective owners.
Technical Support and Service
If you require technical support, service, or other information, or should you have any questions
about the use of this product, please visit our website
(http://www.delta.com.tw/industrialautomation ) or contact us directly. We look forward to providing
you the best possible support and service. Our contact details are provided below.
ASIA
DELTA ELECTRONICS, INC.
Taoyuan Plant 1
31-1, XINGBANG ROAD,
GUISHAN INDUSTRIAL ZONE,
TAOYUAN COUNTY 33370, TAIWAN, R.O.C.
TEL: 886-3-362-6301
FAX: 886-3-362-7267
NORTH/SOUTH AMERICA
DELTA PRODUCTS CORPORATION (USA)
Raleigh Office
P.O. BOX 12173
5101 DAVIS DRIVE,
RESEARCH TRIANGLE PARK, NC 27709, U.S.A.
TEL: 1-919-767-3813
FAX: 1-919-767-3969
JAPAN
DELTA ELECTRONICS (JAPAN), INC.
Tokyo Office
DELTA SHIBADAIMON BUILDING
2-1-14 SHIBADAIMON, MINATO-KU,
TOKYO, 105-0012, JAPAN
TEL: 81-3-5733-1111
FAX: 81-3-5733-1211
EUROPE
DELTRONICS (THE NETHERLANDS) B.V.
Eindhoven Office
DE WITBOGT 15, 5652 AG EINDHOVEN,
THE NETHERLANDS
TEL: 31-40-259-2850
FAX: 31-40-259-2851
Revised March, 2012 i
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
Table of Contents
Chapter 1 Introduction to the API Function Library --------------------------------------------------- 1-1
1.1 Using the Function Libraries ---------------------------------------------------------------------- 1-1
1.2 Edit New Project ------------------------------------------------------------------------------------- 1-1
1.2.1 Using VC ----------------------------------------------------------------------------------- 1-1
1.2.2 Using Borland C -------------------------------------------------------------------------- 1-1
1.2.3 Using VB ------------------------------------------------------------------------------------ 1-2
1.2.4 Using Delphi ------------------------------------------------------------------------------- 1-2
1.2.5 Using VB.Net ------------------------------------------------------------------------------ 1-2
1.2.6 Using C# ------------------------------------------------------------------------------------ 1-2
Chapter 2 Command Return Values and Messages --------------------------------------------------- 2-1
2.1 Error Codes ------------------------------------------------------------------------------------------- 2-1
2.2 Error Code Example -------------------------------------------------------------------------------- 2-4
Chapter 3 Operating Principles ------------------------------------------------------------------------------- 3-1
3.1 Card Initialization ------------------------------------------------------------------------------------ 3-1
3.1.1 Function List ------------------------------------------------------------------------------- 3-1
3.1.2 Sample Application ----------------------------------------------------------------------- 3-1
3.2 Read/Write Driver Parameters ------------------------------------------------------------------- 3-4
3.2.1 Function List ------------------------------------------------------------------------------- 3-4
3.2.2 Sample Application ----------------------------------------------------------------------- 3-4
3.3 CANopen Protocol ---------------------------------------------------------------------------------- 3-7
3.3.1 Function List ------------------------------------------------------------------------------- 3-7
3.3.2 Sample Application ----------------------------------------------------------------------- 3-7
3.4 Homing Motion Control ---------------------------------------------------------------------------- 3-9
3.4.1 Overview ------------------------------------------------------------------------------------ 3-9
3.4.2 Function List ------------------------------------------------------------------------------ 3-10
3.4.3 Sample Application ---------------------------------------------------------------------- 3-10
3.5 Torque Motion Control ---------------------------------------------------------------------------- 3-13
3.5.1 Function List ------------------------------------------------------------------------------ 3-13
3.5.2 Sample Application ---------------------------------------------------------------------- 3-13
3.6 Velocity Motion Control (1) ----------------------------------------------------------------------- 3-16
3.6.1 Function List ------------------------------------------------------------------------------ 3-16
3.6.2 Sample Application ---------------------------------------------------------------------- 3-16
ii Revised March, 2012
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
3.7 Velocity Motion Control (2) ----------------------------------------------------------------------- 3-19
3.7.1 Function List ------------------------------------------------------------------------------ 3-19
3.7.2 Sample Application ---------------------------------------------------------------------- 3-19
3.8 Point to Point Motion Control -------------------------------------------------------------------- 3-21
3.8.1 Overview ----------------------------------------------------------------------------------- 3-21
3.8.2 Function List ------------------------------------------------------------------------------ 3-21
3.8.3 Sample Application ---------------------------------------------------------------------- 3-22
3.9 Linear Interpolation Motion Control ------------------------------------------------------------ 3-26
3.9.1 Overview ----------------------------------------------------------------------------------- 3-26
3.9.2 Function List ------------------------------------------------------------------------------ 3-26
3.9.3 Sample Application ---------------------------------------------------------------------- 3-27
3.10 Arc Interpolation Motion Control ---------------------------------------------------------------- 3-31
3.10.1 Overview ----------------------------------------------------------------------------------- 3-31
3.10.2 Function List ------------------------------------------------------------------------------ 3-31
3.10.3 Sample Application ---------------------------------------------------------------------- 3-32
3.11 Spiral Interpolation Motion Control -Helix ---------------------------------------------------- 3-37
3.11.1 Function List ------------------------------------------------------------------------------ 3-37
3.11.2 Sample Application ---------------------------------------------------------------------- 3-37
3.12 Continuous Interpolation Motion Control ----------------------------------------------------- 3-42
3.12.1 Overview ----------------------------------------------------------------------------------- 3-42
3.12.2 Function List ------------------------------------------------------------------------------ 3-42
3.12.3 Sample Application ---------------------------------------------------------------------- 3-43
3.13 Software Limit Control ---------------------------------------------------------------------------- 3-47
3.13.1 Function List ------------------------------------------------------------------------------ 3-47
3.13.2 Sample Application ---------------------------------------------------------------------- 3-47
3.14 Synchronization Motion Control ---------------------------------------------------------------- 3-51
3.14.1 Function List ------------------------------------------------------------------------------ 3-51
3.14.2 Sample Application ---------------------------------------------------------------------- 3-51
3.15 Dwell Command ------------------------------------------------------------------------------------ 3-55
3.15.1 Function List ------------------------------------------------------------------------------ 3-55
3.15.2 Sample Application ---------------------------------------------------------------------- 3-55
3.16 Change Position ------------------------------------------------------------------------------------ 3-57
3.16.1 Function List ------------------------------------------------------------------------------ 3-57
3.16.2 Sample Application ---------------------------------------------------------------------- 3-57
3.17 Change Position ------------------------------------------------------------------------------------ 3-60
3.17.1 Function List ------------------------------------------------------------------------------ 3-60
3.17.2 Sample Application ---------------------------------------------------------------------- 3-60
Revised March, 2012 iii
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
3.18 Change Velocity ------------------------------------------------------------------------------------ 3-63
3.18.1 Function List ------------------------------------------------------------------------------ 3-63
3.18.2 Sample Application ---------------------------------------------------------------------- 3-63
3.19 Remote I/O Module-I/O Port --------------------------------------------------------------------- 3-67
3.19.1 Function List ------------------------------------------------------------------------------ 3-67
3.19.2 Sample Application ---------------------------------------------------------------------- 3-67
3.20 Remote I/O Module- Manual Pulse Generator (1) ----------------------------------------- 3-70
3.20.1 Function List ------------------------------------------------------------------------------ 3-70
3.20.2 Sample Application ---------------------------------------------------------------------- 3-70
3.21 Remote I/O Module- Manual Pulse Generator (2) ----------------------------------------- 3-73
3.21.1 Function List ------------------------------------------------------------------------------ 3-73
3.21.2 Sample Application ---------------------------------------------------------------------- 3-73
3.22 Remote Pulse Interface Module -Mode 1 ---------------------------------------------------- 3-76
3.22.1 Function List ------------------------------------------------------------------------------ 3-76
3.22.2 Sample Application ---------------------------------------------------------------------- 3-77
3.23 Remote Pulse Interface Module -Mode 2 ---------------------------------------------------- 3-83
3.23.1 Function List ------------------------------------------------------------------------------ 3-83
3.23.2 Sample Application ---------------------------------------------------------------------- 3-83
3.24 Get (Calculate) Arc Information ----------------------------------------------------------------- 3-87
3.24.1 Function List ------------------------------------------------------------------------------ 3-87
3.24.2 Sample Application ---------------------------------------------------------------------- 3-87
3.25 Control Interrupt ------------------------------------------------------------------------------------ 3-90
3.25.1 Function List ------------------------------------------------------------------------------ 3-90
3.25.2 Sample Application ---------------------------------------------------------------------- 3-90
3.26 MasterCard Security------------------------------------------------------------------------------- 3-94
3.26.1 Function List ------------------------------------------------------------------------------ 3-94
3.26.2 Sample Application ---------------------------------------------------------------------- 3-95
3.27 Remote Analog Input/Output Module ------------------------------------------------------- 3-100
3.27.1 Function List ---------------------------------------------------------------------------- 3-100
3.27.2 Sample Application -------------------------------------------------------------------- 3-101
3.28 Spiral Interpolation Moti on Control -Spiral ------------------------------------------------- 3-106
3.28.1 Function List ---------------------------------------------------------------------------- 3-106
3.28.2 Sample Application -------------------------------------------------------------------- 3-106
3.29 Position Compare -------------------------------------------------------------------------------- 3-111
3.29.1 Function List ---------------------------------------------------------------------------- 3-111
3.29.2 Sample Application -------------------------------------------------------------------- 3-112
iv Revised March, 2012
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
3.30 Axis Group ----------------------------------------------------------------------------------------- 3-116
3.30.1 Function List ---------------------------------------------------------------------------- 3-116
3.30.2 Sample Application -------------------------------------------------------------------- 3-116
3.31 Speed Continue ---------------------------------------------------------------------------------- 3-119
3.31.1 Function List ---------------------------------------------------------------------------- 3-119
3.31.2 Sample Application -------------------------------------------------------------------- 3-119
3.32 Spiral Interpolation - Helix Using -Sp1_ Normal Follow -------------------------------- 3-122
3.32.1 Function List ---------------------------------------------------------------------------- 3-122
3.32.2 Sample Application -------------------------------------------------------------------- 3-122
3.33 Logger ---------------------------------------------------------------------------------------------- 3-130
3.33.1 Function List ---------------------------------------------------------------------------- 3-130
3.33.2 Sample Application -------------------------------------------------------------------- 3-130
Chapter 4 Control API -------------------------------------------------------------------------------------------- 4-1
4.1 Data Type and Range ----------------------------------------------------------------------------- 4-1
4.2 Function Description ------------------------------------------------------------------------------- 4-2
Chapter 5 Hardware Initialization API ---------------------------------------------------------------------- 5-1
5.1 _DMC_01_open ------------------------------------------------------------------------------------- 5-2
5.2 _DMC_01_close ------------------------------------------------------------------------------------- 5-2
5.3 _DMC_01_get_CardNo_seq --------------------------------------------------------------------- 5-3
5.4 _DMC_01_pci_initial ------------------------------------------------------------------------------- 5-4
5.5 _DMC_01_get_card_version --------------------------------------------------------------------- 5-4
Chapter 6 Interface API ------------------------------------------------------------------------------------------ 6-1
6.1 _DMC_01_initial_bus ------------------------------------------------------------------------------ 6-2
6.2 _DMC_01_start_ring ------------------------------------------------------------------------------- 6-2
6.3 _DMC_01_get_device_table --------------------------------------------------------------------- 6-3
6.4 _DMC_01_get_node_table ----------------------------------------------------------------------- 6-3
6.5 _DMC_01_check_card_running ----------------------------------------------------------------- 6-4
6.6 _DMC_01_reset_card ----------------------------------------------------------------------------- 6-4
6.7 _DMC_01_check_nodeno ------------------------------------------------------------------------ 6-5
6.8 _DMC_01_get_master_connect_status ------------------------------------------------------- 6-6
6.9 _DMC_01_get_mailbox_Error ------------------------------------------------------------------- 6-6
6.10 _DMC_01_get_mailbox_cnt ---------------------------------------------------------------------- 6-7
6.11 _DMC_01_get_dsp_cnt --------------------------------------------------------------------------- 6-7
6.12 _DMC_01_set_dio_output ------------------------------------------------------------------------ 6-8
6.13 _DMC_01_get_dio_output ------------------------------------------------------------------------ 6-8
Revised March, 2012 v
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
6.14 _DMC_01_get_dio_input -------------------------------------------------------------------------- 6-9
6.15 _DMC_01_get_cycle_time ------------------------------------------------------------------------ 6-9
6.16 _DMC_01_initial_bus2 ---------------------------------------------------------------------------- 6-10
6.17 _DMC_01_motion_cnt ---------------------------------------------------------------------------- 6-10
Chapter 7 Servo Drive Parameter Read/Write API ------------------------------------------------------ 7-1
7.1 _DMC_01_read_servo_parameter ------------------------------------------------------------- 7-2
7.2 _DMC_01_write_servo_parameter ------------------------------------------------------------- 7-3
Chapter 8 Using SDO Protocol API -------------------------------------------------------------------------- 8-1
8.1 CANopen SDO protocol --------------------------------------------------------------------------- 8-2
8.2 _DMC_01_check_canopen_lock ---------------------------------------------------------------- 8-6
8.3 _DMC_01_get_canopen_ret --------------------------------------------------------------------- 8-7
8.4 _DMC_01_set_pdo_mode ------------------------------------------------------------------------ 8-8
8.5 _DMC_01_send_message ----------------------------------------------------------------------- 8-9
8.6 _DMC_01_send_message3 --------------------------------------------------------------------- 8-10
8.7 _DMC_01_read_message ----------------------------------------------------------------------- 8-11
8.8 _DMC_01_read_message2 --------------------------------------------------------------------- 8-12
8.9 _DMC_01_get_message ------------------------------------------------------------------------- 8-13
8.10 _DMC_01_reset_sdo_choke -------------------------------------------------------------------- 8-14
8.11 _DMC_01_get_sdo_retry_history -------------------------------------------------------------- 8-14
Chapter 9 Point to Point Motion Control Packet Protocol API ------------------------------------- 9-1
9.1 _DMC_01_set_sdo_driver_speed_profile ---------------------------------------------------- 9-2
9.2 _DMC_01_start_sdo_driver_r_move ----------------------------------------------------------- 9-3
9.3 _DMC_01_start_sdo_driver_a_move ---------------------------------------------------------- 9-4
9.4 _DMC_01_start_sdo_driver_new_position_move ------------------------------------------ 9-5
Chapter 10 Homing Motion Control Packet Protocol API ------------------------------------------- 10-1
10.1 _DMC_01_set_home_config -------------------------------------------------------------------- 10-2
10.2 _DMC_01_set_home_move --------------------------------------------------------------------- 10-7
10.3 _DMC_01_escape_home_move --------------------------------------------------------------- 10-8
Chapter 11 Velocity Motion Control Packet Protocol API ------------------------------------------- 11-1
11.1 _DMC_01_set_velocity_mode ------------------------------------------------------------------ 11-2
11.2 _DMC_01_set_velocity --------------------------------------------------------------------------- 11-3
11.3 _DMC_01_set_velocity_stop -------------------------------------------------------------------- 11-4
11.4 _DMC_01_set_velocity_torque_limit ---------------------------------------------------------- 11-5
vi Revised March, 2012
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
Chapter 12 Torque Motion Control Packet Protocol API -------------------------------------------- 12-1
12.1 _DMC_01_set_torque_mode ------------------------------------------------------------------- 12-2
12.2 _DMC_01_set_torque ---------------------------------------------------------------------------- 12-3
12.3 _DMC_01_set_torque_stop --------------------------------------------------------------------- 12-4
12.4 _DMC_01_set_torque_velocity_limit ---------------------------------------------------------- 12-5
Chapter 13 Using PDO Protocol API ----------------------------------------------------------------------- 13-1
13.1 _DMC_01_ipo_set_svon ------------------------------------------------------------------------- 13-2
13.2 _DMC_01_get_buffer_length ------------------------------------------------------------------- 13-3
13.3 _DMC_01_command_buf_clear ---------------------------------------------------------------- 13-4
13.4 _DMC_01_buf_dwell ------------------------------------------------------------------------------ 13-5
13.5 _DMC_01_set_group ----------------------------------------------------------------------------- 13-6
Chapter 14 Stop Motion Control API ----------------------------------------------------------------------- 14-1
14.1 _DMC_01_emg_stop ----------------------------------------------------------------------------- 14-2
14.2 _DMC_01_sd_stop -------------------------------------------------------------------------------- 14-3
14.3 _DMC_01_sd_abort ------------------------------------------------------------------------------- 14-4
14.4 _DMC_01_set_sd_mode ------------------------------------------------------------------------- 14-5
Chapter 15 Motion Status API -------------------------------------------------------------------------------- 15-1
15.1 _DMC_01_motion_done ------------------------------------------------------------------------- 15-2
15.2 _DMC_01_motion_status ------------------------------------------------------------------------ 15-3
Chapter 16 Motion Counter Value API --------------------------------------------------------------------- 16-1
16.1 _DMC_01_get_command ------------------------------------------------------------------------ 16-2
16.2 _DMC_01_set_command ------------------------------------------------------------------------ 16-2
16.3 _DMC_01_get_position--------------------------------------------------------------------------- 16-3
16.4 _DMC_01_set_position --------------------------------------------------------------------------- 16-3
16.5 _DMC_01_get_target_pos ----------------------------------------------------------------------- 16-4
16.6 _DMC_01_get_torque ---------------------------------------------------------------------------- 16-5
16.7 _DMC_01_get_current_speed ------------------------------------------------------------------ 16-6
16.8 _DMC_01_get_current_speed_rpm ----------------------------------------------------------- 16-7
Chapter 17 Software Limit API ------------------------------------------------------------------------------- 17-1
17.1 _DMC_01_set_soft_limit ------------------------------------------------------------------------- 17-2
17.2 _DMC_01_enable_soft_limit -------------------------------------------------------------------- 17-3
17.3 _DMC_01_disable_soft_limit -------------------------------------------------------------------- 17-3
17.4 _DMC_01_get_soft_limit_status --------------------------------------------------------------- 17-4
Revised March, 2012 vii
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
Chapter 18 1-Axis Motion Control API -------------------------------------------------------------------- 18-1
18.1 _DMC_01_start_tr_move ------------------------------------------------------------------------ 18-2
18.2 _DMC_01_start_sr_move ------------------------------------------------------------------------ 18-3
18.3 _DMC_01_start_ta_move ------------------------------------------------------------------------ 18-4
18.4 _DMC_01_start_sa_move ----------------------------------------------------------------------- 18-5
18.5 _DMC_01_p_change ----------------------------------------------------------------------------- 18-6
18.6 _DMC_01_v_change ------------------------------------------------------------------------------ 18-7
18.7 _DMC_01_start_tr_move_2seg ---------------------------------------------------------------- 18-9
18.8 _DMC_01_start_sr_move_2seg -------------------------------------------------------------- 18-11
18.9 _DMC_01_start_ta_move_2seg -------------------------------------------------------------- 18-12
18.10 _DMC_01_start_sa_move_2seg ------------------------------------------------------------- 18-13
18.11 _DMC_01_start_tr_move_2seg2 ------------------------------------------------------------- 18-14
18.12 _DMC_01_start_sr_move_2seg2 ------------------------------------------------------------ 18-16
18.13 _DMC_01_start_ta_move_2seg2 ------------------------------------------------------------ 18-17
18.14 _DMC_01_start_sa_move_2seg2 ----------------------------------------------------------- 18-18
18.15 _DMC_01_feedrate_overwrite ---------------------------------------------------------------- 18-19
18.16 _DMC_01_start_v3_move --------------------------------------------------------------------- 18-21
Chapter 19 2-Axis Linear Interpolation Motion Control API ---------------------------------------- 19-1
19.1 _DMC_01_start_tr_move_xy -------------------------------------------------------------------- 19-2
19.2 _DMC_01_start_sr_move_xy ------------------------------------------------------------------- 19-4
19.3 _DMC_01_start_ta_move_xy ------------------------------------------------------------------- 19-6
19.4 _DMC_01_start_sa_move_xy ------------------------------------------------------------------ 19-8
19.5 _DMC_01_start_v3_move_xy ---------------------------------------------------------------- 19-10
Chapter 20 2-Axis Arc Interpolation Motion Control API -------------------------------------------- 20-1
20.1 _DMC_01_start_tr_arc_xy ----------------------------------------------------------------------- 20-3
20.2 _DMC_01_start_sr_arc_xy ---------------------------------------------------------------------- 20-5
20.3 _DMC_01_start_ta_arc_xy ---------------------------------------------------------------------- 20-7
20.4 _DMC_01_start_sa_arc_xy ---------------------------------------------------------------------- 20-9
20.5 _DMC_01_start_tr_arc2_xy ------------------------------------------------------------------- 20-11
20.6 _DMC_01_start_sr_arc2_xy ------------------------------------------------------------------- 20-13
20.7 _DMC_01_start_ta_arc2_xy ------------------------------------------------------------------- 20-15
20.8 _DMC_01_start_sa_arc2_xy ------------------------------------------------------------------ 20-17
20.9 _DMC_01_start_tr_arc3_xy ------------------------------------------------------------------- 20-19
20.11 _DMC_01_start_ta_arc3_xy ------------------------------------------------------------------- 20-23
20.12 _DMC_01_start_sa_arc3_xy ------------------------------------------------------------------ 20-25
viii Revised March, 2012
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
20.13 _DMC_01_start_spiral_xy --------------------------------------------------------------------- 20-27
20.14 _DMC_01_start_spiral2_xy -------------------------------------------------------------------- 20-29
20.15 _DMC_01_start_v3_arc_xy -------------------------------------------------------------------- 20-31
20.16 _DMC_01_start_v3_arc2_xy ------------------------------------------------------------------ 20-33
20.17 _DMC_01_start_v3_arc3_xy ------------------------------------------------------------------ 20-35
20.18 _DMC_01_start_v3_spiral_xy ----------------------------------------------------------------- 20-37
20.19 _DMC_01_start_v3_spiral2_xy --------------------------------------------------------------- 20-39
Chapter 21 3-Axis Linear Interpolation Motion Control API ---------------------------------------- 21-1
21.1 _DMC_01_start_tr_move_xyz ------------------------------------------------------------------ 21-2
21.2 _DMC_01_start_sr_move_xyz ------------------------------------------------------------------ 21-3
21.3 _DMC_01_start_ta_move_xyz ------------------------------------------------------------------ 21-4
21.4 _DMC_01_start_sa_move_xyz ----------------------------------------------------------------- 21-5
21.5 _DMC_01_start_v3_move_xyz ----------------------------------------------------------------- 21-6
Chapter 22 3-Axis Spiral Interpolation Motion Control API ---------------------------------------- 22-1
22.1 _DMC_01_start_tr_heli_xy ---------------------------------------------------------------------- 22-2
22.2 _DMC_01_start_sr_heli_xy ---------------------------------------------------------------------- 22-4
22.3 _DMC_01_start_ta_heli_xy ---------------------------------------------------------------------- 22-6
22.4 _DMC_01_start_sa_heli_xy --------------------------------------------------------------------- 22-8
22.5 _DMC_01_start_v3_heli_xy ------------------------------------------------------------------- 22-10
Chapter 23 Velocity Motion Control API ------------------------------------------------------------------ 23-1
23.1 _DMC_01_tv_move ------------------------------------------------------------------------------- 23-2
23.2 _DMC_01_sv_move ------------------------------------------------------------------------------- 23-3
Chapter 24 Synchronization Motion Control API ------------------------------------------------------ 24-1
24.1 _DMC_01_sync_move---------------------------------------------------------------------------- 24-2
24.2 _DMC_01_sync_move_config ------------------------------------------------------------------ 24-2
Chapter 25 Remote Module Control API ------------------------------------------------------------------ 25-1
25.1 _DMC_01_get_rm_input_value ---------------------------------------------------------------- 25-2
25.2 _DMC_01_set_rm_input_filter ------------------------------------------------------------------ 25-3
25.3 _DMC_01_set_rm_input_filter_enable ------------------------------------------------------- 25-4
25.4 _DMC_01_set_rm_output_value --------------------------------------------------------------- 25-5
25.5 _DMC_01_set_rm_output_value_error_handle -------------------------------------------- 25-6
25.6 _DMC_01_get_rm_output_value --------------------------------------------------------------- 25-7
25.7 _DMC_01_get_rm_output_value_error_handle -------------------------------------------- 25-8
Revised March, 2012 ix
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
25.8 _DMC_01_set_rm_output_active -------------------------------------------------------------- 25-9
Chapter 26 MPG and JOG Operation API ----------------------------------------------------------------- 26-1
26.1 _DMC_01_set_rm_mpg_axes_enable ------------------------------------------------------- 26-2
26.2 _DMC_01_set_rm_mpg_axes_enable2 ------------------------------------------------------ 26-4
26.3 _DMC_01_set_rm_jog_axes_enable --------------------------------------------------------- 26-6
Chapter 27 4-Channel Pulse Interface API --------------------------------------------------------------- 27-1
27.1 _DMC_01_set_rm_04pi_ipulse_mode -------------------------------------------------------- 27-2
27.2 _DMC_01_set_rm_04pi_opulse_mode ------------------------------------------------------- 27-3
27.3 _DMC_01_set_rm_04pi_svon_polarity ------------------------------------------------------- 27-4
27.4 _DMC_01_set_rm_04pi_DO2 ------------------------------------------------------------------ 27-5
27.5 _DMC_01_set_rm_04pi_homing_ratio ------------------------------------------------------- 27-6
27.6 _DMC_01_04pi_set_poweron ------------------------------------------------------------------ 27-7
27.7 _DMC_01_rm_04PI_get_buffer ---------------------------------------------------------------- 27-8
Chapter 28 4-Channel Pulse Interface (Mode 1) Motion Control API ---------------------------- 28-1
28.1 _DMC_01_rm_04pi_md1_start_move -------------------------------------------------------- 28-3
28.2 _DMC_01_rm_04pi_md1_v_move ------------------------------------------------------------ 28-5
28.3 _DMC_01_rm_04pi_md1_start_line2 --------------------------------------------------------- 28-6
28.4 _DMC_01_rm_04pi_md1_start_line3 --------------------------------------------------------- 28-8
28.5 _DMC_01_rm_04pi_md1_start_line4 ------------------------------------------------------- 28-10
28.6 _DMC_01_rm_04pi_md1_start_arc --------------------------------------------------------- 28-12
28.7 _DMC_01_rm_04pi_md1_start_arc2 ------------------------------------------------------- 28-14
28.8 _DMC_01_rm_04pi_md1_start_arc3 ------------------------------------------------------- 28-16
28.9 _DMC_01_rm_04pi_md1_start_heli --------------------------------------------------------- 28-18
28.10 _DMC_01_rm_04pi_md1_p_change -------------------------------------------------------- 28-20
28.11 _DMC_01_rm_04pi_md1_v_change -------------------------------------------------------- 28-21
28.12 _DMC_01_rm_04pi_md1_set_gear --------------------------------------------------------- 28-22
28.13 _DMC_01_rm_04pi_md1_set_soft_limit --------------------------------------------------- 28-23
28.14 _DMC_01_rm_04pi_md1_get_soft_limit_status ----------------------------------------- 28-24
28.15 _DMC_01_rm_04pi_md1_set_sld ----------------------------------------------------------- 28-25
28.16 _DMC_01_rm_04pi_md1_get_mc_error_code ------------------------------------------- 28-26
28.17 _DMC_01_set_rm_04pi_ref_counter ------------------------------------------------------- 28-27
Chapter 29 4-Channel Analog Output Remote Module API ---------------------------------------- 29-1
29.1 _DMC_01_rm_04da_set_output_value ------------------------------------------------------ 29-2
29.2 _DMC_01_rm_04da_get_output_value ------------------------------------------------------ 29-3
x Revised March, 2012
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
29.3 _DMC_01_rm_04da_get_return_code ------------------------------------------------------- 29-4
29.4 _DMC_01_rm_04da_set_output_range ------------------------------------------------------ 29-5
29.5 _DMC_01_rm_04da_set_output_enable ----------------------------------------------------- 29-6
29.6 _DMC_01_rm_04da_set_output_overrange ------------------------------------------------ 29-7
29.7 _DMC_01_rm_04da_set_output_error_clear ----------------------------------------------- 29-8
29.8 _DMC_01_rm_04da_read_data ---------------------------------------------------------------- 29-9
29.9 _DMC_01_rm_04da_set_output_error_handle ------------------------------------------- 29-10
29.10 _DMC_01_rm_04da_set_output_offset_value ------------------------------------------- 29-11
29.11 _DMC_01_rm_04da_get_output_offset_value ------------------------------------------- 29-12
Chapter 30 4-Channel Analog Input Remote Module API ------------------------------------------- 30-1
30.1 _DMC_01_set_04ad_input_range ------------------------------------------------------------- 30-2
30.2 _DMC_01_get_04ad_input_range ------------------------------------------------------------- 30-3
30.3 _DMC_01_set_04ad_zero_scale -------------------------------------------------------------- 30-4
30.4 _DMC_01_get_04ad_zero_scale_status ---------------------------------------------------- 30-5
30.5 _DMC_01_set_04ad_full_scale ---------------------------------------------------------------- 30-6
30.6 _DMC_01_get_04ad_full_scale_status ------------------------------------------------------ 30-7
30.7 _DMC_01_set_04ad_conversion_time ------------------------------------------------------- 30-8
30.8 _DMC_01_get_04ad_conversion_time ------------------------------------------------------- 30-9
30.9 _DMC_01_get_04ad_data --------------------------------------------------------------------- 30-10
30.10 _DMC_01_set_04ad_average_mode ------------------------------------------------------- 30-11
30.11 _DMC_01_get_04ad_average_mode ------------------------------------------------------- 30-12
30.12 _DMC_01_set_04ad_input_enable ---------------------------------------------------------- 30-13
Chapter 31 Slave Data API ------------------------------------------------------------------------------------ 31-1
31.1 _DMC_01_get_devicetype ----------------------------------------------------------------------- 31-2
31.2 _DMC_01_get_slave_version ------------------------------------------------------------------- 31-4
Chapter 32 Parameter Monitoring API --------------------------------------------------------------------- 32-1
32.1 _DMC_01_set_monitor --------------------------------------------------------------------------- 32-2
32.2 _DMC_01_get_monitor --------------------------------------------------------------------------- 32-5
32.3 _DMC_01_get_servo_command --------------------------------------------------------------- 32-6
32.4 _DMC_01_get_servo_DI ------------------------------------------------------------------------- 32-7
32.5 _DMC_01_get_servo_DO ----------------------------------------------------------------------- 32-8
Chapter 33 Alarm Message API ------------------------------------------------------------------------------ 33-1
33.1 _DMC_01_set_ralm ------------------------------------------------------------------------------- 33-2
33.2 _DMC_01_get_alm_code ------------------------------------------------------------------------ 33-3
Revised March, 2012 xi
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
33.3 _DMC_01_master_alm_code ------------------------------------------------------------------- 33-4
33.4 _DMC_01_slave_error ---------------------------------------------------------------------------- 33-5
Chapter 34 Multi-Axis Motion Control API --------------------------------------------------------------- 34-1
34.1 _DMC_01_multi_axes_move ------------------------------------------------------------------- 34-2
34.2 _ DMC_01_liner_speed_master ---------------------------------------------------------------- 34-4
34.3 _DMC_01_start_v3_multi_axes ---------------------------------------------------------------- 34-5
Chapter 35 Buffer Operation API ---------------------------------------------------------------------------- 35-1
35.1 _DMC_01_set_trigger_buf_function ----------------------------------------------------------- 35-2
Chapter 36 Interrupt API --------------------------------------------------------------------------------------- 36-1
36.1 _DMC_01_ set_int_factor ------------------------------------------------------------------------ 36-2
36.2 _DMC_01_ int_enable ---------------------------------------------------------------------------- 36-3
36.3 _DMC_01_ int_disable --------------------------------------------------------------------------- 36-3
36.4 _DMC_01_ get_int_count ------------------------------------------------------------------------ 36-4
36.5 _DMC_01_ get_int_status ----------------------------------------------------------------------- 36-5
36.6 _DMC_01_link_ interrupt ------------------------------------------------------------------------- 36-6
Chapter 37 Security API ---------------------------------------------------------------------------------------- 37-1
37.1 _DMC_01_ read_security ------------------------------------------------------------------------ 37-2
37.2 _DMC_01_ read_security_status -------------------------------------------------------------- 37-2
37.3 _DMC_01_write_security ------------------------------------------------------------------------ 37-3
37.4 _DMC_01_ write_security_status -------------------------------------------------------------- 37-3
37.5 _DMC_01_ check_userpassword -------------------------------------------------------------- 37-4
37.6 _DMC_01_write_ userpassword --------------------------------------------------------------- 37-4
37.7 _DMC_01_check_verifykey --------------------------------------------------------------------- 37-5
37.8 _DMC_01_write_verifykey ----------------------------------------------------------------------- 37-5
37.9 _DMC_01_ read_serialno ------------------------------------------------------------------------ 37-6
37.10 misc_slave_check_userpassword ------------------------------------------------------------- 37-7
37.11 _misc_slave_write_userpassword ------------------------------------------------------------- 37-8
37.12 _misc_slave_get_serialno ----------------------------------------------------------------------- 37-9
37.13 _misc_security ------------------------------------------------------------------------------------ 37-10
37.14 _misc_slave_write_verifykey ------------------------------------------------------------------ 37-11
37.15 _misc_slave_check_verifykey ---------------------------------------------------------------- 37-12
37.16 _misc_slave_user_data_buffer_read ------------------------------------------------------- 37-13
37.17 _misc_slave_user_data_buffer_write ------------------------------------------------------- 37-14
37.18 _misc_slave_user_data_to_flash ------------------------------------------------------------ 37-15
xii Revised March, 2012
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
Chapter 38 Limit Reversal API ------------------------------------------------------------------------------- 38-1
38.1 _ DMC_01_rm_04pi_set_MEL_polarity ------------------------------------------------------ 38-2
38.2 _ DMC_01_rm_04pi_get_MEL_polarity ------------------------------------------------------ 38-3
38.3 _ DMC_01_rm_04pi_set_PEL_polarity ------------------------------------------------------- 38-4
38.4 _ DMC_01_rm_04pi_get_PEL_polarity ------------------------------------------------------- 38-5
Chapter 39 Compare API --------------------------------------------------------------------------------------- 39-1
39.1 _ DMC_01_set_compare_channel_position ------------------------------------------------ 39-2
39.2 _DMC_01_get_compare_channel_position ------------------------------------------------- 39-3
39.3 _DMC_01_set_compare_ipulse_mode ------------------------------------------------------- 39-4
39.4 _DMC_01_set_compare_channel_direction ------------------------------------------------ 39-5
39.5 _DMC_01_set_compare_channel_trigger_time -------------------------------------------- 39-6
39.6 _DMC_01_set_compare_channel_one_shot ----------------------------------------------- 39-7
39.7 _DMC_01_set_compare_channel_source --------------------------------------------------- 39-8
39.8 _DMC_01_channel0_position_cmp ----------------------------------------------------------- 39-9
39.9 _DMC_01_channel1_output_enable -------------------------------------------------------- 39-10
39.10 _DMC_01_channel1_output_mode --------------------------------------------------------- 39-11
39.11 _DMC_01_channel1_get_io_status --------------------------------------------------------- 39-13
39.12 _DMC_01_channel1_set_gpio_out ---------------------------------------------------------- 39-14
39.13 _DMC_01_channel1_position_compare_table ------------------------------------------- 39-15
39.14 _DMC_01_channel1_position_compare_table_level ----------------------------------- 39-16
39.15 _DMC_01_channel1_position_compare_table_cnt ------------------------------------- 39-17
39.16 _DMC_01_set_compare_channel_polarity ------------------------------------------------ 39-18
39.17 _DMC_01_channel0_position_cmp_by_gpio --------------------------------------------- 39-19
39.18 _DMC_01_channel1_position_re_compare_table --------------------------------------- 39-20
39.19 _DMC_01_channel1_position_re_compare_table_level ------------------------------- 39-20
Chapter 40 Linear and Arc Interpolation Motion Control API -------------------------------------- 40-1
40.1 _DMC_01_start_rline_xy ------------------------------------------------------------------------- 40-2
40.2 _DMC_01_start_rline_xyz ----------------------------------------------------------------------- 40-4
40.4 _DMC_01_start_v3_rline_xyz ------------------------------------------------------------------- 40-9
Chapter 41 Speed Continue API ----------------------------------------------------------------------------- 41-1
41.1 _DMC_01_speed_continue---------------------------------------------------------------------- 41-2
41.2 _DMC_01_speed_continue_mode ------------------------------------------------------------ 41-3
41.3 _DMC_01_speed_continue_combine_ratio ------------------------------------------------- 41-5
Revised March, 2012 xiii
PCI-DMC-A01 / PCI-DMC-B01 Programming Manual
Chapter 42 Other API -------------------------------------------------------------------------------------------- 42-1
42.1 _misc_app_get_circle_endpoint ---------------------------------------------------------------- 42-2
42.2 _misc_app_get_circle_center_point ----------------------------------------------------------- 42-3
42.3 _misc_set_record_debuging -------------------------------------------------------------------- 42-4
42.4 _misc_open_record_debuging_file ------------------------------------------------------------ 42-4
42.5 _DMC_01_enable_dda_mode ------------------------------------------------------------------ 42-5
42.6 _DMC_01_set_dda_data------------------------------------------------------------------------- 42-6
42.7 _DMC_01_get_dda_cnt -------------------------------------------------------------------------- 42-6
xiv Revised March, 2012
Chapter 1 Introduction to the API Function Library | PCI-DMC-A01 / PCI-DMC-B01
Chapter 1 Introduction to the
API Function Library
PCI-DMC-A01 provides a function library and dynamic-link library (DLL) which can be called upon
to perform functions as you require. The following sections will detail how you can incorporate
these function libraries into your development environment.
1.1 Using the Function Libraries
Once you have installed the program you will find two libraries under the “lib” folder. These
libraries are intended for use in Visual Studio C or Borland development environments.
Table 1.1
PCI_DMC_01.lib Visual Studio C function
BCBPCI_DMC_01.lib Borland C function
1.2 Edit New Project
1.2.1 Using VC
1. Add the following command to your project:
# include “..\inc\VC\PCI_DMC_01.h”
# include “..\inc\VC\PCI_DMC_01_Err.h”
2. Under the Visual C development environment, select Project / Setting / Link
Under Object / Library modules, input “..\lib\PCI_DMC_01.lib”
3. Once set, you can begin using the API to control PCI-DMC-A01.
library
library
1.2.2 Using Borland C
1. Add the following command to your project:
# include “..\inc\BCB \PCI_DMC_01.h”
# include “..\inc\BCB\PCI_DMC_01_Err.h”
Revised March, 2012 1-1
Chapter 1 Introduction to the API Function Library | PCI-DMC-A01 / PCI-DMC-B01
2. Under the Borland C++ Build development environment, select View/ Project
Manager
Add the function library “..\lib\BCBPCI_DMC_01.lib” to your new project.
3. Once set, you can begin using the API to control PCI-DMC-A01.
1.2.3 Using VB
Under the installation directory “..\ \PCI-DMC-A01\inc\VB” you will find
“PCI_DMC_01.bas” and “PCI_DMC_01_Err.bas”. Add these two files to your new
project to use the API to control PCI-DMC-A01.
1.2.4 Using Delphi
Under the installation directory “..\ \PCI-DMC-A01\inc\Delphi” you will find
“PCI_DMC_01.pas”. Add this file to your new project to use the API to control
PCI-DMC-A01.
1.2.5 Using VB.Net
Under the installation directory “..\ \PCI-DMC-A01\inc\VB.Net” you will find
“PCI_DMC_01.vb” and “PCI_DMC_01_ERR.vb”. Add these two files to your new
project to use the API to control PCI-DMC-A01.
1.2.6 Using C#
In the installation directory “..\ \PCI-DMC-A01\inc\C#” you will find “PCI_DMC_01.css”
and “PCI_DMC_01_ERR.cs”. Add these two files to your new project to use the API to
control PCI-DMC-A01.
1-2 Revised March, 2012
Chapter 2 Command Return Values and Messages | PCI-DMC-A01 / PCI-DMC-B01
Chapter 2 Command Return Values
2.1 Error Codes
When you use API for PCI-DMC-A01, the function library will generally return one of the
error codes listed in Table 2.1.
If the API function's return value is 0, then the API function was executed successfully. If
the API function returns some other error code, then an error may have occurred during
operation or in the hardware connection. You can troubleshoot the problem by referring to
the error code description.
and Messages
Table 2.1
Error Return
Code
(Decimal)
0 ERR_NoError API executed successfully
3 ERR_CardNoError
5 ERR_bootmodeErr Unable to boot DSP procedure
6 ERR_downloadcode DSP memory program read/write error
7 ERR_downloadinit DSP memory data read/write error
8 ERR_PCI_boot_first
11 ERR_AxisNoError Axis number error (too large)
12 ERR_IPO_First Must be in IPO mode
13 ERR_Target_reach Target must be in position for Mode 1 operation
14 ERR_Servo_on_first Must be set to Servo on
15 ERR_MPG_Mode
Error Code Error Description
Card number error. Please check the number set
by the DIP Switch on the card.
“_DMC_01_pci_initial” AP function must be
launched first
Unable to clear position in Manual Pulse
Generator (MPG) mode
16 ERR_PDO_TG
17 ERR_ConfigFileOpenError Error opening configuration file
18 ERR_Ctrl_value Command code error
19 ERR_Security_Fifo Write error using Security Fpga
20 ERR_Security_Fifo_busy Security Fpga is busy
Revised March, 2012 2-1
Unable to return acknowledgement when sending
command to module in PDO mode
Chapter 2 Command Return Values and Messages | PCI-DMC-A01 / PCI-DMC-B01
Error Return
Code
Error Code Error Description
(Decimal)
21 ERR_SpeedLimitError Defined velocity exceeds maximum velocity
22 ERR_Security_Page Security page must be smaller than 16
23 ERR_Slave_Security_op Security slave_operate command failed
24 ERR_channel_no channel no error
“_DMC_01_pci_initial” AP function must be
25 ERR_start_ring_first
launched first
26 ERR_NodeIDError NodeID does not exist
27 ERR_MailBoxErr DSP busy, unable to send command
28 ERR_SdoData SDO data sent, but no response received
29 ERR_IOCTL Operating system unable to process this IRP
30 ERR_SdoSvonFirst Servo On required to use SDO axis control
31 ERR_SlotIDError No such Slot ID for Slave module (GA or RM)
32 ERR_PDO_First PDO protocol mode required to use PDO protocol
33 ERR_Protocal_build Protocol, not built
34 ERR_Maching_TimeOut Module matching time-out
35 ERR_Maching_NG Module matching failed
40 ERR_Master_Security_Wr Security Master Write command failed
41 ERR_Master_Security_Rd Security Master Read command failed
42 ERR_Master_Security_Pw Correct password required
Master Card version error. Please contact
50 ERR_NonSupport_CardVer
distributor to purchase the correct Master Card
51 ERR_Compare_Source Ver Type: B Compare Source selection error
Compare direction error; dir must be set to 1 or 0
52 ERR_Compare_Direction
(1:ccw, 0:cw)
112 ERR_RangeError Axis number error
114 ERR_MotionBusy Motion command overlap
116 ERR_SpeedError Maximum velocity set to 0
ERR_AccTimeError Acceleration/deceleration time greater than 1000
117
sec
124 ERR_PitchZero Screw displacement parameter “pitch” set to 0
127 ERR_BufferFull Motion command buffer is full
128 ERR_PathError Motion command error
130 ERR_NoSupportMode Velocity change not supported
ERR_FeedHold_support Feedhold Stop enabled. Unable to receive new
132
commands
2-2 Revised March, 2012
Error Return
Chapter 2 Command Return Values and Messages | PCI-DMC-A01 / PCI-DMC-B01
Code
Error Code Error Description
(Decimal)
ERR_SDStop_On Currently executing deceleration/stop command,
133
Unable to receive new commands
ERR_VelChange_supper Unable to execute velocity change function
134
(Feedhold, Synch, and Deceleration)
135 ERR_Command_set Unable to repeat FeedHold command
ERR_sdo_message_choke Sdo command return error. Please check
136
network connection
ERR_VelChange_buff_feedh
Feedhold function must be enabled first. Unable
137
old
to change velocity
ERR_VelChange_sync_move Waiting for sync command, unable to change
138
velocity
ERR_VelChange_SD_On Waiting for decelerate command, unable to
139
change velocity
ERR_P_Change_Mode Single axis point to point mode. Acceleration
140
segment's velocity is 0. Non-single axis point to
point mode
When mode is
_Path_p_change,_Path_velocity_change_onfly,
141 ERR_BufferLength
_Path_Start_Move_2seg then Buffer Length
must be 0
142 ERR_2segMove_Dist Distance must be in same direction
143 ERR_CenterMatch Center must match
144 ERR_EndMatch Center must match
145 ERR_AngleCalcu Angle calculation error
146 ERR_RedCalcu Radius calculation error
147 ERR_GearSetting Gear numerator or denominator is 0
Table Setting First Array Point Error, Table
148 ERR_CamTable
setting cannot be negative; table[-1] does not
exist
ERR_AxesNum Number of axes must be set to at least 2 for
149
multiple axes settings
150 ERR_SpiralPos Final position will be the center of the spiral
Revised March, 2012 2-3
Chapter 2 Command Return Values and Messages | PCI-DMC-A01 / PCI-DMC-B01
2.2 Error Code Example
The following example is a return function. You can use it as a reference to create new
functions that meet your control requirements.
Example
Void error (unsigned short rc) // Function that returns error code; rc is the parsed return
value
{
Switch(rc)
{
Case 3:
printf(“Card No. Error, Please check Card No. again.”);
break;
default:
break;
}
2-4 Revised March, 2012
Chapter 3 Operating Principles
3.1 Card Initialization
3.1.1 Function List
_DMC_01_open
_DMC_01_get_CardNo_seq
_DMC_01_check_card_running
_DMC_01_reset_card
_DMC_01_close
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
Table 3.1
Function Name
_DMC_01_pci_initial
_DMC_01_initial_bus
_DMC_01_start_ring
_DMC_01_get_device_table
_DMC_01_get_node_table
3.1.2 Sample Application
Program Appearance
Figure 3.1
1) Open card
Figure 3.2
Revised March, 2012 3-1
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
Click on the “Open card” button to execute the following procedure:
/* gDMCExistCards variable is set as the number of PCI-DMC-A01 on the PC*/
rt = _DMC_01_open(&gDMCExistCards);
2) Card initialization
Figure 3.3
Click on the “Card init” button to execute the following procedure:
for(i=0; i<gDMCExistCards; i++)
{
/* Get the card number of the i-th card on the PC. Card number is the value set by
the DIP Switch*/
rt = _DMC_01_get_CardNo_seq(i, &CardNo);
gpDMCCardNoList[i] = CardNo;
/*Check to see if the card has been initialized. If the value is 0, then the card has not
been initialized .*/
rt = _DMC_01_check_card_running(gpDMCCardNoList[i], &running);
if(running == 0) {
rt = _DMC_01_pci_initial(gpDMCCardNoList[i]); // Initialize card
if(rt != 0) AfxMessageBox(“Can't boot PCI_DMC_01 Master Card!”);
}
rt = _DMC_01_initial_bus(gpDMCCardNoList[i]); // Initialization communications
protocol
gbpDSPBoot[gpDMCCardNoList[i]] = true;
}
3) Establish communications
Figure 3.4
Click on the “Find slave” button to execute the following procedure:
rt = _DMC_01_start_ring(gDMCCardNo, 0); // Begin communications
rt = _DMC_01_get_device_table(gDMCCardNo, &gpDeviceInfo[gDMCCardNo]);
rt = _DMC_01_get_node_table(gDMCCardNo, &gpSlaveTable[0][gDMCCardNo]);
Once the above procedure has been executed, the detected Slave device is
displayed in the “Slave num” field.
3-2 Revised March, 2012
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
NOTE
_DMC_01_get_device_table Get the Slot ID using the PDO protocol
Example: gpDeviceInfo[gDMCCardNo] is a “WORD” type variable. If its value is 7,
the binary form is expressed as “0000 0000 0000 0111”, so Slave devices with Slot
IDs “1”, “2” and “3” exist.
_DMC_01_get_node_table Get Node ID using SDO protocol.
Example: gpSlaveTable[0][gDMCCardNo] is a “DWORD” type variable. If its value is
7, the binary form is expressed as “0000 0000 0000 0000 0000 0000 0000 0111”, so
Slave devices with Node ID “1”, “2”, and “3” exist.
※ You can use the following algorithm to find the Node ID for SDO.
lMask = 0x1;
for(i=0; i<32; i++)
{
/* Condition is met when the i-th bit is 1. */
if((gpSlaveTable[0][gDMCCardNo]>>i) & lMask) {
/* The derived i-th value +1 is the Node ID and corresponds to servo parameter
“P3-00” */
gpNodeID[gNodeNum] = (unsigned short)(i+1);
gNodeNum++;
}
}
4) Exit procedure
Figure 3.5
Click on the “Exit” button to execute the following procedure:
for(i=0; i<gDMCExistCards; i++) {
rt = _DMC_01_reset_card(gpDMCCardNoList[i]); // Reset card
}
_DMC_01_close(); // Shut down PCI-DMC-A01
Revised March, 2012 3-3
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
3.2 Read/Write Driver Parameters
3.2.1 Function List
Table 3.2
Function Name
_DMC_01_set_pdo_mode
_DMC_01_read_servo_parameter
_DMC_01_write_servo_parameter
3.2.2 Sample Application
Program Appearance
Figure 3.6
1) Card Initialization and Mode Switching
Figure 3.7
Click on “Open card” to execute card initialization and set SDO mode.
For detailed instructions on card initialization, please refer to the functions described
in Section 3.1 between “Open card” and “Establish communications”.
Setting the SDO mode will use the following API function:
/* Set Slave communications to SDO mode */
rt = _DMC_01_set_pdo_mode(gDMCCardNo, gpNodeID[i], SlotID, 0);
3-4 Revised March, 2012
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
The last argument [Enable] is used to set whether PDO mode is used for Slave
communications or not. Please refer to the section on this function for a more
detailed description of this argument.
In the above example, the value of the argument is 0. This means PDO mode is
disabled during Slave communication.
If you set PDO mode to disabled, then Slave communications will use the SDO
protocol. If you need to use the SDO protocol to control the slave, you must set the
value of this argument to zero.
2) Input the servo to change (Including Node ID, Group No. and Index value)
Figure 3.8
For example, you can enter the values shown below in Fig. 3.8.
1st field - “Node ID ”: If the value is 1, then it will operate the servo with Node ID 1.
2nd field - “Slot ID ”: This field cannot be changed. It shows the current Slave
device (Servo's Slot ID is 0).
3rd Field - “Group ”: Refers to the group number. of the device (usually a
servo). For a more detailed description of group number,
please refer to the “ASDA-A2 User Manual”. If Group is set to
0 as shown in Fig. 3.8, this means this will set the servo
parameter for “P0-xx” (the value of xx is explained below under
Index).
4th field - “Index ”: As noted above, this value depends on the value for Group.
In Fig. 3.8, index has a value of 0 so in this case, read/write will
be carried on the “P0-00” parameter of Servo with Node ID of 1.
3) Read servo parameter
Figure 3.9
Click on the “Read” button to execute the following procedure:
rt = _DMC_01_read_servo_parameter(gDMCCardNo, NodeID, SlotID, group, idx,
&data);
// A data value will be returned. The value will be current value set for this servo
parameter.
// The value of rt will be displayed in the “RC” field while the value of data will be
displayed in the “Data” field.
Revised March, 2012 3-5
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
4) Write servo parameter
Figure 3.10
As shown in Fig. 3.10, if you wish to write a parameter value to servo then you must
input the desired value in the edit box and then click on the “Write” button to execute
the following procedure:
rt = _DMC_01_write_servo_parameter(gDMCCardNo, NodeID, SlotID, group, idx,
data);
//The value will be written to the servo group parameter you set. Please refer to the
previous section for a detailed description.
5) Exit procedure
Click on the “Exit” button to quit and exit the procedure.
“_DMC_01_reset_card” and “_DMC_01_close” must be executed to exit this
function. Please refer to Section 3.12 “Exit procedure” for the function operations.
3-6 Revised March, 2012
3.3 CANopen Protocol
3.3.1 Function List
_DMC_01_set_pdo_mode
_DMC_01_send_message
_DMC_01_read_message
_DMC_01_get_message
3.3.2 Sample Application
Program Appearance
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
Table 3.3
Function Name
Figure 3.11
1) Initialize card and set Slave communications to SDO mode.
Click on the “Open card” button shown in Fig. 3.11 to initialize card and set SDO
mode.
A description of this button is provided in Section 3.2.2 “Card Initialization and Mode
Switching”.
2) Send SDO protocol command
Figure 3.12
Revised March, 2012 3-7
Chapter 3 Operating Principles | PCI-DMC-A01 / PCI-DMC-B01
You input the value of the “NodeID”. The value will reflect the Slave ID you wish to
set up.
Please refer to th CANopen manual (DS 402) for setting the “Index”, “Sub” and
“Type” values.
The values “D0” to “D3” are used to input the SDO command data you wish to set
(Valid data: Byte).
Once you enter the above data, click on the “Send” button to execute the following
API function:
rt = _DMC_01_send_message(gDMCCardNo, NodeID, SlotID, Index, SubIdx,
DataType, Value0, Value1, Value2, Value3);
3) Command for reading SDO protocol
Figure 3.13
Click on the “Read” button to execute the following procedure:
/* Get the returned data for the last SDO command you sent*/
rt = _DMC_01_read_message(gDMCCardNo, &Cmd, & COBID, &DataType,
&Value0, &Value1, &Value2, &Value3);
You can create some variables to store the data returned by SDO commands. For
detailed description of the returned data, please see Section 8.8.
4) Command for getting SDO protocol
Figure 3.14
You must enter the corresponding Node ID, Object Dictionary (OD) index and
sub-index to get the information you want to know from the CANopen interface
protocol. Once you enter the data, click on the “Get” button to execute:
rt = _DMC_01_get_message(gDMCCardNo, NodeID, SlotID, Index, SubIndex,
&COBID, &Cmd , &DataType, &Value0, &Value1, &Value2, &Value3);
You can create some variables to store the data returned by SDO commands. For
detailed description of the returned data, please see Section 8.9.
5) Exit procedure
Click on the “Exit” button to quit and exit the procedure.
3-8 Revised March, 2012