1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185
//using	System;
using	System.Runtime.InteropServices;

namespace OnlineStore.DeviceLibrary
{
	public class CSmc
	{
		//*******************************************************
		//       API-SMC(WDM)
		//       FILE NAME       CSMC.CS
		//********************************************************
		/* --------- THESE STRUCTS ARE USED BY USER --------- */
		//-----------------------------
		// API-SMC(WDM) Function List
		//-----------------------------
		[DllImport("CSmc.dll")] static extern int SmcWGetDeviceInfo(string Device, short InfoType, ref int Param1, ref int Param2, ref int Param3);
		[DllImport("CSmc.dll")] static extern int SmcWQueryDeviceName(short Index, System.Text.StringBuilder DeviceName, System.Text.StringBuilder Device);
		
		//---------------------------
		// Initialization Functions
		//---------------------------
		[DllImport("CSmc.dll")] static extern int SmcWInit(string DeviceName, ref short DevId);
		[DllImport("CSmc.dll")] static extern int SmcWExit(short DevId);
		[DllImport("CSmc.dll")] static extern int SmcWGetErrorString(int ErrorCode, System.Text.StringBuilder ErrorString);

		//---------------------------------------
		// Initial Parameters Setting Functions
		//---------------------------------------
		[DllImport("CSmc.dll")] static extern int SmcWSetPulseType(short DevId, short AxisNo, short PulseMode, short DirTimer);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulseType(short DevId, short AxisNo, ref short PulseMode, ref short DirTimer);
		[DllImport("CSmc.dll")] static extern int SmcWSetPulseDuty(short DevId, short AxisNo, short Duty);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulseDuty(short DevId, short AxisNo, ref short Duty);
		[DllImport("CSmc.dll")] static extern int SmcWSetEncType(short DevId, short AxisNo, short EncType);
		[DllImport("CSmc.dll")] static extern int SmcWGetEncType(short DevId, short AxisNo, ref short EncType);
		[DllImport("CSmc.dll")] static extern int SmcWSetCtrlTypeOut(short DevId, short AxisNo, short CtrlOut1, short CtrlOut2, short CtrlOut3);
		[DllImport("CSmc.dll")] static extern int SmcWGetCtrlTypeOut(short DevId, short AxisNo, ref short CtrlOut1, ref short CtrlOut2, ref short CtrlOut3);
		[DllImport("CSmc.dll")] static extern int SmcWSetCtrlTypeIn(short DevId, short AxisNo, short CtrlIn);
		[DllImport("CSmc.dll")] static extern int SmcWGetCtrlTypeIn(short DevId, short AxisNo, ref short CtrlIn);
		[DllImport("CSmc.dll")] static extern int SmcWSetOrgLog(short DevId, short AxisNo, short OrgLog);
		[DllImport("CSmc.dll")] static extern int SmcWGetOrgLog(short DevId, short AxisNo, ref short OrgLog);
		[DllImport("CSmc.dll")] static extern int SmcWSetCtrlInOutLog(short DevId, short AxisNo, short CtrlInOutLog);
		[DllImport("CSmc.dll")] static extern int SmcWGetCtrlInOutLog(short DevId, short AxisNo, ref short CtrlInOutLog);
		[DllImport("CSmc.dll")] static extern int SmcWSetErcMode(short DevId, short AxisNo, short ErcMode);
		[DllImport("CSmc.dll")] static extern int SmcWGetErcMode(short DevId, short AxisNo, ref short ErcMode);
		[DllImport("CSmc.dll")] static extern int SmcWSetErcAlmClearTime(short DevId, short AxisNo, short ErcTime, short ErcOffTimer, short AlmTime);
		[DllImport("CSmc.dll")] static extern int SmcWGetErcAlmClearTime(short DevId, short AxisNo, ref short ErcTime, ref short ErcOffTimer, ref short AlmTime);
		[DllImport("CSmc.dll")] static extern int SmcWSetOrgMode(short DevId, short AxisNo, short LimitTurn, short OrgType, short EndDir, short ZCount);
		[DllImport("CSmc.dll")] static extern int SmcWGetOrgMode(short DevId, short AxisNo, ref short LimitTurn, ref short OrgType, ref short EndDir, ref short ZCount);
		[DllImport("CSmc.dll")] static extern int SmcWSetSAccelType(short DevId, short AxisNo, short SAccelType);
		[DllImport("CSmc.dll")] static extern int SmcWGetSAccelType(short DevId, short AxisNo, ref short SAccelType);
		[DllImport("CSmc.dll")] static extern int SmcWSetInFilterType(short DevId, short AxisNo, short FilterType);
		[DllImport("CSmc.dll")] static extern int SmcWGetInFilterType(short DevId, short AxisNo, ref short FilterType);
		[DllImport("CSmc.dll")] static extern int SmcWSetSDMode(short DevId, short AxisNo, short SDMode);
		[DllImport("CSmc.dll")] static extern int SmcWGetSDMode(short DevId, short AxisNo, ref short SDMode);
		[DllImport("CSmc.dll")] static extern int SmcWSetCounterMode(short DevId, short AxisNo, short ClrCounterLtc, short LtcMode, short ClrCounterClr, short ClrMode);
		[DllImport("CSmc.dll")] static extern int SmcWGetCounterMode(short DevId, short AxisNo, ref short ClrCounterLtc, ref short LtcMode, ref short ClrCounterClr, ref short ClrMode);
		[DllImport("CSmc.dll")] static extern int SmcWSetSoftLimit(short DevId, short AxisNo, short PLimMode, short MLimMode, int PLimCount, int MLimCount);
		[DllImport("CSmc.dll")] static extern int SmcWGetSoftLimit(short DevId, short AxisNo, ref short PLimMode, ref short MLimMode, ref int PLimCount, ref int MLimCount);
		[DllImport("CSmc.dll")] static extern int SmcWSetInitParam(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWGetInitParam(short DevId, short AxisNo, ref short InitParam);

		//------------------------------------
		// Basic Operation Setting Functions
		//------------------------------------
		[DllImport("CSmc.dll")] static extern int SmcWSetReady(short DevId, short AxisNo, short MotionType, short StartDir);
		[DllImport("CSmc.dll")] static extern int SmcWGetReady(short DevId, short AxisNo, ref short MotionType, ref short StartDir);
		[DllImport("CSmc.dll")] static extern int SmcWSetResolveSpeed(short DevId, short AxisNo, double ResolveSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetResolveSpeed(short DevId, short AxisNo, ref double ResolveSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetStartSpeed(short DevId, short AxisNo, double StartSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetStartSpeed(short DevId, short AxisNo, ref double StartSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetTargetSpeed(short DevId, short AxisNo, double TargetSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetTargetSpeed(short DevId, short AxisNo, ref double TargetSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetAccelTime(short DevId, short AxisNo, double AccelTime);
		[DllImport("CSmc.dll")] static extern int SmcWGetAccelTime(short DevId, short AxisNo, ref double AccelTime);
		[DllImport("CSmc.dll")] static extern int SmcWSetDecelTime(short DevId, short AxisNo, double DecelTime);
		[DllImport("CSmc.dll")] static extern int SmcWGetDecelTime(short DevId, short AxisNo, ref double DecelTime);
		[DllImport("CSmc.dll")] static extern int SmcWSetSSpeed(short DevId, short AxisNo, double SSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetSSpeed(short DevId, short AxisNo, ref double SSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetStopPosition(short DevId, short AxisNo, short Coodinate, int StopPosition);
		[DllImport("CSmc.dll")] static extern int SmcWGetStopPosition(short DevId, short AxisNo, short Coodinate, ref int StopPosition);
		[DllImport("CSmc.dll")] static extern int SmcWSetSync(short DevId, short SyncAxis, short SyncChip, short SyncBoard);
		[DllImport("CSmc.dll")] static extern int SmcWGetSync(short DevId, ref short SyncAxis, ref short SyncChip, ref short SyncBoard);
		[DllImport("CSmc.dll")] static extern int SmcWSetZCountMotion(short DevId, short AxisNo, short ZMoveCount, short ZLog);
		[DllImport("CSmc.dll")] static extern int SmcWGetZCountMotion(short DevId, short AxisNo, ref short ZMoveCount, ref short ZLog);

		//----------------------------------------
		//  Extended Operation Setting Functions 
		//----------------------------------------
		[DllImport("CSmc.dll")] static extern int SmcWSetBankNumber(short DevId, short AxisNo, short BankNum);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankNumber(short DevId, short AxisNo, ref short BankNum);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankReady(short DevId, short AxisNo, short MotionType);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankReady(short DevId, short AxisNo, ref short MotionType);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankDistance(short DevId, short AxisNo, short BankNo, int StopPosition);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankDistance(short DevId, short AxisNo, short BankNo, ref int StopPosition);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankResolveSpeed(short DevId, short AxisNo, short BankNo, double ResolveSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankResolveSpeed(short DevId, short AxisNo, short BankNo, ref double ResolveSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankStartSpeed(short DevId, short AxisNo, short BankNo, double StartSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankStartSpeed(short DevId, short AxisNo, short BankNo, ref double StartSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankTargetSpeed(short DevId, short AxisNo, short BankNo, double TargetSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankTargetSpeed(short DevId, short AxisNo, short BankNo, ref double TargetSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankAccelTime(short DevId, short AxisNo, short BankNo, double AccelTime);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankAccelTime(short DevId, short AxisNo, short BankNo, ref double AccelTime);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankDecelTime(short DevId, short AxisNo, short BankNo, double DecelTime);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankDecelTime(short DevId, short AxisNo, short BankNo, ref double DecelTime);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankSSpeed(short DevId, short AxisNo, short BankNo, double SSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankSSpeed(short DevId, short AxisNo, short BankNo, ref double SSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankInterpolation(short DevId, short AxisNo, short BankNo, short InterType, short InterAxis, short Reserved);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankInterpolation(short DevId, short AxisNo, short BankNo, ref short InterType, ref short InterAxis, ref short Reserved);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankArcPoint(short DevId, short AxisNo, short BankNo, double ArcSpeed, int Center_X, int Center_Y, int End_X, int End_Y);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankArcPoint(short DevId, short AxisNo, short BankNo, ref double ArcSpeed, ref int Center_X, ref int Center_Y, ref int End_X, ref int End_Y);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankArcParam(short DevId, short AxisNo, short BankNo, short ArcStrtDir, short AutoEndPointPull);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankArcParam(short DevId, short AxisNo, short BankNo, ref short ArcStrtDir, ref short AutoEndPointPull);
		[DllImport("CSmc.dll")] static extern int SmcWSetBankContinuation(short DevId, short AxisNo, short BankNo, int ContType);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankContinuation(short DevId, short AxisNo, short BankNo, ref int ContType);

		//-----------------------------------
		// Control Signal Setting Functions
		//-----------------------------------
		[DllImport("CSmc.dll")] static extern int SmcWSetAlarmClear(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWSetLimitMask(short DevId, short AxisNo, short LimitMask, short LimitMaskEnable);
		[DllImport("CSmc.dll")] static extern int SmcWGetLimitMask(short DevId, short AxisNo, ref short LimitMask);
		[DllImport("CSmc.dll")] static extern int SmcWSetDigitalOut(short DevId, short AxisNo, short OutData, short OutDataEnable);
		[DllImport("CSmc.dll")] static extern int SmcWGetDigitalOut(short DevId, short AxisNo, ref short OutData);
		[DllImport("CSmc.dll")] static extern int SmcWGetDigitalIn(short DevId, short AxisNo, ref short InData);
		[DllImport("CSmc.dll")] static extern int SmcWSetHoldOff(short DevId, short AxisNo, short HoldOff);
		[DllImport("CSmc.dll")] static extern int SmcWGetHoldOff(short DevId, short AxisNo, ref short HoldOff);
		[DllImport("CSmc.dll")] static extern int SmcWSetErcOut(short DevId, short AxisNo, short ErcOn);
		[DllImport("CSmc.dll")] static extern int SmcWGetAlarmCode(short DevId, short AxisNo, ref short AlarmCode);

		//----------------------------------
		// Operation Status Read Functions
		//----------------------------------
		[DllImport("CSmc.dll")] static extern int SmcWSetOutPulse(short DevId, short AxisNo, int OutPulse);
		[DllImport("CSmc.dll")] static extern int SmcWGetOutPulse(short DevId, short AxisNo, ref int OutPulse);
		[DllImport("CSmc.dll")] static extern int SmcWSetCountPulse(short DevId, short AxisNo, int CountPulse);
		[DllImport("CSmc.dll")] static extern int SmcWGetCountPulse(short DevId, short AxisNo, ref int CountPulse);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulseStatus(short DevId, short AxisNo, ref short PulseSts);
		[DllImport("CSmc.dll")] static extern int SmcWGetMoveStatus(short DevId, short AxisNo, ref short MoveSts);
		[DllImport("CSmc.dll")] static extern int SmcWGetStopStatus(short DevId, short AxisNo, ref short StopSts);
		[DllImport("CSmc.dll")] static extern int SmcWGetLimitStatus(short DevId, short AxisNo, ref short LimitSts);
		[DllImport("CSmc.dll")] static extern int SmcWGetLatchOutPulse(short DevId, short AxisNo, ref int OutPulse);
		[DllImport("CSmc.dll")] static extern int SmcWGetLatchCountPulse(short DevId, short AxisNo, ref int CountPulse);
		[DllImport("CSmc.dll")] static extern int SmcWGetBankNo(short DevId, short AxisNo, ref short BankNo);
		[DllImport("CSmc.dll")] static extern int SmcWGetMoveSpeed(short DevId, short AxisNo, ref double MoveSpeed);
		[DllImport("CSmc.dll")] static extern int SmcWGetZCount(short DevId, short AxisNo, ref short MoveZCount);
        [DllImport("CSmc.dll")] static extern int SmcWGetCtrlInOutStatus(short DevId, short AxisNo, ref short CtrlSts);

		//-----------------------------
		// Motor Operation Functions
		//-----------------------------
		[DllImport("CSmc.dll")] static extern int SmcWMotionStart(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWMotionStop(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWMotionDecStop(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWMotionChange(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWSetMotionChangeReady(short DevId, short AxisNo, short ChangeType);
		[DllImport("CSmc.dll")] static extern int SmcWGetMotionChangeReady(short DevId, short AxisNo, ref short ChangeType);
		[DllImport("CSmc.dll")] static extern int SmcWSyncMotionStart(short DevId, short AxisNo);

		//------------------
		// Event Functions
		//------------------
		[DllImport("CSmc.dll")] static extern int SmcWStopEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode);
		[DllImport("CSmc.dll")] static extern int SmcWBankEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode, short BankNo);
		[DllImport("CSmc.dll")] static extern int SmcWCountEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode, short CountType, int Count);
		[DllImport("CSmc.dll")] static extern int SmcWIrqEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode, short EventType);

		//------------------
		// FIFOLatch Functions
		//------------------
		[DllImport("CSmc.dll")] static extern int SmcWResetLatchFIFO(short DevId);
		[DllImport("CSmc.dll")] static extern int SmcWSetFIFOLatchSrc(short DevId, short AxisNo, short LatchAxisNo, short Enable);
		[DllImport("CSmc.dll")] static extern int SmcWGetFIFOLatchSrc(short DevId, short AxisNo, ref short LatchAxisNo, ref short Enable);
        [DllImport("CSmc.dll")]
        static extern int SmcWGetLatchDataFromBuffer(short DevId, short BufferNo, ref short AxisCounterNo, ref short LatchDataCnt, [MarshalAs(UnmanagedType.LPArray)] int[] LatchDataTable);
		[DllImport("CSmc.dll")] static extern int SmcWGetLatchFIFOLength(short DevId, short AxisNo, ref short length);
        [DllImport("CSmc.dll")]
        static extern int SmcWGetLatchDataFromBufferEx(short DevId, short BufferNo, ref short AxisCounterNo, ref short LatchDataCnt, [MarshalAs(UnmanagedType.LPArray)] int[] LatchDataTable, ref short UpCnt, ref short DownCnt);
		[DllImport("CSmc.dll")] static extern int SmcWResetAxisLatchFIFO( short DevId, short AxisBitNo, short Reserved);
		[DllImport("CSmc.dll")] static extern int SmcWResetFIFOLatchSrc( short DevId, short AxisNo);

		//------------------
		// TriggerOut Functions
		//------------------
		[DllImport("CSmc.dll")] static extern int SmcWSetTrgOutCPWidth(short DevId, short AxisNo, short Width);
		[DllImport("CSmc.dll")] static extern int SmcWGetTrgOutCPWidth(short DevId, short AxisNo, ref short Width);
		[DllImport("CSmc.dll")] static extern int SmcWSetTrgOutCPDelay(short DevId, short AxisNo, short DelayTime);
		[DllImport("CSmc.dll")] static extern int SmcWGetTrgOutCPDelay(short DevId, short AxisNo, ref short DelayTime);
		[DllImport("CSmc.dll")] static extern int SmcWSetTrgOutData(short DevId, short FifoNo, short CntType, short OutAxisEnable, int FifoData);
		[DllImport("CSmc.dll")] static extern int SmcWTrgOutEvent(short DevId, int hMsgWnd, short EventMode, short EventType);
		[DllImport("CSmc.dll")] static extern int SmcWGetTrgOutStatus(short DevId, ref short TrgOutSts, ref short TrgOutErrSts);
		[DllImport("CSmc.dll")] static extern int SmcWResetTrgOutStatus(short DevId, short EnableStsReset, short EnableErrStsReset, ref short TrgOutSts, ref short TrgOutErrSts);
		[DllImport("CSmc.dll")] static extern int SmcWGetTrgOutDataRemainNum(short DevId, short FifoNo, ref int DataNum);
		[DllImport("CSmc.dll")] static extern int SmcWResetTrgOutFIFO(short DevId, short FifoBitNo);
		[DllImport("CSmc.dll")] static extern int SmcWSetTrgOutStart(short DevId);
		[DllImport("CSmc.dll")] static extern int SmcWSetTrgOutStop(short DevId);
		[DllImport("CSmc.dll")] static extern int SmcWSetTrgOutAxis(short DevId, short FifoNo, short CmpAxis, short OutAxis);
		[DllImport("CSmc.dll")] static extern int SmcWGetTrgOutAxis(short DevId, short FifoNo, ref short CmpAxis, ref short OutAxis);
		[DllImport("CSmc.dll")] static extern int SmcWResetTrgOutAxis(short DevId, short FifoBitNo);

		//------------------
		// Manual Pulser Functions
		//------------------
		[DllImport("CSmc.dll")] static extern int SmcWSetPulserType(short DevId, short AxisNo, short InputType, short PulserDir);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulserType(short DevId, short AxisNo, ref short InputType, ref short PulserDir);
		[DllImport("CSmc.dll")] static extern int SmcWSetPulserParam(short DevId, short AxisNo, double SpeedLimit, int Distance);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulserParam(short DevId, short AxisNo, ref double SpeedLimit, ref int Distance);
		[DllImport("CSmc.dll")] static extern int SmcWSetPulserRatio(short DevId, short AxisNo, short Magnification, short Division);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulserRatio(short DevId, short AxisNo, ref short Magnification, ref short Division);
		[DllImport("CSmc.dll")] static extern int SmcWSetPulserReady(short DevId, short AxisNo, short PulserMode);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulserReady(short DevId, short AxisNo, ref short PulserMode);
		[DllImport("CSmc.dll")] static extern int SmcWStartPulser(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWStopPulser(short DevId, short AxisNo);
		[DllImport("CSmc.dll")] static extern int SmcWSetPulserLine(short DevId, short AxisNo, short InterAxis);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulserLine(short DevId, short AxisNo, ref short InterAxis);
		[DllImport("CSmc.dll")] static extern int SmcWSetPulserArc(short DevId, short AxisNo, short InterAxis, int Center_X, int Center_Y, int End_X, int End_Y, double ArcSpeedLimit, short ArcStrtDir);
		[DllImport("CSmc.dll")] static extern int SmcWGetPulserArc(short DevId, short AxisNo, ref short InterAxis, ref int Center_X, ref int Center_Y, ref int End_X, ref int End_Y, ref double ArcSpeedLimit, ref short ArcStrtDir);

		// Constructor
		public CSmc()
		{
		}
		
		//-----------------------------
		// API-SMC(WDM) Function List
		//-----------------------------
		public int WGetDeviceInfo(string Device, short InfoType, out int Param1, out int Param2, out int Param3)
		{
			Param1 = 0;
			Param2 = 0;
			Param3 = 0;
			int ret = SmcWGetDeviceInfo(Device, InfoType, ref Param1, ref Param2, ref Param3);
			return ret;
		}
		public int WQueryDeviceName(short Index, out string DeviceName, out string Device)
		{
			DeviceName = new string('0', 1);
			Device = new string('0', 1);
			System.Text.StringBuilder devicename = new System.Text.StringBuilder(256);
			System.Text.StringBuilder device = new System.Text.StringBuilder(256);
			int ret = SmcWQueryDeviceName(Index, devicename, device);
			if( ret == 0 )
			{
				DeviceName = devicename.ToString();
				Device = device.ToString();
			}
			return ret;
		}
		
		//---------------------------
		// Initialization Functions
		//---------------------------
		public int WInit(string DeviceName, out short DevId)
		{
			DevId = 0;
			int ret = SmcWInit(DeviceName, ref DevId);
			return ret;
		}
		public int WExit(short DevId)
		{
			int ret = SmcWExit(DevId);
			return ret;
		}
		public int WGetErrorString(int ErrorCode, out string ErrorString)
		{
			ErrorString = new string('0', 1);
			System.Text.StringBuilder errorstring = new System.Text.StringBuilder(256);
			int ret = SmcWGetErrorString(ErrorCode, errorstring);
			if( ret == 0 )
			{
				ErrorString = errorstring.ToString();
			}
			return ret;
		}

		//---------------------------------------
		// Initial Parameters Setting Functions
		//---------------------------------------
		public int WSetPulseType(short DevId, short AxisNo, short PulseMode, short DirTimer)
		{
			int ret = SmcWSetPulseType(DevId, AxisNo, PulseMode, DirTimer);
			return ret;
		}
		public int WGetPulseType(short DevId, short AxisNo, out short PulseMode, out short DirTimer)
		{
			PulseMode = 0;
			DirTimer = 0;
			int ret = SmcWGetPulseType(DevId, AxisNo, ref PulseMode, ref DirTimer);
			return ret;
		}
		public int WSetPulseDuty(short DevId, short AxisNo, short Duty)
		{
			int ret = SmcWSetPulseDuty(DevId, AxisNo, Duty);
			return ret;
		}
		public int WGetPulseDuty(short DevId, short AxisNo, out short Duty)
		{
			Duty = 0;
			int ret = SmcWGetPulseDuty(DevId, AxisNo, ref Duty);
			return ret;
		}
		public int WSetEncType(short DevId, short AxisNo, short EncType)
		{
			int ret = SmcWSetEncType(DevId, AxisNo, EncType);
			return ret;
		}
		public int WGetEncType(short DevId, short AxisNo, out short EncType)
		{
			EncType = 0;
			int ret = SmcWGetEncType(DevId, AxisNo, ref EncType);
			return ret;
		}
		public int WSetCtrlTypeOut(short DevId, short AxisNo, short CtrlOut1, short CtrlOut2, short CtrlOut3)
		{
			int ret = SmcWSetCtrlTypeOut(DevId, AxisNo, CtrlOut1, CtrlOut2, CtrlOut3);
			return ret;
		}
		public int WGetCtrlTypeOut(short DevId, short AxisNo, out short CtrlOut1, out short CtrlOut2, out short CtrlOut3)
		{
			CtrlOut1 = 0;
			CtrlOut2 = 0;
			CtrlOut3 = 0;
			int ret = SmcWGetCtrlTypeOut(DevId, AxisNo, ref CtrlOut1, ref CtrlOut2, ref CtrlOut3);
			return ret;
		}
		public int WSetCtrlTypeIn(short DevId, short AxisNo, short CtrlIn)
		{
			int ret = SmcWSetCtrlTypeIn(DevId, AxisNo, CtrlIn);
			return ret;
		}
		public int WGetCtrlTypeIn(short DevId, short AxisNo, out short CtrlIn)
		{
			CtrlIn = 0;
			int ret = SmcWGetCtrlTypeIn(DevId, AxisNo, ref CtrlIn);
			return ret;
		}
		public int WSetOrgLog(short DevId, short AxisNo, short OrgLog)
		{
			int ret = SmcWSetOrgLog(DevId, AxisNo, OrgLog);
			return ret;
		}
		public int WGetOrgLog(short DevId, short AxisNo, out short OrgLog)
		{
			OrgLog = 0;
			int ret = SmcWGetOrgLog(DevId, AxisNo, ref OrgLog);
			return ret;
		}
		public int WSetCtrlInOutLog(short DevId, short AxisNo, short CtrlInOutLog)
		{
			int ret = SmcWSetCtrlInOutLog(DevId, AxisNo, CtrlInOutLog);
			return ret;
		}
		public int WGetCtrlInOutLog(short DevId, short AxisNo, out short CtrlInOutLog)
		{
			CtrlInOutLog = 0;
			int ret = SmcWGetCtrlInOutLog(DevId, AxisNo, ref CtrlInOutLog);
			return ret;
		}
		public int WSetErcMode(short DevId, short AxisNo, short ErcMode)
		{
			int ret = SmcWSetErcMode(DevId, AxisNo, ErcMode);
			return ret;
		}
		public int WGetErcMode(short DevId, short AxisNo, out short ErcMode)
		{
			ErcMode = 0;
			int ret = SmcWGetErcMode(DevId, AxisNo, ref ErcMode);
			return ret;
		}
		public int WSetErcAlmClearTime(short DevId, short AxisNo, short ErcTime, short ErcOffTimer, short AlmTime)
		{
			int ret = SmcWSetErcAlmClearTime(DevId, AxisNo, ErcTime, ErcOffTimer, AlmTime);
			return ret;
		}
		public int WGetErcAlmClearTime(short DevId, short AxisNo, out short ErcTime, out short ErcOffTimer, out short AlmTime)
		{
			ErcTime = 0;
			ErcOffTimer = 0;
			AlmTime = 0;
			int ret = SmcWGetErcAlmClearTime(DevId, AxisNo, ref ErcTime, ref ErcOffTimer, ref AlmTime);
			return ret;
		}
		public int WSetOrgMode(short DevId, short AxisNo, short LimitTurn, short OrgType, short EndDir, short ZCount)
		{
			int ret = SmcWSetOrgMode(DevId, AxisNo, LimitTurn, OrgType, EndDir, ZCount);
			return ret;
		}
		public int WGetOrgMode(short DevId, short AxisNo, out short LimitTurn, out short OrgType, out short EndDir, out short ZCount)
		{
			LimitTurn = 0;
			OrgType = 0;
			EndDir = 0;
			ZCount = 0;
			int ret = SmcWGetOrgMode(DevId, AxisNo, ref LimitTurn, ref OrgType, ref EndDir, ref ZCount);
			return ret;
		}
		public int WSetSAccelType(short DevId, short AxisNo, short SAccelType)
		{
			int ret = SmcWSetSAccelType(DevId, AxisNo, SAccelType);
			return ret;
		}
		public int WGetSAccelType(short DevId, short AxisNo, out short SAccelType)
		{
			SAccelType = 0;
			int ret = SmcWGetSAccelType(DevId, AxisNo, ref SAccelType);
			return ret;
		}
		public int WSetInFilterType(short DevId, short AxisNo, short FilterType)
		{
			int ret = SmcWSetInFilterType(DevId, AxisNo, FilterType);
			return ret;
		}
		public int WGetInFilterType(short DevId, short AxisNo, out short FilterType)
		{
			FilterType = 0;
			int ret = SmcWGetInFilterType(DevId, AxisNo, ref FilterType);
			return ret;
		}
		public int WSetSDMode(short DevId, short AxisNo, short SDMode)
		{
			int ret = SmcWSetSDMode(DevId, AxisNo, SDMode);
			return ret;
		}
		public int WGetSDMode(short DevId, short AxisNo, out short SDMode)
		{
			SDMode =0;
			int ret = SmcWGetSDMode(DevId, AxisNo, ref SDMode);
			return ret;
		}
		public int WSetCounterMode(short DevId, short AxisNo, short ClrCounterLtc, short LtcMode, short ClrCounterClr, short ClrMode)
		{
			int ret = SmcWSetCounterMode(DevId, AxisNo, ClrCounterLtc, LtcMode, ClrCounterClr, ClrMode);
			return ret;
		}
		public int WGetCounterMode(short DevId, short AxisNo, out short ClrCounterLtc, out short LtcMode, out short ClrCounterClr, out short ClrMode)
		{
			ClrCounterLtc = 0;
			LtcMode = 0;
			ClrCounterClr = 0;
			ClrMode = 0;
			int ret = SmcWGetCounterMode(DevId, AxisNo, ref ClrCounterLtc, ref LtcMode, ref ClrCounterClr, ref ClrMode);
			return ret;
		}
		public int WSetSoftLimit(short DevId, short AxisNo, short PLimMode, short MLimMode, int PLimCount, int MLimCount)
		{
			int ret = SmcWSetSoftLimit(DevId, AxisNo, PLimMode, MLimMode, PLimCount, MLimCount);
			return ret;
		}
		public int WGetSoftLimit(short DevId, short AxisNo, out short PLimMode, out short MLimMode, out int PLimCount, out int MLimCount)
		{
			PLimMode = 0;
			MLimMode = 0;
			PLimCount = 0;
			MLimCount = 0;
			int ret = SmcWGetSoftLimit(DevId, AxisNo, ref PLimMode, ref MLimMode, ref PLimCount, ref MLimCount);
			return ret;
		}
		public int WSetInitParam(short DevId, short AxisNo)
		{
			int ret = SmcWSetInitParam(DevId, AxisNo);
			return ret;
		}
		public int WGetInitParam(short DevId, short AxisNo, out short InitParam)
		{
			InitParam = 0;
			int ret = SmcWGetInitParam(DevId, AxisNo, ref InitParam);
			return ret;
		}

		//------------------------------------
		// Basic Operation Setting Functions
		//------------------------------------
		public int WSetReady(short DevId, short AxisNo, short MotionType, short StartDir)
        {//设置开始准备和电机操作类型/基本操作开始运行的方向。
			int ret = SmcWSetReady(DevId, AxisNo, MotionType, StartDir);
			return ret;
		}
		public int WGetReady(short DevId, short AxisNo, out short MotionType, out short StartDir)
		{
			MotionType = 0;
			StartDir = 0;
			int ret = SmcWGetReady(DevId, AxisNo, ref MotionType, ref StartDir);
			return ret;
		}
		public int WSetResolveSpeed(short DevId, short AxisNo, double ResolveSpeed)
		{//设置速度
			int ret = SmcWSetResolveSpeed(DevId, AxisNo, ResolveSpeed);
			return ret;
		}
		public int WGetResolveSpeed(short DevId, short AxisNo, out double ResolveSpeed)
		{
			ResolveSpeed = 0;
			int ret = SmcWGetResolveSpeed(DevId, AxisNo, ref ResolveSpeed);
			return ret;
		}
		public int WSetStartSpeed(short DevId, short AxisNo, double StartSpeed)
		{//设置脉冲的启动速度
			int ret = SmcWSetStartSpeed(DevId, AxisNo, StartSpeed);
			return ret;
		}
		public int WGetStartSpeed(short DevId, short AxisNo, out double StartSpeed)
		{//获取启动速度
			StartSpeed = 0;
			int ret = SmcWGetStartSpeed(DevId, AxisNo, ref StartSpeed);
			return ret;
		}
		public int WSetTargetSpeed(short DevId, short AxisNo, double TargetSpeed)
		{//设置脉冲输出的目标速度。
			int ret = SmcWSetTargetSpeed(DevId, AxisNo, TargetSpeed);
			return ret;
		}
		public int WGetTargetSpeed(short DevId, short AxisNo, out double TargetSpeed)
        {//获取脉冲输出的目标速度。
			TargetSpeed = 0;
			int ret = SmcWGetTargetSpeed(DevId, AxisNo, ref TargetSpeed);
			return ret;
		}
		public int WSetAccelTime(short DevId, short AxisNo, double AccelTime)
		{//设置加速时间
			int ret = SmcWSetAccelTime(DevId, AxisNo, AccelTime);
			return ret;
		}
		public int WGetAccelTime(short DevId, short AxisNo, out double AccelTime)
		{//获取加速时间
			AccelTime = 0;
			int ret = SmcWGetAccelTime(DevId, AxisNo, ref AccelTime);
			return ret;
		}
		public int WSetDecelTime(short DevId, short AxisNo, double DecelTime)
		{//设置减速时间
			int ret = SmcWSetDecelTime(DevId, AxisNo, DecelTime);
			return ret;
		}
		public int WGetDecelTime(short DevId, short AxisNo, out double DecelTime)
		{//获取减速时间
			DecelTime = 0;
			int ret = SmcWGetDecelTime(DevId, AxisNo, ref DecelTime);
			return ret;
		}
		public int WSetSSpeed(short DevId, short AxisNo, double SSpeed)
		{
			int ret = SmcWSetSSpeed(DevId, AxisNo, SSpeed);
			return ret;
		}
		public int WGetSSpeed(short DevId, short AxisNo, out double SSpeed)
		{
			SSpeed = 0;
			int ret = SmcWGetSSpeed(DevId, AxisNo, ref SSpeed);
			return ret;
		}
		public int WSetStopPosition(short DevId, short AxisNo, short Coodinate, int StopPosition)
        {         
            //设置在发动机停止位置(总数的输出pulses)。
			int ret = SmcWSetStopPosition(DevId, AxisNo, Coodinate, StopPosition);
			return ret;
		}
		public int WGetStopPosition(short DevId, short AxisNo, short Coodinate, out int StopPosition)
        {//获取发动机停止位置(总数的输出pulses)。
			StopPosition = 0;
			int ret = SmcWGetStopPosition(DevId, AxisNo, Coodinate, ref StopPosition);
			return ret;
		}
		public int WSetSync(short DevId, short SyncAxis, short SyncChip, short SyncBoard)
		{
			int ret = SmcWSetSync(DevId, SyncAxis, SyncChip, SyncBoard);
			return ret;
		}
		public int WGetSync(short DevId, out short SyncAxis, out short SyncChip, out short SyncBoard)
		{
			SyncAxis = 0;
			SyncChip = 0;
			SyncBoard = 0;
			int ret = SmcWGetSync(DevId, ref SyncAxis, ref SyncChip, ref SyncBoard);
			return ret;
		}
		public int WSetZCountMotion(short DevId, short AxisNo, short ZMoveCount, short ZLog)
		{
			int ret = SmcWSetZCountMotion(DevId, AxisNo, ZMoveCount, ZLog);
			return ret;
		}
		public int WGetZCountMotion(short DevId, short AxisNo, out short ZMoveCount, out short ZLog)
		{
			ZMoveCount = 0;
			ZLog = 0;
			int ret = SmcWGetZCountMotion(DevId, AxisNo, ref ZMoveCount, ref ZLog);
			return ret;
		}

		//----------------------------------------
		//  Extended Operation Setting Functions 
		//----------------------------------------
		public int WSetBankNumber(short DevId, short AxisNo, short BankNum)
		{
			int ret = SmcWSetBankNumber(DevId, AxisNo, BankNum);
			return ret;
		}
		public int WGetBankNumber(short DevId, short AxisNo, out short BankNum)
		{
			BankNum = 0;
			int ret = SmcWGetBankNumber(DevId, AxisNo, ref BankNum);
			return ret;
		}
		public int WSetBankReady(short DevId, short AxisNo, short MotionType)
		{
			int ret = SmcWSetBankReady(DevId, AxisNo, MotionType);
			return ret;
		}
		public int WGetBankReady(short DevId, short AxisNo, out short MotionType)
		{
			MotionType = 0;
			int ret = SmcWGetBankReady(DevId, AxisNo, ref MotionType);
			return ret;
		}
		public int WSetBankDistance(short DevId, short AxisNo, short BankNo, int StopPosition)
		{
			int ret = SmcWSetBankDistance(DevId, AxisNo, BankNo, StopPosition);
			return ret;
		}
		public int WGetBankDistance(short DevId, short AxisNo, short BankNo, out int StopPosition)
		{
			StopPosition = 0;
			int ret = SmcWGetBankDistance(DevId, AxisNo, BankNo, ref StopPosition);
			return ret;
		}
		public int WSetBankResolveSpeed(short DevId, short AxisNo, short BankNo, double ResolveSpeed)
		{
			int ret = SmcWSetBankResolveSpeed(DevId, AxisNo, BankNo, ResolveSpeed);
			return ret;
		}
		public int WGetBankResolveSpeed(short DevId, short AxisNo, short BankNo, out double ResolveSpeed)
		{
			ResolveSpeed = 0;
			int ret = SmcWGetBankResolveSpeed(DevId, AxisNo, BankNo, ref ResolveSpeed);
			return ret;
		}
		public int WSetBankStartSpeed(short DevId, short AxisNo, short BankNo, double StartSpeed)
		{
			int ret = SmcWSetBankStartSpeed(DevId, AxisNo, BankNo, StartSpeed);
			return ret;
		}
		public int WGetBankStartSpeed(short DevId, short AxisNo, short BankNo, out double StartSpeed)
		{
			StartSpeed = 0;
			int ret = SmcWGetBankStartSpeed(DevId, AxisNo, BankNo, ref StartSpeed);
			return ret;
		}
		public int WSetBankTargetSpeed(short DevId, short AxisNo, short BankNo, double TargetSpeed)
		{
			int ret = SmcWSetBankTargetSpeed(DevId, AxisNo, BankNo, TargetSpeed);
			return ret;
		}
		public int WGetBankTargetSpeed(short DevId, short AxisNo, short BankNo, out double TargetSpeed)
		{
			TargetSpeed = 0;
			int ret = SmcWGetBankTargetSpeed(DevId, AxisNo, BankNo, ref TargetSpeed);
			return ret;
		}
		public int WSetBankAccelTime(short DevId, short AxisNo, short BankNo, double AccelTime)
		{
			int ret = SmcWSetBankAccelTime(DevId, AxisNo, BankNo, AccelTime);
			return ret;
		}
		public int WGetBankAccelTime(short DevId, short AxisNo, short BankNo, out double AccelTime)
		{
			AccelTime = 0;
			int ret = SmcWGetBankAccelTime(DevId, AxisNo, BankNo, ref AccelTime);
			return ret;
		}
		public int WSetBankDecelTime(short DevId, short AxisNo, short BankNo, double DecelTime)
		{
			int ret = SmcWSetBankDecelTime(DevId, AxisNo, BankNo, DecelTime);
			return ret;
		}
		public int WGetBankDecelTime(short DevId, short AxisNo, short BankNo, out double DecelTime)
		{
			DecelTime = 0;
			int ret = SmcWGetBankDecelTime(DevId, AxisNo, BankNo, ref DecelTime);
			return ret;
		}
		public int WSetBankSSpeed(short DevId, short AxisNo, short BankNo, double SSpeed)
		{
			int ret = SmcWSetBankSSpeed(DevId, AxisNo, BankNo, SSpeed);
			return ret;
		}
		public int WGetBankSSpeed(short DevId, short AxisNo, short BankNo, out double SSpeed)
		{
			SSpeed = 0;
			int ret = SmcWGetBankSSpeed(DevId, AxisNo, BankNo, ref SSpeed);
			return ret;
		}
		public int WSetBankInterpolation(short DevId, short AxisNo, short BankNo, short InterType, short InterAxis, short Reserved)
		{
			int ret = SmcWSetBankInterpolation(DevId, AxisNo, BankNo, InterType, InterAxis, Reserved);
			return ret;
		}
		public int WGetBankInterpolation(short DevId, short AxisNo, short BankNo, out short InterType, out short InterAxis, out short Reserved)
		{
			InterType = 0;
			InterAxis = 0;
			Reserved = 0;
			int ret = SmcWGetBankInterpolation(DevId, AxisNo, BankNo, ref InterType, ref InterAxis, ref Reserved);
			return ret;
		}
		public int WSetBankArcPoint(short DevId, short AxisNo, short BankNo, double ArcSpeed, int Center_X, int Center_Y, int End_X, int End_Y)
		{
			int ret = SmcWSetBankArcPoint(DevId, AxisNo, BankNo, ArcSpeed, Center_X, Center_Y, End_X, End_Y);
			return ret;
		}
		public int WGetBankArcPoint(short DevId, short AxisNo, short BankNo, out double ArcSpeed, out int Center_X, out int Center_Y, out int End_X, out int End_Y)
		{
			ArcSpeed = 0;
			Center_X = 0;
			Center_Y = 0;
			End_X = 0;
			End_Y = 0;
			int ret = SmcWGetBankArcPoint(DevId, AxisNo, BankNo, ref ArcSpeed, ref Center_X, ref Center_Y, ref End_X, ref End_Y);
			return ret;
		}
		public int WSetBankArcParam(short DevId, short AxisNo, short BankNo, short ArcStrtDir, short AutoEndPointPull)
		{
			int ret = SmcWSetBankArcParam(DevId, AxisNo, BankNo, ArcStrtDir, AutoEndPointPull);
			return ret;
		}
		public int WGetBankArcParam(short DevId, short AxisNo, short BankNo, out short ArcStrtDir, out short AutoEndPointPull)
		{
			ArcStrtDir = 0;
			AutoEndPointPull = 0;
			int ret = SmcWGetBankArcParam(DevId, AxisNo, BankNo, ref ArcStrtDir, ref AutoEndPointPull);
			return ret;
		}
		public int WSetBankContinuation(short DevId, short AxisNo, short BankNo, int ContType)
		{
			int ret = SmcWSetBankContinuation(DevId, AxisNo, BankNo, ContType);
			return ret;
		}
		public int WGetBankContinuation(short DevId, short AxisNo, short BankNo, out int ContType)
		{
			ContType = 0;
			int ret = SmcWGetBankContinuation(DevId, AxisNo, BankNo, ref ContType);
			return ret;
		}

		//-----------------------------------
		// Control Signal Setting Functions
		//-----------------------------------
		public int WSetAlarmClear(short DevId, short AxisNo)
		{//清理报警
			int ret = SmcWSetAlarmClear(DevId, AxisNo);
			return ret;
		}
		public int WSetLimitMask(short DevId, short AxisNo, short LimitMask, short LimitMaskEnable)
		{
			int ret = SmcWSetLimitMask(DevId, AxisNo, LimitMask, LimitMaskEnable);
			return ret;
		}
		public int WGetLimitMask(short DevId, short AxisNo, out short LimitMask)
		{
			LimitMask = 0;
			int ret = SmcWGetLimitMask(DevId, AxisNo, ref LimitMask);
			return ret;
		}
		public int WSetDigitalOut(short DevId, short AxisNo, short OutData, short OutDataEnable)
		{
			int ret = SmcWSetDigitalOut(DevId, AxisNo, OutData, OutDataEnable);
			return ret;
		}
		public int WGetDigitalOut(short DevId, short AxisNo, out short OutData)
		{
			OutData = 0;
			int ret = SmcWGetDigitalOut(DevId, AxisNo, ref OutData);
			return ret;
		}
		public int WGetDigitalIn(short DevId, short AxisNo, out short InData)
		{
			InData = 0;
			int ret = SmcWGetDigitalIn(DevId, AxisNo, ref InData);
			return ret;
		}
		public int WSetHoldOff(short DevId, short AxisNo, short HoldOff)
		{
			int ret = SmcWSetHoldOff(DevId, AxisNo, HoldOff);
			return ret;
		}
		public int WGetHoldOff(short DevId, short AxisNo, out short HoldOff)
		{
			HoldOff = 0;
			int ret = SmcWGetHoldOff(DevId, AxisNo, ref HoldOff);
			return ret;
		}
		public int WSetErcOut(short DevId, short AxisNo, short ErcOn)
		{
			int ret = SmcWSetErcOut(DevId, AxisNo, ErcOn);
			return ret;
		}
		public int WGetAlarmCode(short DevId, short AxisNo, out short AlarmCode)
		{//获取报警码
			AlarmCode = 0;
			int ret = SmcWGetAlarmCode(DevId, AxisNo, ref AlarmCode);
			return ret;
		}

		//----------------------------------
		// Operation Status Read Functions
		//----------------------------------
		public int WSetOutPulse(short DevId, short AxisNo, int OutPulse)
		{
			int ret = SmcWSetOutPulse(DevId, AxisNo, OutPulse);
			return ret;
		}
		public int WGetOutPulse(short DevId, short AxisNo, out int OutPulse)
        {//检索反馈输出脉冲的数目。
			OutPulse = 0;
			int ret = SmcWGetOutPulse(DevId, AxisNo, ref OutPulse);
			return ret;
		}
		public int WSetCountPulse(short DevId, short AxisNo, int CountPulse)
		{
			int ret = SmcWSetCountPulse(DevId, AxisNo, CountPulse);
			return ret;
		}
		public int WGetCountPulse(short DevId, short AxisNo, out int CountPulse)
        {//检索编码器计数值。

			CountPulse = 0;
			int ret = SmcWGetCountPulse(DevId, AxisNo, ref CountPulse);
			return ret;
		}
		public int WGetPulseStatus(short DevId, short AxisNo, out short PulseSts)
		{
			PulseSts = 0;
			int ret = SmcWGetPulseStatus(DevId, AxisNo, ref PulseSts);
			return ret;
		}
		public int WGetMoveStatus(short DevId, short AxisNo, out short MoveSts)
		{//获取运动状态
			MoveSts = 0;
			int ret = SmcWGetMoveStatus(DevId, AxisNo, ref MoveSts);
			return ret;
		}
		public int WGetStopStatus(short DevId, short AxisNo, out short StopSts)
		{
			StopSts = 0;
			int ret = SmcWGetStopStatus(DevId, AxisNo, ref StopSts);
			return ret;
		}
		public int WGetLimitStatus(short DevId, short AxisNo, out short LimitSts)
		{
			LimitSts = 0;
			int ret = SmcWGetLimitStatus(DevId, AxisNo, ref LimitSts);
			return ret;
		}
		public int WGetLatchOutPulse(short DevId, short AxisNo, out int OutPulse)
		{
			OutPulse = 0;
			int ret = SmcWGetLatchOutPulse(DevId, AxisNo, ref OutPulse);
			return ret;
		}
		public int WGetLatchCountPulse(short DevId, short AxisNo, out int CountPulse)
		{
			CountPulse = 0;
			int ret = SmcWGetLatchCountPulse(DevId, AxisNo, ref CountPulse);
			return ret;
		}
		public int WGetBankNo(short DevId, short AxisNo, out short BankNo)
		{
			BankNo = 0;
			int ret = SmcWGetBankNo(DevId, AxisNo, ref BankNo);
			return ret;
		}
		public int WGetMoveSpeed(short DevId, short AxisNo, out double MoveSpeed)
		{
			MoveSpeed = 0;
			int ret = SmcWGetMoveSpeed(DevId, AxisNo, ref MoveSpeed);
			return ret;
		}
        public int WGetZCount(short DevId, short AxisNo, out short MoveZCount)
        {
            MoveZCount = 0;
            int ret = SmcWGetZCount(DevId, AxisNo, ref MoveZCount);
            return ret;
        }
        public int WGetCtrlInOutStatus(short DevId, short AxisNo, out short CtrlSts)
        {
            CtrlSts = 0;
            int ret = SmcWGetCtrlInOutStatus(DevId, AxisNo, ref CtrlSts);
            return ret;
        }

		//-----------------------------
		// Motor Operation Functions
		//-----------------------------
		public int WMotionStart(short DevId, short AxisNo)
		{//开始运动
			int ret = SmcWMotionStart(DevId, AxisNo);
			return ret;
		}
		public int WMotionStop(short DevId, short AxisNo)
		{//停止运动
			int ret = SmcWMotionStop(DevId, AxisNo);
			return ret;
		}
		public int WMotionDecStop(short DevId, short AxisNo)
		{//减速停止
			int ret = SmcWMotionDecStop(DevId, AxisNo);
			return ret;
		}
		public int WMotionChange(short DevId, short AxisNo)
        {//Changes the speed and stop position for motor motion.
			int ret = SmcWMotionChange(DevId, AxisNo);
			return ret;
		}
		public int WSetMotionChangeReady(short DevId, short AxisNo, short ChangeType)
        {//改变电机运行中的速度,并设置停止位置的变化。
			int ret = SmcWSetMotionChangeReady(DevId, AxisNo, ChangeType);
			return ret;
		}
		public int WGetMotionChangeReady(short DevId, short AxisNo, out short ChangeType)
		{
			ChangeType = 0;
			int ret = SmcWGetMotionChangeReady(DevId, AxisNo, ref ChangeType);
			return ret;
		}
		public int WSyncMotionStart(short DevId, short AxisNo)
		{
			int ret = SmcWSyncMotionStart(DevId, AxisNo);
			return ret;
		}

		//------------------
		// Event Functions
		//------------------
		public int WStopEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode)
		{
			int ret = SmcWStopEvent(DevId, AxisNo, hMsgWnd, EventMode);
			return ret;
		}
		public int WBankEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode, short BankNo)
		{
			int ret = SmcWBankEvent(DevId, AxisNo, hMsgWnd, EventMode, BankNo);
			return ret;
		}
		public int WCountEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode, short CountType, int Count)
		{
			int ret = SmcWCountEvent(DevId, AxisNo, hMsgWnd, EventMode, CountType, Count);
			return ret;
		}
		public int WIrqEvent(short DevId, short AxisNo, int hMsgWnd, short EventMode, short EventType)
		{
			int ret = SmcWIrqEvent(DevId, AxisNo, hMsgWnd, EventMode, EventType);
			return ret;
		}

		//------------------
		// FIFOLatch Functions
		//------------------
		public int WResetLatchFIFO(short DevId)
		{
			int ret = SmcWResetLatchFIFO(DevId);
			return ret;
		}
		public int WSetFIFOLatchSrc(short DevId, short AxisNo, short LatchAxisNo, short Enable)
		{
			int ret = SmcWSetFIFOLatchSrc(DevId, AxisNo, LatchAxisNo, Enable);
			return ret;
		}
		public int WGetFIFOLatchSrc(short DevId, short AxisNo, out short LatchAxisNo, out short Enable)
		{
			LatchAxisNo = 0;
			Enable = 0;
			int ret = SmcWGetFIFOLatchSrc(DevId, AxisNo, ref LatchAxisNo, ref Enable);
			return ret;
		}
		public int WGetLatchDataFromBuffer(short DevId, short BufferNo, out short AxisCounterNo, out short LatchDataCnt, int[] LatchDataTable)
		{
			AxisCounterNo = 0;
			LatchDataCnt = 0;
			int ret = SmcWGetLatchDataFromBuffer(DevId, BufferNo, ref AxisCounterNo, ref LatchDataCnt, LatchDataTable);
			return ret;
		}
		public int WGetLatchFIFOLength(short DevId, short AxisNo, out short length)
		{
			length = 0;
			int ret = SmcWGetLatchFIFOLength(DevId, AxisNo, ref length);
			return ret;
		}
        public int WGetLatchDataFromBufferEx(short DevId, short BufferNo, out short AxisCounterNo, out short LatchDataCnt, int[] LatchDataTable, out short UpCnt, out short DownCnt)
		{
			AxisCounterNo = 0;
			LatchDataCnt = 0;
			UpCnt = 0;
			DownCnt = 0;
			int ret = SmcWGetLatchDataFromBufferEx(DevId, BufferNo, ref AxisCounterNo, ref LatchDataCnt, LatchDataTable, ref UpCnt, ref DownCnt);
			return ret;
		}
		public int WResetAxisLatchFIFO( short DevId, short AxisBitNo, short Reserved)
		{
			int ret = SmcWResetAxisLatchFIFO( DevId, AxisBitNo, Reserved);
			return ret;
		}
		public int WResetFIFOLatchSrc( short DevId, short AxisNo)
		{
			int ret = SmcWResetFIFOLatchSrc( DevId, AxisNo);
			return ret;
		}

		//------------------
		// TriggerOut Functions
		//------------------
		public int WSetTrgOutCPWidth(short DevId, short AxisNo, short Width)
		{
			int ret = SmcWSetTrgOutCPWidth(DevId, AxisNo, Width);
			return ret;
		}
		public int WGetTrgOutCPWidth(short DevId, short AxisNo, out short Width)
		{
			Width = 0;
			int ret = SmcWGetTrgOutCPWidth(DevId, AxisNo, ref Width);
			return ret;
		}
		public int WSetTrgOutCPDelay(short DevId, short AxisNo, short DelayTime)
		{
			int ret = SmcWSetTrgOutCPDelay(DevId, AxisNo, DelayTime);
			return ret;
		}
		public int WGetTrgOutCPDelay(short DevId, short AxisNo, out short DelayTime)
		{
			DelayTime = 0;
			int ret = SmcWGetTrgOutCPDelay(DevId, AxisNo, ref DelayTime);
			return ret;
		}
		public int WSetTrgOutData(short DevId, short FifoNo, short CntType, short OutAxisEnable, int FifoData)
		{
			int ret = SmcWSetTrgOutData(DevId, FifoNo, CntType, OutAxisEnable, FifoData);
			return ret;
		}
		public int WTrgOutEvent(short DevId, int hMsgWnd, short EventMode, short EventType)
		{
			int ret = SmcWTrgOutEvent(DevId, hMsgWnd, EventMode, EventType);
			return ret;
		}
		public int WGetTrgOutStatus(short DevId, out short TrgOutSts, out short TrgOutErrSts)
		{
			TrgOutSts = 0;
			TrgOutErrSts = 0;
			int ret = SmcWGetTrgOutStatus(DevId, ref TrgOutSts, ref TrgOutErrSts);
			return ret;
		}
		public int WResetTrgOutStatus(short DevId, short EnableStsReset, short EnableErrStsReset, out short TrgOutSts, out short TrgOutErrSts)
		{
			TrgOutSts = 0;
			TrgOutErrSts = 0;
			int ret = SmcWResetTrgOutStatus(DevId, EnableStsReset, EnableErrStsReset, ref TrgOutSts, ref TrgOutErrSts);
			return ret;
		}
		public int WGetTrgOutDataRemainNum(short DevId, short FifoNo, out int DataNum)
		{
			DataNum = 0;
			int ret = SmcWGetTrgOutDataRemainNum(DevId, FifoNo, ref DataNum);
			return ret;
		}
		public int WResetTrgOutFIFO(short DevId, short FifoBitNo)
		{
			int ret = SmcWResetTrgOutFIFO(DevId, FifoBitNo);
			return ret;
		}
		public int WSetTrgOutStart(short DevId)
		{
			int ret = SmcWSetTrgOutStart(DevId);
			return ret;
		}
		public int WSetTrgOutStop(short DevId)
		{
			int ret = SmcWSetTrgOutStop(DevId);
			return ret;
		}
		public int WSetTrgOutAxis(short DevId, short FifoNo, short CmpAxis, short OutAxis)
		{
			int ret = SmcWSetTrgOutAxis(DevId, FifoNo, CmpAxis, OutAxis);
			return ret;
		}
		public int WGetTrgOutAxis(short DevId, short FifoNo, out short CmpAxis, out short OutAxis)
		{
			CmpAxis = 0;
			OutAxis = 0;
			int ret = SmcWGetTrgOutAxis(DevId, FifoNo, ref CmpAxis, ref OutAxis);
			return ret;
		}
		public int WResetTrgOutAxis(short DevId, short FifoBitNo)
		{
			int ret = SmcWResetTrgOutAxis(DevId, FifoBitNo);
			return ret;
		}

		//------------------
		// Manual Pulser Functions
		//------------------
		public int WSetPulserType(short DevId, short AxisNo, short InputType, short PulserDir)
		{
			int ret = SmcWSetPulserType(DevId, AxisNo, InputType, PulserDir);
			return ret;
		}
		public int WGetPulserType(short DevId, short AxisNo, out short InputType, out short PulserDir)
		{
			InputType = 0;
			PulserDir = 0;
			int ret = SmcWGetPulserType(DevId, AxisNo, ref InputType, ref PulserDir);
			return ret;
		}
		public int WSetPulserParam(short DevId, short AxisNo, double SpeedLimit, int Distance)
		{
			int ret = SmcWSetPulserParam(DevId, AxisNo, SpeedLimit, Distance);
			return ret;
		}

		public int WGetPulserParam(short DevId, short AxisNo, out double SpeedLimit, out int Distance)
		{
			SpeedLimit = 0;
			Distance = 0;
			int ret = SmcWGetPulserParam(DevId, AxisNo, ref SpeedLimit, ref Distance);
			return ret;
		}
		public int WSetPulserRatio(short DevId, short AxisNo, short Magnification, short Division)
		{
			int ret = SmcWSetPulserRatio(DevId, AxisNo, Magnification, Division);
			return ret;
		}
		public int WGetPulserRatio(short DevId, short AxisNo, out short Magnification, out short Division)
		{
			Magnification = 0;
			Division = 0;
			int ret = SmcWGetPulserRatio(DevId, AxisNo, ref Magnification, ref Division);
			return ret;
		}
		public int WSetPulserReady(short DevId, short AxisNo, short PulserMode)
		{
			int ret = SmcWSetPulserReady(DevId, AxisNo, PulserMode);
			return ret;
		}
		public int WGetPulserReady(short DevId, short AxisNo, out short PulserMode)
		{
			PulserMode = 0;
			int ret = SmcWGetPulserReady(DevId, AxisNo, ref PulserMode);
			return ret;
		}
		public int WStartPulser(short DevId, short AxisNo)
		{
			int ret = SmcWStartPulser(DevId, AxisNo);
			return ret;
		}

		public int WStopPulser(short DevId, short AxisNo)
		{
			int ret = SmcWStopPulser(DevId, AxisNo);
			return ret;
		}
		public int WSetPulserLine(short DevId, short AxisNo, short InterAxis)
		{
			int ret = SmcWSetPulserLine(DevId, AxisNo, InterAxis);
			return ret;
		}
		public int WGetPulserLine(short DevId, short AxisNo, out short InterAxis)
		{
			InterAxis = 0;
			int ret = SmcWGetPulserLine(DevId, AxisNo, ref InterAxis);
			return ret;
		}
		public int WSetPulserArc(short DevId, short AxisNo, short InterAxis, int Center_X, int Center_Y, int End_X, int End_Y, double ArcSpeedLimit, short ArcStrtDir)
		{
			int ret = SmcWSetPulserArc(DevId, AxisNo, InterAxis, Center_X, Center_Y, End_X, End_Y, ArcSpeedLimit, ArcStrtDir);
			return ret;
		}
		public int WGetPulserArc(short DevId, short AxisNo, out short InterAxis, out int Center_X, out int Center_Y, out int End_X, out int End_Y, out double ArcSpeedLimit, out short ArcStrtDir)
		{
			InterAxis = 0;
			Center_X = 0;
			Center_Y = 0;
			End_X = 0;
			End_Y = 0;
			ArcSpeedLimit = 0;
			ArcStrtDir = 0;
			int ret = SmcWGetPulserArc(DevId, AxisNo, ref InterAxis, ref Center_X, ref Center_Y, ref End_X, ref End_Y, ref ArcSpeedLimit, ref ArcStrtDir);
			return ret;
		}

	}
}