InovanceMotionCard.cs 243 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using TeamAAS.Global.Devices;
  7. using TeamAAS.Motion.Models;
  8. using System.Runtime.InteropServices;
  9. namespace TeamAAS.Motion.Motions
  10. {
  11. /// <summary>
  12. /// 汇川IMC60运动控制卡
  13. /// </summary>
  14. public class InovanceMotionCard : IMotionCard
  15. {
  16. private readonly MotionDeviceConfig _cfg;
  17. public string Name => _cfg.Name;
  18. public bool IsConnected { get; private set; }
  19. public int AxisCount => _cfg.AxisCount;
  20. public event EventHandler<MotionConnectionStateChangedEventArgs> ConnectionStateChanged;
  21. public event EventHandler<MotionErrorEventArgs> ErrorOccurred;
  22. public InovanceMotionCard(MotionDeviceConfig cfg)
  23. {
  24. _cfg = cfg ?? new MotionDeviceConfig();
  25. }
  26. public bool Open()
  27. {
  28. uint ret = Imc60.IMC_OpenCard((short)_cfg.BoardIndex);
  29. IsConnected = ret == Imc60.EXE_SUCCESS;
  30. if (IsConnected)
  31. ConnectionStateChanged?.Invoke(this, new MotionConnectionStateChangedEventArgs(true));
  32. return IsConnected;
  33. }
  34. public void Close()
  35. {
  36. if (!IsConnected) return;
  37. Imc60.IMC_CloseCard((short)_cfg.BoardIndex);
  38. IsConnected = false;
  39. ConnectionStateChanged?.Invoke(this, new MotionConnectionStateChangedEventArgs(false));
  40. }
  41. public bool SetEnable(int axis, bool enable) => throw new NotImplementedException();
  42. public bool Home(int axis, int mode = 0) => throw new NotImplementedException();
  43. public bool IsHomed(int axis) => throw new NotImplementedException();
  44. public bool MoveAbsolute(int axis, double position, double velocity) => throw new NotImplementedException();
  45. public bool MoveRelative(int axis, double distance, double velocity) => throw new NotImplementedException();
  46. public bool JogStart(int axis, int direction, double velocity) => throw new NotImplementedException();
  47. public bool JogStop(int axis) => throw new NotImplementedException();
  48. public bool Stop(int axis = -1) => throw new NotImplementedException();
  49. public AxisStatus GetAxisStatus(int axis) => throw new NotImplementedException();
  50. public List<AxisStatus> GetAllAxisStatus() => throw new NotImplementedException();
  51. public IAxis GetAxis(int axisNo) => throw new NotImplementedException();
  52. public IList<IAxis> GetAxes() => throw new NotImplementedException();
  53. public bool MoveLinear(double[] targetPositions, double velocity) => throw new NotImplementedException();
  54. public bool MoveArc(double[] centerPoint, double[] targetPositions, double velocity) => throw new NotImplementedException();
  55. public bool EmergencyStop() => throw new NotImplementedException();
  56. public bool ReadDI(int portIndex) => throw new NotImplementedException();
  57. public bool WriteDO(int portIndex, bool value) => throw new NotImplementedException();
  58. }
  59. public class Imc60
  60. {
  61. #region STATIC
  62. public const string Imc60ApiDllName = "IMC_Library_x64.dll";
  63. #endregion
  64. #region FUNCTION RETURN DEFINE
  65. public const uint EXE_SUCCESS = 0x00000000;
  66. public const uint ERR_HANDLE = 0xFFFFFFFF;
  67. #endregion
  68. /// @brief 主站信息结构体
  69. [StructLayout(LayoutKind.Sequential)]
  70. public struct TMasterInfo
  71. {
  72. public UInt32 cycleTime; // 规划周期
  73. public Int16 sysHwCfg; // 系统类型: 0: Ecat+端子板, 1 Ecat, 2: 端子板
  74. public Int16 aliasMode; // 别名模式: 0 未开启, 1 开启
  75. public Int16 pdoLen; // pdo总长度
  76. public Int16 slaveCnt; // 从站个数
  77. public Int16 axisCnt; // 轴个数
  78. public Int16 dioModuleCnt; // dio模块个数
  79. public Int16 aioModuleCnt; // aio模块个数
  80. public Int16 regModuleCnt; // reg模块个数
  81. public Int16 diCnt; // di数量
  82. public Int16 doCnt; // do数量
  83. public Int16 aiCnt; // ai,AD数量
  84. public Int16 aoCnt; // ao, DA数量
  85. public Int16 regInCnt; // reg输入数量
  86. public Int16 regOutCnt; // reg输出数量
  87. public Int16 encCnt; // enc通道数量
  88. public Int16 align;
  89. };
  90. /// @brief 从站信息结构体
  91. [StructLayout(LayoutKind.Sequential)]
  92. public struct TSlaveInfo
  93. {
  94. public Int16 devType; // 设备类型
  95. public UInt32 vendorId; // 设备ID
  96. public UInt32 productCode; // 产品编码
  97. public UInt32 revisionNo; // 版本号
  98. public Int16 axChn; // 从站起始通道号
  99. public Int16 axisCnt; // 当前从站轴数
  100. public Int16 actStation; // 当前从站对应的实际站号
  101. public UInt32 aliasNo; // 别名
  102. public UInt32 align;
  103. };
  104. /// @brief PdoEntry结构体
  105. [StructLayout(LayoutKind.Sequential)]
  106. public struct TPdoEntry
  107. {
  108. public UInt16 Index; // 索引
  109. public Byte SubIndex; // 子索引
  110. public Byte DevType; // entry类型
  111. public Int16 BitOfs; // 位偏移
  112. public UInt32 BitLen; // 位长度
  113. };
  114. /// @brief 回零参数结构体
  115. [StructLayout(LayoutKind.Sequential)]
  116. public struct THomingPara
  117. {
  118. public Int16 homeMethod; // 回原点方法
  119. public UInt32 highVel; // 高速搜索减速点速度 pulse/s
  120. public UInt32 lowVel; // 搜索原点低 pulse/s
  121. public UInt32 acc; // 加速度 pulse/s^2
  122. public Int32 offset; // 回原点后的零点偏执 pulse
  123. };
  124. /// @brief 多维位置比较数据结构体
  125. [StructLayout(LayoutKind.Sequential)]
  126. public struct TMultiCmpData
  127. {
  128. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
  129. public Int32[] compareData; // 比较的位置
  130. };
  131. /// @brief 规划运动限制参数结构体
  132. [StructLayout(LayoutKind.Sequential)]
  133. public struct TMtPara
  134. {
  135. public double bgVel; // 起始速度值 unit/s
  136. public double maxVel; // 最大速度 unit/s
  137. public double maxAcc; // 最大加速度 unit/s^2
  138. public double maxDec; // 最大减速度 unit/s^2
  139. public double maxJerk; // 最大加加速度 unit/s^3
  140. public double stopDec; // 平滑停止减速度 unit/s^2
  141. public double eStopDec; // 急停减速度 unit/s^2
  142. };
  143. /// @brief 轴属性配置结构体
  144. [StructLayout(LayoutKind.Sequential)]
  145. public struct TAxAttriPara
  146. {
  147. public Int16 arrivalBand; // 到位误差 pulse
  148. public UInt16 arrivalTime; // 到位保持时间 周期
  149. public Int32 errorLmt; // 最大跟随误差 pulse
  150. public Int32 softPosLimitPos; // 软正限位 pulse
  151. public Int32 softNegLimitPos; // 软负限位 pulse
  152. };
  153. /// @brief 轴安全检查配置结构体
  154. [StructLayout(LayoutKind.Sequential)]
  155. public struct TAxCheckEn
  156. {
  157. public Int16 alarmEn; // 报警是否有效标志
  158. public Int16 softLmtEn; // 软限位是否有效标志
  159. public Int16 hwLmtEn; // 硬限位是否有效标志
  160. public Int16 errorLmtEn; // 跟随误差是否检查标志
  161. };
  162. /// @brief 插补高级参数结构体
  163. [StructLayout(LayoutKind.Sequential)]
  164. public struct TCrdAdvParam
  165. {
  166. public Int16 userVelMode; // 用户速度规划模式: 0 系统前瞻速度规划, 1 用户设定速度规划(默认: 0)
  167. public Int16 transMode; // 过渡模式 0: 无过渡 1: 圆弧过渡 (默认:1)
  168. public Int16 noDataProtect; // 数据断流保护: 0不保护, 1保护 (默认: 1)
  169. public Int16 circAccChangeEn; // 圆弧变加速使能: 0不变加速, 1变加速 (默认: 0)
  170. public Int16 noCoplaneCircOptm; // 异面圆弧优化: 0不开启, 1开启
  171. public double turnCoef; // 拐弯系数:[0.01,100](默认:1.0)
  172. public double tol; // 插补精度:[0,1e9](默认:0 , 单位取决于设置的当量)
  173. };
  174. /// @brief 电子齿轮参数结构体
  175. [StructLayout(LayoutKind.Sequential)]
  176. public struct TGearParam
  177. {
  178. public Int32 masterScale; // 主轴齿数: (0,intMax]
  179. public Int32 slaveScale; // 从轴齿数: [intMin,0) || (0,intMax]
  180. public Int16 masterNo; // 主轴轴号: [0,63]
  181. public Int16 masterType; // 主轴类型: 0 轴规划, 1 轴编码器, 10 端子板编码器, 11 EtherCAT编码器
  182. public Int16 dirMode; // 方向模式: 0 跟随方向不限制, 1 正向绝对位置跟随, 2 负向绝对位置跟随, 3 正向相对位置跟随, 4 负向相对位置跟随
  183. public Int32 masterSlopeDis; // 主轴离合区:[0,intMax], 0表示没有加速过程,直接跟随
  184. };
  185. /// @brief 表补偿参数结构体
  186. public struct TTableCompParam
  187. {
  188. public Int16 tableId; // 表索引:[0,0]
  189. public Int16 dimension; // 补偿维数:{1,2,3}
  190. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
  191. public Int16[] srcAxNo; // 参考轴号:[0,63],数组有效的元素与补偿维数有关,如补偿维数=1,仅用到srcAxNo[0], 下同
  192. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
  193. public Int16[] srcType; // 参考轴类型:0 轴规划, 1 轴编码器
  194. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
  195. public Int32[] startPos; // 补偿起始位置:[intMin,intMax]
  196. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
  197. public Int32[] count; // 补偿点个数:[2,40000] (有效的元素的乘积不得超过40000,且各不小于2)
  198. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
  199. public Int32[] step; // 补偿间隔:[1,intMax]
  200. };
  201. /// @brief 采样配置参数结构体
  202. [StructLayout(LayoutKind.Sequential)]
  203. public struct TSamplePara
  204. {
  205. public Int16 interval; // 采样时间间隔
  206. public Int16 trigType; // 触发采样类型: 0 立即 1 延时 2 本地di 3 ECAT di
  207. public Int16 delay; // 延时时间 单位:周期
  208. public Int16 diNo; // di输入号
  209. public Int16 diLevel; // di的触发输入值 0或1
  210. };
  211. /// @brief 事件配置参数结构体
  212. ///
  213. #region Event
  214. [StructLayout(LayoutKind.Sequential)]
  215. public struct TEvent
  216. {
  217. public Int16 type; //事件类型
  218. public Int16 index; //事件变量索引
  219. public UInt32 loop; //事件最大允许触发次数
  220. public double value; //设置比较值
  221. public Int16 condition; //事件条件
  222. };
  223. [StructLayout(LayoutKind.Sequential)]
  224. public struct TTaskCrdStart
  225. {
  226. public Int16 crdNo;
  227. };
  228. [StructLayout(LayoutKind.Sequential)]
  229. public struct TTaskStartPtp
  230. {
  231. public Int16 axNo;
  232. public Int16 posType;
  233. public double tgtPos;
  234. };
  235. [StructLayout(LayoutKind.Sequential)]
  236. public struct TTaskStartJog
  237. {
  238. public Int16 axNo;
  239. public double tgtVel;
  240. };
  241. [StructLayout(LayoutKind.Sequential)]
  242. public struct TTaskStartGear
  243. {
  244. public Int16 axNo;
  245. };
  246. [StructLayout(LayoutKind.Sequential)]
  247. public struct TTaskStartPt
  248. {
  249. public Int16 sysNo;
  250. };
  251. [StructLayout(LayoutKind.Sequential)]
  252. public struct TTaskStartPvt
  253. {
  254. public Int16 axNum;
  255. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
  256. public Int16[] axArray;
  257. };
  258. [StructLayout(LayoutKind.Sequential)]
  259. public struct TTaskUpdatePtpMvPara
  260. {
  261. public Int16 axNo;
  262. public double tgtVel;
  263. public double tgtAcc;
  264. public double tgtDec;
  265. };
  266. [StructLayout(LayoutKind.Sequential)]
  267. public struct TTaskUpdateJogMvPara
  268. {
  269. public Int16 axNo;
  270. public double tgtVel;
  271. public double tgtAcc;
  272. public double tgtDec;
  273. };
  274. [StructLayout(LayoutKind.Sequential)]
  275. public struct TTaskUpdatePtpTgtPos
  276. {
  277. public Int16 axNo;
  278. public double tgtPos;
  279. };
  280. [StructLayout(LayoutKind.Sequential)]
  281. public struct TTaskSetEcatDoBit
  282. {
  283. public Int16 doNo;
  284. public Int16 value;
  285. };
  286. [StructLayout(LayoutKind.Sequential)]
  287. public struct TTaskSetEcatGrpDo
  288. {
  289. public Int16 groupNo;
  290. public Int16 value;
  291. };
  292. [StructLayout(LayoutKind.Sequential)]
  293. public struct TTaskSetEcatDoBitInverse
  294. {
  295. public Int16 doIndex;
  296. public Int16 value;
  297. public Int16 inverseTime;
  298. };
  299. [StructLayout(LayoutKind.Sequential)]
  300. public struct TTaskSetEcatDaVal
  301. {
  302. public Int16 daIndex;
  303. public Int16 value;
  304. };
  305. [StructLayout(LayoutKind.Sequential)]
  306. public struct TTaskStopMove
  307. {
  308. public Int16 axNo;
  309. public Int16 stopType;
  310. };
  311. [StructLayout(LayoutKind.Sequential)]
  312. public struct TTaskPulseDo
  313. {
  314. public Int16 taskPulseDoIndex;
  315. public Int16 firstLevel;
  316. public Int32 highLevelTime;
  317. public Int32 lowLevelTime;
  318. public Int16 pulseNum;
  319. };
  320. [StructLayout(LayoutKind.Sequential)]
  321. public struct UTask
  322. {
  323. public TTaskCrdStart taskCrdStart;
  324. public TTaskStartPtp taskStartPtp;
  325. public TTaskStartJog taskStartJog;
  326. public TTaskStartGear taskStartGear;
  327. public TTaskStartPt taskStartPt;
  328. public TTaskStartPvt taskStartPvt;
  329. public TTaskUpdatePtpMvPara taskUpdatePtpMvPara;
  330. public TTaskUpdateJogMvPara taskUpdateJogMvPara;
  331. public TTaskSetEcatDoBit taskSetEcatDoBit;
  332. public TTaskSetEcatGrpDo taskSetEcatGrpDo;
  333. public TTaskSetEcatDoBitInverse taskSetEcatDoBitInverse;
  334. public TTaskSetEcatDaVal taskSetEcatDaVal;
  335. public TTaskUpdatePtpTgtPos taskUpdatePtpTgtPos;
  336. public TTaskPulseDo taskPulseDo;
  337. public TTaskStopMove taskStopMove;
  338. };
  339. #endregion
  340. /// @defgroup EcatDef EtherCAT相关宏定义
  341. /// @brief EtherCAT相关宏定义
  342. #region
  343. /// @defgroup MasterSts 主站状态码
  344. /// @brief 板卡ECAT主站状态定义
  345. #region
  346. public const uint EC_MASTER_IDLE = (0); ///< EtherCat主站尚未初始化
  347. public const uint EC_MASTER_INIT = (1); ///< EtherCat主站初始化
  348. public const uint EC_MASTER_SCAN_SLAVE = (2); ///< EtherCat主站正在扫描从站设备
  349. public const uint EC_MASTER_SCAN_SLAVE_END = (3); ///< EtherCat主站扫描从站设备结束
  350. public const uint EC_MASTER_SCAN_MODULES = (4); ///< EtherCat主站正在扫描从站设备MODULES
  351. public const uint EC_MASTER_SCAN_MODULES_END = (5); ///< EtherCat主站扫描从站设备MODULES结束
  352. public const uint EC_MASTER_OP = (6); ///< EtherCat主站进入OP状态
  353. public const uint EC_MASTER_ERR = (7); ///< EtherCat主站链路状态有错误
  354. #endregion
  355. /// @defgroup SlaveSts 从站状态码
  356. /// @brief 板卡EtherCAT从站状态定义
  357. #region
  358. public const uint EC_SLAVE_STATE_UNKNOWN = (0x00); ///< EtherCat从站在未知状态
  359. public const uint EC_SLAVE_STATE_INIT = (0x01); ///< EtherCat从站在初始状态
  360. public const uint EC_SLAVE_STATE_PREOP = (0x02); ///< EtherCat从站在PREOP状态
  361. public const uint EC_SLAVE_STATE_BOOT = (0x03); ///< EtherCat从站在BOOT状态
  362. public const uint EC_SLAVE_STATE_SAFEOP = (0x04); ///< EtherCat从站在SAVEOP状态
  363. public const uint EC_SLAVE_STATE_OP = (0x08); ///< EtherCat从站在OP状态
  364. public const uint EC_SLAVE_STATE_ACK_ERR = (0x10); ///< EtherCat从站有错误
  365. #endregion
  366. /// @defgroup EcatError 协议栈错误码
  367. /// @brief 协议栈错误码EcatErrorCode定义
  368. #region
  369. public const uint ERROR_CODE_NO_SUCH_SLAVE = (0x0003); ///< 配置阶段, 没有这个从站, 处理方法: 检查从站是否掉线, 重新扫描配置
  370. public const uint ERROR_CODE_INVALID_PDO = (0x0004); ///< 配置阶段, 非法PDO, 处理方法: 检查从站厂家是否更新xml配置文件, 与汇川默认配置不一致
  371. public const uint ERROR_CODE_INVALID_SDO = (0x0005); ///< 配置阶段, 非法SDO, 处理方法: 检查从站厂家是否更新xml配置文件, 与汇川默认配置不一致
  372. public const uint ERROR_CODE_INVALID_ENTRY = (0x0006); ///< 配置阶段, 非法ENTRY, 处理方法: 检查从站厂家是否更新xml配置文件, 与汇川默认配置不一致
  373. public const uint ERROR_CODE_PASECFGFAIL = (0x000D); ///< 解析XML设备配置失败, 处理方法: 设备配置文件已经被破坏, 重新扫描配置
  374. public const uint ERROR_CODE_CFGREGISTFAIL = (0x0015); ///< 配置reg失败, 处理方法: 检查从站厂家是否更新xml配置文件, 与汇川默认配置不一致
  375. public const uint ERROR_CODE_CFGDIFFONLINE = (0x0016); ///< 在线从站与配置不一致, 处理方法: 检查从站是否掉线, 重新扫描配置
  376. public const uint ERROR_CODE_AXIS_NUM_BEYOND = (0x0017); ///< 轴配置数量超过板卡最大支持轴数;
  377. public const uint ERROR_CODE_SLAVE_OFFLINE = (0x001a); ///< 从站掉线错误, 高8位为从站号, 即bit[15:8]-轴号, 处理方法: 检查从高8位数字开始从站是否掉线, 或者重新扫描配置
  378. public const uint ERROR_CODE_SDOBF_NONECAT = (0x001b); ///< SDO缓冲区收到非ECAT帧错误, 处理方法: 检查线路是否接错, 是否有其他非Ethercat设备接入
  379. public const uint ERROR_CODE_PORT0_NOTLINK = (0x001c); ///< 端口未接ECAT设备错误, 处理方法: 检查板卡端线路是否正常接线, 是否接线不可靠
  380. public const uint ERROR_CODE_SET_CYCLETIME_PARA_ERR = (0x001e); ///< 设置周期时间参数错误, 处理方法: 错误的DC时钟配置, 只支持125us, 250us, 500us, 125us, 1000us, 2000us, 4000us, 8000us周期
  381. public const uint ERROR_CODE_COE_SDO_INIT_ERR = (0x001f); ///< 在初始化阶段coe配置错误, 处理方法: 检查从站厂家是否更新xml配置文件, 与汇川默认配置不一致; 或者可能例如RTU模块配置错误
  382. public const uint ERROR_CODE_SLAVE_STATE_ERR = (0x0020); ///< 从站状态错误, 高8位为轴号, 即bit[15:8]-轴号, 处理方法: 检查从高8位数字从站状态, 检查从站设备异常原因
  383. public const uint ERROR_CODE_SLAVE_SII_ERR = (0x0037); ///< E2ROM 信息有误, 处理方法: 一般为从站保存的e2rom信息有误, 可以使用twincat确认并联系厂家
  384. public const uint ERROR_CODE_SLAVE_NUM_BEYOND = (0x003b); ///< 从站在线超过最大64个站
  385. #endregion
  386. /// @defgroup AbortCode SDO访问舍弃码
  387. /// @brief 以下宏定义针对IIMC_GetEcatSdo, IMC_SetEcatSdo函数
  388. #region
  389. public const uint ABORT_CODE1 = (0x05030000); ///< 从站Toggle bit 没有变化
  390. public const uint ABORT_CODE2 = (0x05040000); ///< SDO 访问超时
  391. public const uint ABORT_CODE3 = (0x05040001); ///< 客户端/服务器 命令非法或未知
  392. public const uint ABORT_CODE4 = (0x05040005); ///< 内存溢出
  393. public const uint ABORT_CODE5 = (0x06010000); ///< 不支持访问该对象
  394. public const uint ABORT_CODE6 = (0x06010001); ///< 尝试去读一个只写对象
  395. public const uint ABORT_CODE7 = (0x06010002); ///< 尝试去写一个只读对象
  396. public const uint ABORT_CODE8 = (0x06020000); ///< 对象字典中不存在该对象
  397. public const uint ABORT_CODE9 = (0x06040041); ///< 该对象不能映射成PDO
  398. public const uint ABORT_CODE10 = (0x06040042); ///< 对象映射成PDO超出 PDO长度
  399. public const uint ABORT_CODE11 = (0x06040043); ///< 通用参数非法
  400. public const uint ABORT_CODE12 = (0x06040047); ///< 设备内不兼容
  401. public const uint ABORT_CODE13 = (0x06060000); ///< 由于硬件原因访问失败
  402. public const uint ABORT_CODE14 = (0x06070010); ///< 数据类型不匹配, 长度参数
  403. public const uint ABORT_CODE15 = (0x06070012); ///< 数据类型不匹配, 长度太大
  404. public const uint ABORT_CODE16 = (0x06070013); ///< 数据类型不匹配, 长度太小
  405. public const uint ABORT_CODE17 = (0x06090011); ///< 该对象子索引不存在
  406. public const uint ABORT_CODE18 = (0x06090030); ///< 参数超出范围
  407. public const uint ABORT_CODE19 = (0x06090031); ///< 参数超出范围太大
  408. public const uint ABORT_CODE20 = (0x06090032); ///< 参数超出范围太小
  409. public const uint ABORT_CODE21 = (0x06090036); ///< 最大值小于最小值
  410. public const uint ABORT_CODE22 = (0x08000000); ///< 一般错误
  411. public const uint ABORT_CODE23 = (0x08000020); ///< 数据不能被传输或被保存
  412. public const uint ABORT_CODE24 = (0x08000021); ///< 数据不能被传输或被保存由于本地控制
  413. public const uint ABORT_CODE25 = (0x08000022); ///< 数据不能被传输或被保存由于当前状态
  414. public const uint ABORT_CODE26 = (0x08000023); ///< 缺乏对象字典或者对象字典创建失败
  415. #endregion
  416. /// @defgroup ServoOpMode 伺服操作模式定义
  417. /// @brief 定义了伺服402协议中的控制模式
  418. #region
  419. public const Int16 TQ_OP_MODE = (4); ///< TQ模式
  420. public const Int16 HM_OP_MODE = (6); ///< 回零模式
  421. public const Int16 CSP_OP_MODE = (8); ///< CSP模式
  422. public const Int16 CSV_OP_MODE = (9); ///< CSV模式
  423. public const Int16 CST_OP_MODE = (10); ///< CST模式
  424. #endregion
  425. /// @defgroup EcatHomingMethod 402回零方法定义
  426. /// @brief 定义了伺服402回零模式的回零方法类型
  427. #region
  428. public const uint HOME_NLIMT_ZINDEX = (1); ///< 负限位+Z信号
  429. public const uint HOME_PLIMT_ZINDEX = (2); ///< 正限位+Z信号
  430. public const uint HOME_PHOME_FEDGE_ZINDEX = (3); ///< 正原点开关下降沿+Z信号
  431. public const uint HOME_PHOME_REDGE_ZINDEX = (4); ///< 正原点开关上升沿+Z信号
  432. public const uint HOME_NHOME_FEDGE_ZINDEX = (5); ///< 负原点开关下降沿+Z信号
  433. public const uint HOME_NHOME_REDGE_ZINDEX = (6); ///< 负原点开关上升沿+Z信号
  434. public const uint HOME_PLIMT_PHOME_FEDGE_ZINDEX = (7); ///< 正限位+正原点开关下降沿+Z信号
  435. public const uint HOME_PLIMT_PHOME_REDGE_ZINDEX = (8); ///< 正限位+正原点开关上升沿+Z信号
  436. public const uint HOME_PLIMT_NHOME_REDGE_ZINDEX = (9); ///< 正限位+负原点开关上升沿+Z信号
  437. public const uint HOME_PLIMT_NHOME_FEDGE_ZINDEX = (10); ///< 正限位+负原点开关下降沿+Z信号
  438. public const uint HOME_NLIMT_NHOME_FEDGE_ZINDEX = (11); ///< 负限位+负原点开关下降沿+Z信号
  439. public const uint HOME_NLIMT_NHOME_REDGE_ZINDEX = (12); ///< 负限位+负原点开关上升沿+Z信号
  440. public const uint HOME_NLIMT_PHOME_REDGE_ZINDEX = (13); ///< 负限位+正原点开关上升沿+Z信号
  441. public const uint HOME_NLIMT_PHOME_FEDGE_ZINDEX = (14); ///< 负限位+正原点开关下降沿+Z信号
  442. public const uint HOME_NLIMT = (17); ///< 负限位
  443. public const uint HOME_PLIMT = (18); ///< 正限位
  444. public const uint HOME_PHOME_FEDGE = (19); ///< 正原点开关下降沿
  445. public const uint HOME_PHOME_REDGE = (20); ///< 正原点开关上升沿
  446. public const uint HOME_NHOME_FEDGE = (21); ///< 负原点开关下降沿
  447. public const uint HOME_NHOME_REDGE = (22); ///< 负原点开关上升沿
  448. public const uint HOME_PLIMT_PHOME_FEDGE = (23); ///< 正限位+正原点开关下降沿
  449. public const uint HOME_PLIMT_PHOME_REDGE = (24); ///< 正限位+正原点开关上升沿
  450. public const uint HOME_PLIMT_NHOME_REDGE = (25); ///< 正限位+负原点开关上升沿
  451. public const uint HOME_PLIMT_NHOME_FEDGE = (26); ///< 正限位+负原点开关下降沿
  452. public const uint HOME_NLIMT_NHOME_FEDGE = (27); ///< 负限位+负原点开关下降沿
  453. public const uint HOME_NLIMT_NHOME_REDGE = (28); ///< 负限位+负原点开关上升沿
  454. public const uint HOME_NLIMT_PHOME_REDGE = (29); ///< 负限位+正原点开关上升沿
  455. public const uint HOME_NLIMT_PHOME_FEDGE = (30); ///< 负限位+正原点开关下降沿
  456. public const uint HOME_NEGZINDEX = (33); ///< 负向Z信号
  457. public const uint HOME_POSZINDEX = (34); ///< 正向Z信号
  458. public const uint HOME_CURRENT_POS = (35); ///< 当前位置
  459. #endregion
  460. /// @defgroup EcatHomingSts 402回零状态定义
  461. /// @brief 定义了伺服402回零模式下的工作状态
  462. #region
  463. public const Int16 HOME_IN_PROGRESS = (0); ///< 正在回零中
  464. public const Int16 HOME_INTERRUPTED_OR_NOT_START = (1); ///< 回零中断或者没有开始启动
  465. public const Int16 HOME_ATTAINED_BUT_NOT_REACH = (2); ///< 回零结束, 但没有到设定的目标位置
  466. public const Int16 HOME_SUCESS = (3); ///< 回零成功
  467. public const Int16 HOME_ERR_VEL_NOT_ZERO = (4); ///< 回零中发生错误, 同时速度不为0
  468. public const Int16 HOME_ERR_VEL_ZERO = (5); ///< 回零中发生错误, 同时速度为0
  469. #endregion
  470. /// @defgroup CSPHomingMethod CSP回零方法定义
  471. /// @brief 定义了板卡CSP回零模式的回零方法
  472. #region
  473. public const Int32 HOMING_ECAT_CSP_METHOD_NONE = (-1); ///< 非回零模式
  474. public const Int32 HOMING_ECAT_CSP_METHOD_DI = (0); ///< DI回零方式
  475. public const Int32 HOMING_ECAT_CSP_METHOD_INDEX = (1); ///< Index回零方式
  476. public const Int32 HOMING_ECAT_CSP_METHOD_LIMIT_INDEX = (2); ///< 限位+Index回零方式
  477. public const Int32 HOMING_ECAT_CSP_METHOD_LIMIT_DI = (3); ///< 限位+Di回零方式
  478. #endregion
  479. /// @defgroup CSPHomingSts CSP回零状态定义
  480. /// @brief 定义了板卡CSP回零模式下的工作状态
  481. #region
  482. public const Int16 HOME_CSP_STS_RUNING = (0x01); ///< CSP回零中
  483. public const Int16 HOME_CSP_STS_STOPPING = (0x02); ///< CSP回零停止中
  484. public const Int16 HOME_CSP_STS_STOPPED = (0x03); ///< CSP回零已停止
  485. public const Int16 HOME_CSP_STS_FINISH = (0x04); ///< CSP回零已完成
  486. public const Int16 HOME_CSP_STS_ERROR = (0x05); ///< CSP回零错误
  487. #endregion
  488. #endregion
  489. /// @defgroup CardSysDef 板卡系统相关宏定义
  490. #region
  491. /// @defgroup CardResType 资源类型宏定义
  492. /// @brief 以下宏定义针对IMC_GetResCount函数
  493. #region
  494. public const uint MC_ECAT_DO = (0); ///< ecat的通用do
  495. public const uint MC_LOCAL_DO = (1); ///< localBus的通用do
  496. public const uint MC_ECAT_DI = (11); ///< ecat的通用DI
  497. public const uint MC_ECAT_AD = (12); ///< ecat的通用AD
  498. public const uint MC_ECAT_DA = (13); ///< ecat的通用DA
  499. public const uint MC_ECAT_AXIS = (15); ///< ecat的通用AXIS
  500. public const uint MC_ECAT_REG_IN = (16); ///< ecat的通用RegIn
  501. public const uint MC_ECAT_REG_OUT = (17); ///< ecat的通用RegOut
  502. public const uint MC_ECAT_ENC = (18); ///< ecat的通用RegOut
  503. public const uint MC_AXIS = (30); ///< 板卡最大轴数
  504. public const uint MC_PROFILE = (31); ///< 板卡规划轴数
  505. public const uint MC_CRD_MAX_CNT = (60); ///< 坐标系最大个数
  506. public const uint MC_CRD_BUF_LEN = (61); ///< 坐标系缓冲区长度
  507. #endregion
  508. /// @defgroup CardVersionType 板卡系统版本类型定义
  509. /// @brief 以下宏定义针对IMC_GetImcCardVersion函数
  510. #region
  511. public const uint SOFT_VERSION = (0); // 总软件版本
  512. public const uint DSP_VERSION = (1); // HAL2软件版本
  513. public const uint ARM_VERSION = (2); // ARM软件版本
  514. public const uint API_VERSION = (3); // API软件版本
  515. public const uint FPGA_VERSION = (4); // FPGA固件版本
  516. public const uint DSP2_VERSION = (5); // HAL3固件版本
  517. public const uint LOCAL_VERSION = (6); // 端子板固件版本
  518. public const uint OS_ARM_VERSION = (11); // ARM系统版本
  519. public const uint LIB_DSP_VERSION = (12); // LibInfo软件版本
  520. public const uint LIB_ECAT_BOARD_APP_VERSION = (20); // 协议栈软件版本1
  521. public const uint LIB_ECAT_APP_VERSION = (21); // 协议栈软件版本2
  522. public const uint LIB_ECAT_VERSION = (22); // 协议栈软件版本3
  523. public const uint LIB_ECAT_PARSER_ENI_VERSION = (23); // 协议栈软件版本4
  524. #endregion
  525. #endregion
  526. /// @defgroup AxDiStopType 轴DI停止类型定义
  527. /// @brief 以下宏定义针对IMC_SetAxStopTrigPara、IMC_GetAxStopTrigPara函数
  528. #region
  529. public const uint CNST_DI_STOP_TYPE_ECATDI = (0); ///< EcatDI停止类型
  530. public const uint CNST_DI_STOP_TYPE_PROBLE1_RF = (1); ///< 探针1上升沿或下降沿停止
  531. public const uint CNST_DI_STOP_TYPE_PROBLE1_R = (2); ///< 探针1上升沿停止
  532. public const uint CNST_DI_STOP_TYPE_PROBLE1_F = (3); ///< 探针1下降沿停止
  533. #endregion
  534. /// @defgroup AxStsBit 轴状态位定义
  535. /// @brief 以下宏定义针对IMC_GetAxSts函数
  536. #region
  537. public const uint AX_ALARM_BIT = (0x00000001); ///< 轴驱动报警
  538. public const uint AX_SVON_BIT = (0x00000002); ///< 伺服使能
  539. public const uint AX_BUSY_BIT = (0x00000004); ///< 轴忙状态
  540. public const uint AX_ARRIVE_BIT = (0x00000008); ///< 轴到位状态
  541. public const uint AX_POSLMT_BIT = (0x00000010); ///< 正硬限位报警
  542. public const uint AX_NEGLMT_BIT = (0x00000020); ///< 负硬限位报警
  543. public const uint AX_SOFT_POSLMT_BIT = (0x00000040); ///< 正软限位报警
  544. public const uint AX_SOFT_NEGLMT_BIT = (0x00000080); ///< 负软限位报警
  545. public const uint AX_ERRPOS_BIT = (0x00000100); ///< 轴位置误差越限标志
  546. public const uint AX_EMG_STOP_BIT = (0x00000200); ///< 运动急停标志
  547. public const uint AX_ECAT_BIT = (0x00000400); ///< 总线轴标志
  548. public const uint AX_SW_ABNOR_BIT = (0x00000800); ///< 轴异常报警=(龙门);
  549. public const uint AX_WARING_BIT = (0x00001000); ///< 轴警告
  550. public const uint AX_HM_BIT = (0x00002000); ///< 原点信号状态
  551. public const uint AX_UNLINK_BIT = (0x00004000); ///< 轴掉线状态
  552. public const uint AX_ECAT_TGTREACH_BIT = (0x00008000); ///< 状态字里的到位状态
  553. #endregion
  554. /******************采集数据类型 定义***************************/
  555. // 单轴数据类型
  556. public const Int16 SAMPLE_ADDRESS_TYPE_AX_PRF_POS = (0x01); ///< 轴规划位置
  557. public const Int16 SAMPLE_ADDRESS_TYPE_AX_ENC_POS = (0x02); ///< 轴编码器位置
  558. public const Int16 SAMPLE_ADDRESS_TYPE_AX_PRF_VEL = (0x03); ///< 轴规划速度
  559. public const Int16 SAMPLE_ADDRESS_TYPE_AX_ENC_VEL = (0x04); ///< 轴编码器速度
  560. public const Int16 SAMPLE_ADDRESS_TYPE_AX_PRF_ACC = (0x05); ///< 轴规划加速度
  561. public const Int16 SAMPLE_ADDRESS_TYPE_AX_ENC_ACC = (0x06); ///< 轴编码器加速度
  562. public const Int16 SAMPLE_ADDRESS_TYPE_PRF_POS = (0x07); ///< 规划位置
  563. public const Int16 SAMPLE_ADDRESS_TYPE_PRF_CMPPOS = (0x08); ///< 比较位置
  564. public const Int16 SAMPLE_ADDRESS_TYPE_AX_TORQ = (0x0a); ///< 轴扭矩
  565. public const Int16 SAMPLE_ADDRESS_TYPE_AX_STS = (0x0b); ///< 轴状态
  566. // 资源信号数据类型
  567. public const Int16 SAMPLE_ADDRESS_TYPE_ECAT_DI = (0x30); ///< ECAT通用DI
  568. public const Int16 SAMPLE_ADDRESS_TYPE_ECAT_DO = (0x31); ///< ECAT通用DO
  569. public const Int16 SAMPLE_ADDRESS_TYPE_LOCAL_DI = (0x32); ///< 端子板DI
  570. public const Int16 SAMPLE_ADDRESS_TYPE_LOCAL_DO = (0x33); ///< 端子板DO
  571. public const Int16 SAMPLE_ADDRESS_TYPE_ECAT_AD = (0x34); ///< ECAT AD
  572. public const Int16 SAMPLE_ADDRESS_TYPE_ECAT_DA = (0x35); ///< ECAT DA
  573. // 总线对象字典采集
  574. public const Int16 SAMPLE_ADDRESS_TYPE_RXPDO_2 = (0x40); ///< pdo通用, 2字节, 写
  575. public const Int16 SAMPLE_ADDRESS_TYPE_RXPDO_4 = (0x41); ///< pdo通用, 4字节, 写
  576. public const Int16 SAMPLE_ADDRESS_TYPE_6040 = (0x42); ///< 控制字
  577. public const Int16 SAMPLE_ADDRESS_TYPE_607a = (0x43); ///< 目标位置
  578. public const Int16 SAMPLE_ADDRESS_TYPE_60ff = (0x44); ///< 目标速度
  579. public const Int16 SAMPLE_ADDRESS_TYPE_6071 = (0x45); ///< 目标力矩
  580. public const Int16 SAMPLE_ADDRESS_TYPE_6060 = (0x46); ///< 模式控制
  581. public const Int16 SAMPLE_ADDRESS_TYPE_60fe = (0x47); ///< 数字量输出
  582. public const Int16 SAMPLE_ADDRESS_TYPE_60b8 = (0x48); ///< 探针控制字
  583. public const Int16 SAMPLE_ADDRESS_TYPE_TXPDO_2 = (0x50); ///< pdo通用, 2字节, 读
  584. public const Int16 SAMPLE_ADDRESS_TYPE_TXPDO_4 = (0x51); ///< pdo通用, 4字节, 读
  585. public const Int16 SAMPLE_ADDRESS_TYPE_6041 = (0x52); ///< 状态字
  586. public const Int16 SAMPLE_ADDRESS_TYPE_6064 = (0x53); ///< 实际位置
  587. public const Int16 SAMPLE_ADDRESS_TYPE_606c = (0x54); ///< 实际速度
  588. public const Int16 SAMPLE_ADDRESS_TYPE_6077 = (0x55); ///< 实际力矩
  589. public const Int16 SAMPLE_ADDRESS_TYPE_60f4 = (0x56); ///< 跟随误差
  590. public const Int16 SAMPLE_ADDRESS_TYPE_603f = (0x57); ///< 错误码
  591. public const Int16 SAMPLE_ADDRESS_TYPE_60fd = (0x58); ///< 数字量输入
  592. public const Int16 SAMPLE_ADDRESS_TYPE_60b9 = (0x59); ///< 探针状态字
  593. public const Int16 SAMPLE_ADDRESS_TYPE_60ba = (0x60); ///< 探针位置1
  594. public const Int16 SAMPLE_ADDRESS_TYPE_60bb = (0x61); ///< 探针位置2
  595. // 插补数据类型
  596. public const Int16 SAMPLE_ADDRESS_TYPE_CRD_POSX = (0x100); ///< 插补坐标系, X轴位置
  597. public const Int16 SAMPLE_ADDRESS_TYPE_CRD_POSY = (0x101); ///< 插补坐标系, Y轴位置
  598. public const Int16 SAMPLE_ADDRESS_TYPE_CRD_POSZ = (0x102); ///< 插补坐标系, Z轴位置
  599. public const Int16 SAMPLE_ADDRESS_TYPE_CRD_VEL = (0x110); ///< 插补坐标系, 合成速度
  600. // 采集触发类型
  601. public const Int16 SAMPLE_TRIG_IMMEDIATE = (0); ///< 立即采集
  602. public const Int16 SAMPLE_TRIG_DELAY = (1); ///< 延时采集
  603. public const Int16 SAMPLE_TRIG_LOCAL_DI = (2); ///< 本地DI触发
  604. public const Int16 SAMPLE_TRIG_ECAT_DI = (3); ///< ECAT 的DI 触发
  605. //事件类型定义
  606. public const Int16 EVENT_TYPE_PRFPOS = (1);
  607. public const Int16 EVENT_TYPE_PRFVEL = (2);
  608. public const Int16 EVENT_TYPE_ENCPOS = (3);
  609. public const Int16 EVENT_TYPE_ENCVEL = (4);
  610. public const Int16 EVENT_TYPE_CRDPOS_X = (5);
  611. public const Int16 EVENT_TYPE_CRDPOS_Y = (6);
  612. public const Int16 EVENT_TYPE_CRDPOS_Z = (7);
  613. public const Int16 EVENT_TYPE_CRDVEL = (8);
  614. public const Int16 EVENT_TYPE_AXSTS_ALARM = (9);
  615. public const Int16 EVENT_TYPE_AXSTS_SVON = (10);
  616. public const Int16 EVENT_TYPE_AXSTS_BUSY = (11);
  617. public const Int16 EVENT_TYPE_AXSTS_ARRIVE = (12);
  618. public const Int16 EVENT_TYPE_AXSTS_POSLMT = (13);
  619. public const Int16 EVENT_TYPE_AXSTS_NEGLMT = (14);
  620. public const Int16 EVENT_TYPE_AXSTS_SOFT_POSLMT = (15);
  621. public const Int16 EVENT_TYPE_AXSTS_SOFT_NEGLMT = (16);
  622. public const Int16 EVENT_TYPE_AXSTS_ERRPOS = (17);
  623. public const Int16 EVENT_TYPE_AXSTS_EMGSTOP = (18);
  624. public const Int16 EVENT_TYPE_AXSTS_ECAT = (19);
  625. public const Int16 EVENT_TYPE_AXSTS_SW_ABNOR = (20);
  626. public const Int16 EVENT_TYPE_AXSTS_WARING = (21);
  627. public const Int16 EVENT_TYPE_AXSTS_HM = (22);
  628. public const Int16 EVENT_TYPE_AXSTS_UNLINK = (23);
  629. public const Int16 EVENT_TYPE_AXSTS_TGTREACH = (24);
  630. public const Int16 EVENT_TYPE_CRDSTS = (25);
  631. public const Int16 EVENT_TYPE_CRDID = (26);
  632. public const Int16 EVENT_TYPE_DI = (27);
  633. public const Int16 EVENT_TYPE_AD = (28);
  634. public const Int16 EVENT_TYPE_GLOBALVAL = (29);
  635. //事件条件定义
  636. public const Int16 EVENT_CONDITION_EQ = (1); ///< 变量值等于设定值
  637. public const Int16 EVENT_CONDITION_NE = (2); ///< 变量值不等于设定值
  638. public const Int16 EVENT_CONDITION_GT = (3); ///< 变量值大于设定值
  639. public const Int16 EVENT_CONDITION_LT = (4); ///< 变量值小于设定值
  640. public const Int16 EVENT_CONDITION_CHANGE_TO = (5); ///< 变量值改变为设定值
  641. public const Int16 EVENT_CONDITION_CHANGE = (6); ///< 变量值改变
  642. public const Int16 EVENT_CONDITION_UP = (7); ///< 变量值增大
  643. public const Int16 EVENT_CONDITION_DOWN = (8); ///< 变量值减小
  644. public const Int16 EVENT_CONDITION_REMAIN_AT = (9); ///< 变量值保持为设定值
  645. public const Int16 EVENT_CONDITION_REMAIN = (10); ///< 变量值保持不变
  646. public const Int16 EVENT_CONDITION_CROSS_POSITIVE = (11); ///< 变量值正向穿越设定值
  647. public const Int16 EVENT_CONDITION_CROSS_NEGATIVE = (12); ///< 变量值负向穿越设定值
  648. //事件功能中任务类型定义
  649. public const Int16 TASK_TYPE_CRDSTART = (1);
  650. public const Int16 TASK_TYPE_STARTPTPMOVE = (2);
  651. public const Int16 TASK_TYPE_STARTJOGMOVE = (3);
  652. public const Int16 TASK_TYPE_STARTGEARMOVE = (4);
  653. public const Int16 TASK_TYPE_STARTPTMOVE = (5);
  654. public const Int16 TASK_TYPE_STARTPVTMOVE = (6);
  655. public const Int16 TASK_TYPE_UPDATEPTPMOVEPARA = (7);
  656. public const Int16 TASK_TYPE_UPDATEJOGMOVEPARA = (8);
  657. public const Int16 TASK_TYPE_SETECATDOBIT = (9);
  658. public const Int16 TASK_TYPE_SETECATGRPDO = (10);
  659. public const Int16 TASK_TYPE_SETECATDOBITINVERSE = (11);
  660. public const Int16 TASK_TYPE_SETECATDAVAL = (12);
  661. public const Int16 TASK_TYPE_UPDATEPTPTGTPOS = (13);
  662. public const Int16 TASK_TYPE_PLUSEDO = (14);
  663. public const Int16 TASK_TYPE_STOPMOVE = (15);
  664. ///@defgroup CardBasic CardBasic
  665. ///@brief 板卡基本操作
  666. #region CardBasic
  667. ///@defgroup CardOpen CardOpen
  668. ///@brief 板卡开启与关闭
  669. #region CardOpen
  670. /// @brief 获取板卡数量
  671. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetCardsNum", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  672. public static extern UInt32 IMC_GetCardsNum(ref Int16 pCardsNum, Int16[] pCardIndexArray);
  673. /// @brief 按卡号开启控制卡
  674. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_OpenCard", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  675. public static extern UInt32 IMC_OpenCard(Int16 cardIndex);
  676. /// @brief 按卡号关闭控制卡
  677. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CloseCard", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  678. public static extern UInt32 IMC_CloseCard(Int16 cardIndex);
  679. #endregion
  680. ///@defgroup CardConfigFile CardConfigFile
  681. ///@brief 板卡配置文件操作
  682. #region CardConfigFile
  683. /// @brief 上传控制卡的设备配置文件(包括主站使能, 规划周期, EtherCAT对象以及偏置等), 上传文件的路径在设定目录下
  684. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpLoadDeviceConfig", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  685. public static extern UInt32 IMC_UpLoadDeviceConfig(Int16 cardIndex, string pathName);
  686. /// @brief 下载控制器的设备配置文件(包括主站使能, 规划周期, EtherCAT对象以及偏置等), 下载文件的路径在设定目录下
  687. /// @attention 当次下载下去之后, 非立即生效, 需要调用扫描板卡指令才能生效
  688. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_DownLoadDeviceConfig", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  689. public static extern UInt32 IMC_DownLoadDeviceConfig(Int16 cardIndex, string pathName);
  690. /// @brief 下载控制器的系统配置文件(包括轴映射、轴运动参数、IO取反滤波等硬件信号配置参数)
  691. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_DownLoadSystemConfig", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  692. public static extern UInt32 IMC_DownLoadSystemConfig(Int16 cardIndex, string pathName);
  693. #endregion
  694. #endregion
  695. ///@defgroup CardSysConfig CardSysConfig
  696. ///@brief 板卡系统配置相关函数
  697. #region CardSysConfig
  698. ///@defgroup EmgConfig EmgConfig
  699. ///@brief 急停参数配置函数
  700. #region EmgConfig
  701. /// @brief 设置停止信号的滤波系数
  702. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEmgFilter", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  703. public static extern UInt32 IMC_SetEmgFilter(Int16 cardIndex, Int16 filter);
  704. /// @brief 获取停止信号的滤波系数
  705. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEmgFilter", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  706. public static extern UInt32 IMC_GetEmgFilter(Int16 cardIndex, ref Int16 pFilter);
  707. /// @brief 设置急停信号触发的电平取反
  708. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEmgTrigLevelInv", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  709. public static extern UInt32 IMC_SetEmgTrigLevelInv(Int16 cardIndex, Int16 inverse);
  710. /// @brief 获取急停信号触发的电平取反
  711. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEmgTrigLevelInv", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  712. public static extern UInt32 IMC_GetEmgTrigLevelInv(Int16 cardIndex, ref Int16 pInverse);
  713. /// @brief 获取急停状态
  714. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEmgSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  715. public static extern UInt32 IMC_GetEmgSts(Int16 cardIndex, ref Int16 pSts);
  716. /// @brief 设置急停时是否复位所有 DO 输出的开关使能
  717. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEmgDoResetFlag", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  718. public static extern UInt32 IMC_SetEmgDoResetFlag(Int16 cardIndex, Int16 enable);
  719. /// @brief 读取急停时是否复位所有 DO 输出的开关使能
  720. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEmgDoResetFlag", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  721. public static extern UInt32 IMC_GetEmgDoResetFlag(Int16 cardIndex, ref Int16 pEnable);
  722. /// @brief 设置是否忽略板卡的ECAT连接状态
  723. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatLinkStsIgnore", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  724. public static extern UInt32 IMC_SetEcatLinkStsIgnore(Int16 cardIndex, Int16 flag);
  725. #endregion
  726. ///@defgroup Watchdog Watchdog
  727. ///@brief 看门狗参数配置函数
  728. #region Watchdog
  729. /// @brief 设置看门狗, 在报警时, 进行急停动作。主要用于检查应用层软件是否卡死。
  730. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_OpenWatchDog", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  731. public static extern UInt32 IMC_OpenWatchDog(Int16 cardIndex, Int32 feedTime);
  732. /// @brief 喂看门狗操作
  733. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_FeedWatchDog", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  734. public static extern UInt32 IMC_FeedWatchDog(Int16 cardIndex);
  735. /// @brief 关闭看门狗检查
  736. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CloseWatchDog", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  737. public static extern UInt32 IMC_CloseWatchDog(Int16 cardIndex);
  738. #endregion
  739. ///@defgroup CardTimeInfo CardTimeInfo
  740. ///@brief 板卡内部时钟信息
  741. #region CardTimeInfo
  742. /// @brief 获取板卡的CPU负载
  743. /// @warning 建议负载率不要超过60%
  744. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetCalcLoadRatio", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  745. public static extern UInt32 IMC_GetCalcLoadRatio(Int16 cardIndex, ref double pLoadRatio);
  746. /// @brief 根据Type类型, 获取板卡对应的固件版本
  747. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetVersion", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  748. public static extern UInt32 IMC_GetVersion(Int16 cardIndex, Int16 type, Int16[] pVersion);
  749. #endregion
  750. ///@defgroup CardMasterInfo CardMasterInfo
  751. ///@brief 板卡主站配置信息
  752. #region CardMasterInfo
  753. /// @brief 获取主站启用配置, 从xml配置文件获取
  754. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetMasterCfgXml", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  755. public static extern UInt32 IMC_GetMasterCfgXml(Int16 cardIndex, ref Int16 pHwCfg);
  756. /// @brief 获取板卡的网口硬件连接状态
  757. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetHwPortLinkSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  758. public static extern UInt32 IMC_GetHwPortLinkSts(Int16 cardIndex, ref Int16 pLinkSts);
  759. /// @brief 获取板卡的网口硬件连接状态,Ex指令
  760. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetHwPortLinkStsEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  761. public static extern UInt32 IMC_GetHwPortLinkStsEx(Int16 cardIndex, ref Int16 pLinkSts);
  762. #endregion
  763. ///@defgroup CardReset CardReset
  764. ///@brief 板卡复位功能
  765. #region CardReset
  766. /// @brief 复位控制卡系统参数
  767. /// @details 控制卡规划层软件资源复位
  768. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ResetSysPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  769. public static extern UInt32 IMC_ResetSysPara(Int16 cardIndex);
  770. #endregion
  771. ///@defgroup UserCode UserCode
  772. ///@brief 用户配置
  773. #region UserCode
  774. /// @brief 设置用户密码
  775. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_WriteUserCode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  776. public static extern UInt32 IMC_WriteUserCode(Int16 cardIndex, Byte[] pCode, Int16 len);
  777. /// @brief 检验设置的用户密码
  778. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CheckUserCode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  779. public static extern UInt32 IMC_CheckUserCode(Int16 cardIndex, Byte[] pCode, Int16 len);
  780. /// @brief 写入用户数据
  781. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_WriteUserData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  782. public static extern UInt32 IMC_WriteUserData(Int16 cardIndex, Int16 offset, Byte[] pData, Int16 len);
  783. /// @brief 读取用户数据
  784. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ReadUserData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  785. public static extern UInt32 IMC_ReadUserData(Int16 cardIndex, Int16 offset, Byte[] pData, Int16 len);
  786. #endregion
  787. #endregion
  788. ///@defgroup EtherCAT EtherCAT
  789. ///@brief 板卡ECAT功能
  790. #region EtherCAT
  791. ///@defgroup EcatInit EcatInit
  792. ///@brief 板卡ECAT初始化功能
  793. #region EcatInit
  794. /// @brief 初始化板卡通讯, 主站进入OP状态
  795. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_InitEcatComm", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  796. public static extern UInt32 IMC_InitEcatComm(Int16 cardIndex);
  797. /// @brief 开启板卡通讯, 获取EtherCAT总线资源, 建立主站与各从站之间的通讯
  798. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartEcatComm", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  799. public static extern UInt32 IMC_StartEcatComm(Int16 cardIndex);
  800. /// @brief 关闭板卡通讯, 主站退出OP状态
  801. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_DelEcatComm", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  802. public static extern UInt32 IMC_DelEcatComm(Int16 cardIndex);
  803. /// @brief 初始化总线, 直到主站进入OP状态, 随后扫描EtherCAT总线资源, 并建立主站与各从站之间的通讯 (该函数会阻塞在EtherCAT的总线扫描同步阶段)
  804. /// @warning 该指令阻塞执行
  805. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ScanCardEcat", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  806. public static extern UInt32 IMC_ScanCardEcat(Int16 cardIndex, Int16 waitTime = 40);
  807. #endregion
  808. ///@defgroup EcatInfo EcatInfo
  809. ///@brief 板卡ECAT主站信息获取函数
  810. #region EcatInfo
  811. /// @brief 获取EtherCAT主站的状态
  812. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatMasterSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  813. public static extern UInt32 IMC_GetEcatMasterSts(Int16 cardIndex, ref UInt32 pStatus);
  814. /// @brief 获取EtherCAT协议栈通讯错误码
  815. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatErrCode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  816. public static extern UInt32 IMC_GetEcatErrCode(Int16 cardIndex, ref UInt32 pErrCode);
  817. /// @brief 获取EtherCAT主站的状态,Ex指令
  818. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatMasterStsEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  819. public static extern UInt32 IMC_GetEcatMasterStsEx(Int16 cardIndex, ref UInt32 pStatus);
  820. /// @brief 获取EtherCAT协议栈通讯错误码,Ex指令
  821. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatErrCodeEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  822. public static extern UInt32 IMC_GetEcatErrCodeEx(Int16 cardIndex, ref UInt32 pErrCode);
  823. /// @brief 获取EtherCAT从站当前通讯阶段INIT、PreOP、SafeOp、OP
  824. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatSlaveSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  825. public static extern UInt32 IMC_GetEcatSlaveSts(Int16 cardIndex, Int16 slave, ref Int16 pCurStatus, ref Int16 pReqStatus, ref Int16 pErrCode);
  826. /// @brief 获取EtherCAT主站信息(包含通讯周期, 从站个数, 资源数量等)
  827. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatMasterInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  828. public static extern UInt32 IMC_GetEcatMasterInfo(Int16 cardIndex, ref TMasterInfo ptMasterInfo);
  829. /// @brief 获取EtherCAT从站信息(包含设备类型, 对应轴号, 从站别名等)
  830. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatSlaveInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  831. public static extern UInt32 IMC_GetEcatSlaveInfo(Int16 cardIndex, Int16 slave, ref TSlaveInfo ptSlaveInfo);
  832. /// @brief 获取从站连接状态
  833. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatSlaveOpSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  834. public static extern UInt32 IMC_GetEcatSlaveOpSts(Int16 cardIndex, ref UInt16 pSts, UInt32[] pMask);
  835. #endregion
  836. ///@defgroup EcatPDO EcatPDO
  837. ///@brief 板卡ECAT主站PDO功能
  838. #region EcatPDO
  839. /// @brief 根据站号读取EtherCAT从站的PDO数据
  840. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatSlavePdoData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  841. public static extern UInt32 IMC_GetEcatSlavePdoData(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData);
  842. /// @brief 根据站号写入EtherCAT从站的PDO数据, 仅支持非轴从站, 非DIO, AIO, RegInOut类型Pdo
  843. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatSlavePdoData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  844. public static extern UInt32 IMC_SetEcatSlavePdoData(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData);
  845. /// @brief 根据轴号获取EtherCAT从站的PDO数据
  846. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxPdoData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  847. public static extern UInt32 IMC_GetEcatAxPdoData(Int16 cardIndex, Int16 axNo, UInt16 index, Byte[] pData);
  848. /// @brief 根据轴号写入EtherCAT从站的PDO数据
  849. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxPdoData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  850. public static extern UInt32 IMC_SetEcatAxPdoData(Int16 cardIndex, Int16 axNo, UInt16 index, Byte[] pData);
  851. /// @brief 根据索引和子索引读取从站的PdoEntry结构体信息
  852. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatSlavePdoEntry", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  853. public static extern UInt32 IMC_GetEcatSlavePdoEntry(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, ref TPdoEntry ptPdoEntry);
  854. #endregion
  855. ///@defgroup EcatSDO EcatSDO
  856. ///@brief 板卡ECAT主站SDO功能
  857. #region EcatSDO
  858. /// @brief 根据站号获取EtherCAT从站的SDO数据
  859. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatSlaveSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  860. public static extern UInt32 IMC_GetEcatSlaveSdo(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pResultSize, ref UInt32 pAbortCode);
  861. /// @brief 根据站号写入EtherCAT从站的SDO数据
  862. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatSlaveSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  863. public static extern UInt32 IMC_SetEcatSlaveSdo(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pAbortCode);
  864. /// @brief 根据轴号获取EtherCAT从站的SDO数据
  865. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  866. public static extern UInt32 IMC_GetEcatAxSdo(Int16 cardIndex, Int16 axNo, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pResultSize, ref UInt32 pAbortCode);
  867. /// @brief 根据轴号写入EtherCAT从站的SDO数据
  868. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  869. public static extern UInt32 IMC_SetEcatAxSdo(Int16 cardIndex, Int16 axNo, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pAbortCode);
  870. #endregion
  871. ///@defgroup EcatAxisMap EcatAxisMap
  872. ///@brief 板卡ECAT主站轴映射功能
  873. #region EcatAxisMap
  874. /// @brief 根据轴号获取轴所在从站的站号以及Slot号
  875. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxStation", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  876. public static extern UInt32 IMC_GetEcatAxStation(Int16 cardIndex, Int16 axNo, ref Int16 pSlave, ref Int16 pSlotIndex);
  877. /// @brief 根据从站号以及Slot号获取对应的轴通道号
  878. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatSlaveAxChn", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  879. public static extern UInt32 IMC_GetEcatSlaveAxChn(Int16 cardIndex, Int16 slave, Int16 slotIndex, ref Int16 pAxChn);
  880. #endregion
  881. ///@defgroup EcatAlias EcatAlias
  882. ///@brief 板卡ECAT从站别名功能
  883. #region EcatAlias
  884. /// @brief 根据从站别名获取从站的SDO数据
  885. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAliasSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  886. public static extern UInt32 IMC_GetEcatAliasSdo(Int16 cardIndex, UInt32 aliasNo, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pResultSize, ref UInt32 pAbortCode);
  887. /// @brief 根据从站别名设定从站的SDO数据
  888. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAliasSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  889. public static extern UInt32 IMC_SetEcatAliasSdo(Int16 cardIndex, UInt32 aliasNo, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pAbortCode);
  890. /// @brief 设置EtherCAT的DO输出状态保持, 断线后复位总线保持上一次状态
  891. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatDoStsHold", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  892. public static extern UInt32 IMC_SetEcatDoStsHold(Int16 cardIndex, Int16 isHold);
  893. #endregion
  894. /// @brief 获取EtherCAT的DI输入状态, 按16bits为一组进行获取
  895. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatDi", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  896. public static extern UInt32 IMC_GetEcatDi(Int16 cardIndex, Int16 packIndex, UInt16[] pValue, Int16 packCnt);
  897. /// @brief 设置EtherCAT的DO输出状态, 按16bits为一组进行设置
  898. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  899. public static extern UInt32 IMC_SetEcatDo(Int16 cardIndex, Int16 packIndex, UInt16[] pValue, Int16 packCnt);
  900. /// @brief 获取EtherCAT的DO输出状态, 按16bits为一组进行获取
  901. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  902. public static extern UInt32 IMC_GetEcatDo(Int16 cardIndex, Int16 packIndex, UInt16[] pValue, Int16 packCnt);
  903. /// @brief 获取EtherCAT的DI输入状态, 按位进行获取
  904. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatDiBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  905. public static extern UInt32 IMC_GetEcatDiBit(Int16 cardIndex, Int16 diIndex, ref Int16 pValue);
  906. /// @brief 获取EtherCAT的DO输出状态, 按位进行获取
  907. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatDoBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  908. public static extern UInt32 IMC_GetEcatDoBit(Int16 cardIndex, Int16 doIndex, ref Int16 pValue);
  909. /// @brief 设置EtherCAT的DO输出状态, 按位进行设置
  910. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatDoBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  911. public static extern UInt32 IMC_SetEcatDoBit(Int16 cardIndex, Int16 doIndex, Int16 value);
  912. /// @brief 设置EtherCAT的DO输出状态以及生效延时, 按位进行设置
  913. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatDoBitInverse", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  914. public static extern UInt32 IMC_SetEcatDoBitInverse(Int16 cardIndex, Int16 doIndex, Int16 value, Int16 inverseTime);
  915. #endregion
  916. ///@defgroup EcatAD EcatAD
  917. ///@brief 板卡ECAT主站AD/DA/Reg32寄存器功能
  918. #region EcatAD
  919. /// @brief 根据通道号获取EtherCAT对应通道的AD值
  920. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAdVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  921. public static extern UInt32 IMC_GetEcatAdVal(Int16 cardIndex, Int16 adIndex, ref Int16 pValue);
  922. /// @brief 根据通道号设置EtherCAT对应通道的DA值
  923. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatDaVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  924. public static extern UInt32 IMC_SetEcatDaVal(Int16 cardIndex, Int16 daIndex, Int16 Value);
  925. /// @brief 根据通道号获取EtherCAT对应通道的DA值
  926. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatDaVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  927. public static extern UInt32 IMC_GetEcatDaVal(Int16 cardIndex, Int16 daIndex, ref Int16 pValue);
  928. /// @brief 根据通道号获取EtherCAT对应通道的RegIn值
  929. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatRegInVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  930. public static extern UInt32 IMC_GetEcatRegInVal(Int16 cardIndex, Int16 regIndex, ref float pValue);
  931. /// @brief 根据通道号设置EtherCAT对应通道的RegOut值
  932. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatRegOutVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  933. public static extern UInt32 IMC_SetEcatRegOutVal(Int16 cardIndex, Int16 regIndex, float Value);
  934. /// @brief 根据通道号获取EtherCAT对应通道的RegOut值
  935. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatRegOutVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  936. public static extern UInt32 IMC_GetEcatRegOutVal(Int16 cardIndex, Int16 regIndex, ref float pValue);
  937. /// @brief 根据通道号获取EtherCAT对应通道的AD值
  938. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAd", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  939. public static extern UInt32 IMC_GetEcatAd(Int16 cardIndex, Int16 adIndex, Int16[] pValueArray, Int16 count);
  940. /// @brief 根据通道号设置EtherCAT对应通道的DA值
  941. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatDa", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  942. public static extern UInt32 IMC_SetEcatDa(Int16 cardIndex, Int16 daIndex, Int16[] pValueArray, Int16 count);
  943. /// @brief 根据通道号获取EtherCAT对应通道的DA值
  944. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatDa", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  945. public static extern UInt32 IMC_GetEcatDa(Int16 cardIndex, Int16 daIndex, Int16[] pValueArray, Int16 count);
  946. /// @brief 根据通道号获取EtherCAT对应通道的RegIn值
  947. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatRegIn", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  948. public static extern UInt32 IMC_GetEcatRegIn(Int16 cardIndex, Int16 regIndex, float[] pValueArray, Int16 count);
  949. /// @brief 根据通道号设置EtherCAT对应通道的RegOut值
  950. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatRegOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  951. public static extern UInt32 IMC_SetEcatRegOut(Int16 cardIndex, Int16 regIndex, float[] pValueArray, Int16 count);
  952. /// @brief 根据通道号获取EtherCAT对应通道的RegOut值
  953. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatRegOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  954. public static extern UInt32 IMC_GetEcatRegOut(Int16 cardIndex, Int16 regIndex, float[] pValueArray, Int16 count);
  955. #endregion
  956. ///@defgroup EcatEnc EcatEnc
  957. ///@brief 板卡ECAT主站Enc资源操作
  958. #region EcatEnc
  959. /// @brief 设置Ecat编码器计数方向
  960. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatEncDir", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  961. public static extern UInt32 IMC_SetEcatEncDir(Int16 cardIndex, Int16 encIndex, Int16[] pDirArray, Int16 count = 1);
  962. /// @brief 读取Ecat编码器计数方向
  963. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatEncDir", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  964. public static extern UInt32 IMC_GetEcatEncDir(Int16 cardIndex, Int16 encIndex, Int16[] pDirArray, Int16 count = 1);
  965. /// @brief 设置Ecat编码器值
  966. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatEncPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  967. public static extern UInt32 IMC_SetEcatEncPos(Int16 cardIndex, Int16 encIndex, Int32[] pEncPosArray, Int16 count = 1);
  968. /// @brief 读取Ecat编码器值
  969. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatEncPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  970. public static extern UInt32 IMC_GetEcatEncPos(Int16 cardIndex, Int16 encIndex, Int32[] pEncPosArray, Int16 count = 1);
  971. /// @brief 读取Ecat编码器原始值(PDO原始编码数据)
  972. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatEncPosRaw", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  973. public static extern UInt32 IMC_GetEcatEncPosRaw(Int16 cardIndex, Int16 encIndex, Int32[] pEncPosArray, Int16 count = 1);
  974. /// @brief 读取Ecat编码器速度
  975. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatEncVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  976. public static extern UInt32 IMC_GetEcatEncVel(Int16 cardIndex, Int16 encIndex, Int32[] pEncVelArray, Int16 count = 1);
  977. #endregion
  978. ///@defgroup EcatAxis EcatAxis
  979. ///@brief 板卡ECAT相关函数
  980. #region EcatAxis
  981. ///@defgroup EcatAxisPDO EcatAxisPDO
  982. ///@brief 板卡ECAT轴PDO功能
  983. #region EcatAxisPDO
  984. /// @brief 设置EtherCAT类型轴控制模式0x6060
  985. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  986. public static extern UInt32 IMC_SetEcatAxMode(Int16 cardIndex, Int16 axNo, Int16 ctrlMode);
  987. /// @brief 读取EtherCAT类型轴控制模式
  988. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  989. public static extern UInt32 IMC_GetEcatAxMode(Int16 cardIndex, Int16 axNo, ref Int16 pCtrlMode);
  990. /// @brief 获取EtherCAT类型轴的对应的数字量输入,pdo必须配置0x60fd
  991. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxDi", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  992. public static extern UInt32 IMC_GetEcatAxDi(Int16 cardIndex, Int16 axNo, ref UInt32 pDiVal);
  993. /// @brief 设置EtherCAT类型轴的对应的数字量输出,pdo必须配置0x60fe:01
  994. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  995. public static extern UInt32 IMC_SetEcatAxDo(Int16 cardIndex, Int16 axNo, UInt32 doVal);
  996. /// @brief 获取EtherCAT类型轴的对应的数字量输输出,pdo必须配置0x60fe:01
  997. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  998. public static extern UInt32 IMC_GetEcatAxDo(Int16 cardIndex, Int16 axNo, ref UInt32 pDoVal);
  999. /// @brief 获取EtherCAT类型轴的对应的错误码,pdo必须配置0x603f
  1000. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxErrCode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1001. public static extern UInt32 IMC_GetEcatAxErrCode(Int16 cardIndex, Int16 axNo, ref UInt16 pErrCode);
  1002. /// @brief 设置EtherCAT类型轴的最大速度限制,pdo必须配置0x607f
  1003. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxMaxVelLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1004. public static extern UInt32 IMC_SetEcatAxMaxVelLmt(Int16 cardIndex, Int16 axNo, UInt32 maxVel);
  1005. /// @brief 获取EtherCAT类型轴的最大速度限制,pdo必须配置0x607f
  1006. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxMaxVelLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1007. public static extern UInt32 IMC_GetEcatAxMaxVelLmt(Int16 cardIndex, Int16 axNo, ref UInt32 pMaxVel);
  1008. /// @brief 设置 EtherCAT 类型轴的对应的正向力矩限制,pdo必须配置0x60e0
  1009. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxPosTorqLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1010. public static extern UInt32 IMC_SetEcatAxPosTorqLmt(Int16 cardIndex, Int16 axNo, UInt16 posTorqLmt);
  1011. /// @brief 获取 EtherCAT 类型轴的对应的正向力矩限制,pdo必须配置0x60e0
  1012. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxPosTorqLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1013. public static extern UInt32 IMC_GetEcatAxPosTorqLmt(Int16 cardIndex, Int16 axNo, ref UInt16 pPosTorqLmt);
  1014. /// @brief 设置 EtherCAT 类型轴的对应的负向力矩限制,pdo必须配置0x60e1
  1015. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxNegTorqLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1016. public static extern UInt32 IMC_SetEcatAxNegTorqLmt(Int16 cardIndex, Int16 axNo, UInt16 negTorqLmt);
  1017. /// @brief 获取 EtherCAT 类型轴的对应的负向力矩限制,pdo必须配置0x60e1
  1018. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxNegTorqLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1019. public static extern UInt32 IMC_GetEcatAxNegTorqLmt(Int16 cardIndex, Int16 axNo, ref UInt16 pNegTorqLmt);
  1020. /// @brief 设置 EtherCAT 类型轴的最大力矩限制,pdo必须配置0x6072
  1021. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxMaxTorqLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1022. public static extern UInt32 IMC_SetEcatAxMaxTorqLmt(Int16 cardIndex, Int16 axNo, UInt16 maxTorqLmt);
  1023. /// @brief 获取 EtherCAT 类型轴的最大力矩限制,pdo必须配置0x6072
  1024. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxMaxTorqLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1025. public static extern UInt32 IMC_GetEcatAxMaxTorqLmt(Int16 cardIndex, Int16 axNo, ref UInt16 pMaxTorqLmt);
  1026. #endregion
  1027. ///@defgroup EcatAxisThreshold EcatAxisThreshold
  1028. ///@brief 板卡ECAT轴急停保持参数配置函数
  1029. #region EcatAxisThreshold
  1030. /// @brief 设置EtherCAT轴使能控制延时时间, 主要用于特殊场合, 使能控制字输出, 驱动器寻相后, 才能给出使能状态字
  1031. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxOnThreshold", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1032. public static extern UInt32 IMC_SetEcatAxOnThreshold(Int16 cardIndex, Int16 axNo, UInt16 waitPeriod);
  1033. /// @brief 获取EtherCAT轴使能控制延时时间
  1034. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxOnThreshold", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1035. public static extern UInt32 IMC_GetEcatAxOnThreshold(Int16 cardIndex, Int16 axNo, ref UInt16 pWaitPeriod);
  1036. #endregion
  1037. ///@defgroup EcatAxisCSV EcatAxisCSV
  1038. ///@brief 板卡ECAT轴CSV模式功能
  1039. #region EcatAxisCSV
  1040. /// @brief 启动 CSV 速度规划
  1041. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartEcatAxCsvPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1042. public static extern UInt32 IMC_StartEcatAxCsvPrf(Int16 cardIndex, Int16 axNo, Int32 tgtVel, Int32 acc, Int16 prfType);
  1043. /// @brief 更新 CSV 速度规划的目标速度
  1044. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdateEcatAxCsvPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1045. public static extern UInt32 IMC_UpdateEcatAxCsvPrf(Int16 cardIndex, Int16 axNo, Int32 tgtVel);
  1046. /// @brief 获取 CSV 速度规划的状态
  1047. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxCsvPrfSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1048. public static extern UInt32 IMC_GetEcatAxCsvPrfSts(Int16 cardIndex, Int16 axNo, ref Int16 pStatus);
  1049. #endregion
  1050. ///@defgroup EcatAxisCST EcatAxisCST
  1051. ///@brief 板卡ECAT轴CST模式功能
  1052. #region EcatAxisCST
  1053. /// @brief 启动 CST 线性转矩规划
  1054. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartEcatAxTorqPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1055. public static extern UInt32 IMC_StartEcatAxTorqPrf(Int16 cardIndex, Int16 axNo, Int16 tgtTorq, Int16 time);
  1056. /// @brief 获取 EtherCAT 类型轴的实际转矩, 根据count值可一次获取多个轴的扭矩
  1057. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxActTorq", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1058. public static extern UInt32 IMC_GetEcatAxActTorq(Int16 cardIndex, Int16 axNo, Int16[] pActTorqArray, Int16 count = 1);
  1059. /// @brief 设置 EtherCAT 类型轴的对应的转矩斜坡值
  1060. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxTorqSlope", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1061. public static extern UInt32 IMC_SetEcatAxTorqSlope(Int16 cardIndex, Int16 axNo, UInt32 torqSlope);
  1062. /// @brief 获取 EtherCAT 类型轴的对应的转矩斜坡值
  1063. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxTorqSlope", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1064. public static extern UInt32 IMC_GetEcatAxTorqSlope(Int16 cardIndex, Int16 axNo, ref UInt32 pTorqSlope);
  1065. /// @brief 设置 EtherCAT 类型轴的对应的目标转矩
  1066. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxTgtTorq", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1067. public static extern UInt32 IMC_SetEcatAxTgtTorq(Int16 cardIndex, Int16 axNo, Int16 tgtTorq);
  1068. /// @brief 获取 EtherCAT 类型轴的对应的目标转矩
  1069. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxTgtTorq", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1070. public static extern UInt32 IMC_GetEcatAxTgtTorq(Int16 cardIndex, Int16 axNo, ref Int16 pTgtTorq);
  1071. #endregion
  1072. ///@defgroup EcatAxisCapt EcatAxisCapt
  1073. ///@brief 板卡ECAT轴捕获功能功能
  1074. #region EcatAxisCapt
  1075. /// @brief 设置 EtherCAT 类型轴的位置捕获类型
  1076. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxCapt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1077. public static extern UInt32 IMC_SetEcatAxCapt(Int16 cardIndex, Int16 axNo, Int16 trigType, Int16 edge);
  1078. /// @brief 获取 EtherCAT 类型轴的位置捕获类型
  1079. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxCapt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1080. public static extern UInt32 IMC_GetEcatAxCapt(Int16 cardIndex, Int16 axNo, ref Int16 pTrigType, ref Int16 pEdge);
  1081. /// @brief 获取 EtherCAT 类型轴的位置捕获状态
  1082. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxCaptStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1083. public static extern UInt32 IMC_GetEcatAxCaptStatus(Int16 cardIndex, Int16 axNo, ref Int16 pSts, ref Int32 pPosVal, ref Int32 pNegVal);
  1084. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxProbeFun", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1085. public static extern UInt32 IMC_SetEcatAxProbeFun(Int16 cardIndex, Int16 axNo, Int16 probeFun);
  1086. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxProbeFun", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1087. public static extern UInt32 IMC_GetEcatAxProbeFun(Int16 cardIndex, Int16 axNo, ref Int16 pProbeFun);
  1088. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxProbeSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1089. public static extern UInt32 IMC_GetEcatAxProbeSts(Int16 cardIndex, Int16 axNo, ref Int16 pProbeSts, ref Int32 pProbe1Pos, ref Int32 pProbe1Neg, ref Int32 pProbe2Pos, ref Int32 pProbe2Neg);
  1090. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxProbeContinousCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1091. public static extern UInt32 IMC_SetEcatAxProbeContinousCount(Int16 cardIndex, Int16 axNo, Int16[] pCountArray);
  1092. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxProbeContinousCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1093. public static extern UInt32 IMC_GetEcatAxProbeContinousCount(Int16 cardIndex, Int16 axNo, Int16[] pCountArray, Int16[] pTrigArray, Int16[] pRestArray);
  1094. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxProbeContinousData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1095. public static extern UInt32 IMC_GetEcatAxProbeContinousData(Int16 cardIndex, Int16 axNo, Int16 probeType, Int32[] pPosArray, Int16 count);
  1096. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxProbeContinousTable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1097. public static extern UInt32 IMC_SetEcatAxProbeContinousTable(Int16 cardIndex, Int16 axNo, Int16 tableIndex);
  1098. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxProbeContinousTable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1099. public static extern UInt32 IMC_GetEcatAxProbeContinousTable(Int16 cardIndex, Int16 axNo, ref Int16 pTableIndex);
  1100. /// @brief 清除 EtherCAT 类型轴的连续位置捕获状态
  1101. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ClrEcatAxCaptStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1102. public static extern UInt32 IMC_ClrEcatAxCaptStatus(Int16 cardIndex, Int16 axNo);
  1103. #endregion
  1104. #endregion
  1105. ///@defgroup HEcatFunc HEcatFunc
  1106. ///@brief H主站函数
  1107. #region HEcatFunc
  1108. ///@defgroup H-MasterCfg H-MasterCfg
  1109. ///@brief H主站系统配置函数
  1110. #region H
  1111. /// @brief 获取板卡的CPU负载
  1112. /// @warning 建议负载率不要超过60%
  1113. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetCalcLoadRatio", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1114. public static extern UInt32 IMC_H_GetCalcLoadRatio(Int16 cardIndex, ref double pLoadRatio);
  1115. /// @brief 复位控制卡系统参数
  1116. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_ResetSysPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1117. public static extern UInt32 IMC_H_ResetSysPara(Int16 cardIndex);
  1118. #endregion
  1119. ///@defgroup H-EtherCAT H-EtherCAT
  1120. ///@brief 板卡H主站功能
  1121. #region H
  1122. /// @brief 初始化板卡通讯, 主站进入OP状态
  1123. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_InitEcatComm", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1124. public static extern UInt32 IMC_H_InitEcatComm(Int16 cardIndex);
  1125. /// @brief 开启板卡通讯, 初始化EtherCAT总线资源, 建立主站与各从站之间的通讯
  1126. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_StartEcatComm", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1127. public static extern UInt32 IMC_H_StartEcatComm(Int16 cardIndex);
  1128. /// @brief 关闭板卡通讯, 主站退出OP状态
  1129. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_DelEcatComm", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1130. public static extern UInt32 IMC_H_DelEcatComm(Int16 cardIndex);
  1131. /// @brief 初始化总线, 直到主站进入OP状态, 随后扫描EtherCAT总线资源, 并建立主站与各从站之间的通讯 (该函数会阻塞在EtherCAT的总线扫描同步阶段)
  1132. /// @warning 该指令阻塞执行
  1133. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_ScanCardEcat", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1134. public static extern UInt32 IMC_H_ScanCardEcat(Int16 cardIndex, Int16 waitTime = 40);
  1135. /// @brief 获取EtherCAT主站的状态
  1136. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatMasterSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1137. public static extern UInt32 IMC_H_GetEcatMasterSts(Int16 cardIndex, ref UInt32 pStatus);
  1138. /// @brief 获取EtherCAT协议栈通讯错误码
  1139. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatErrCode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1140. public static extern UInt32 IMC_H_GetEcatErrCode(Int16 cardIndex, ref UInt32 pErrCode);
  1141. /// @brief 获取EtherCAT主站的状态,Ex指令
  1142. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatMasterStsEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1143. public static extern UInt32 IMC_H_GetEcatMasterStsEx(Int16 cardIndex, ref UInt32 pStatus);
  1144. /// @brief 获取EtherCAT协议栈通讯错误码,Ex指令
  1145. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatErrCodeEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1146. public static extern UInt32 IMC_H_GetEcatErrCodeEx(Int16 cardIndex, ref UInt32 pErrCode);
  1147. /// @brief 获取EtherCAT从站当前通讯阶段, INIT, PerOP, SafeOP, OP
  1148. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatSlaveSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1149. public static extern UInt32 IMC_H_GetEcatSlaveSts(Int16 cardIndex, Int16 slave, ref Int16 pCurStatus, ref Int16 pReqStatus, ref Int16 pErrCode);
  1150. /// @brief 获取EtherCAT主站信息(包含通讯周期, 从站个数, 资源数量等)
  1151. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatMasterInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1152. public static extern UInt32 IMC_H_GetEcatMasterInfo(Int16 cardIndex, ref TMasterInfo ptMasterInfo);
  1153. /// @brief 获取EtherCAT从站信息(包含设备类型, 对应轴号, 从站别名等)
  1154. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatSlaveInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1155. public static extern UInt32 IMC_H_GetEcatSlaveInfo(Int16 cardIndex, Int16 slave, ref TSlaveInfo ptSlaveInfo);
  1156. /// @brief 根据站号读取EtherCAT从站的PDO数据
  1157. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatSlavePdoData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1158. public static extern UInt32 IMC_H_GetEcatSlavePdoData(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData);
  1159. /// @brief 根据站号写入EtherCAT从站的PDO数据
  1160. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatSlavePdoData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1161. public static extern UInt32 IMC_H_SetEcatSlavePdoData(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData);
  1162. /// @brief 根据站号获取EtherCAT从站的SDO数据
  1163. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatSlaveSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1164. public static extern UInt32 IMC_H_GetEcatSlaveSdo(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pResultSize, ref UInt32 pAbortCode);
  1165. /// @brief 根据站号写入EtherCAT从站的SDO数据
  1166. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatSlaveSdo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1167. public static extern UInt32 IMC_H_SetEcatSlaveSdo(Int16 cardIndex, Int16 slave, UInt16 index, UInt16 subIndex, Byte[] pData, UInt32 dataSize, ref UInt32 pAbortCode);
  1168. /// @brief 获取EtherCAT的DI输入状态, 按16bits为一组进行获取
  1169. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatDi", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1170. public static extern UInt32 IMC_H_GetEcatDi(Int16 cardIndex, Int16 packIndex, UInt16[] pValue, Int16 packCnt);
  1171. /// @brief 设置EtherCAT的DO输出状态, 按16bits为一组进行设置
  1172. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1173. public static extern UInt32 IMC_H_SetEcatDo(Int16 cardIndex, Int16 packIndex, UInt16[] pValue, Int16 packCnt);
  1174. /// @brief 获取EtherCAT的DO输出状态, 按16bits为一组进行获取
  1175. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1176. public static extern UInt32 IMC_H_GetEcatDo(Int16 cardIndex, Int16 packIndex, UInt16[] pValue, Int16 packCnt);
  1177. /// @brief 获取EtherCAT的DI输入状态, 按位进行获取
  1178. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatDiBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1179. public static extern UInt32 IMC_H_GetEcatDiBit(Int16 cardIndex, Int16 diIndex, ref Int16 pValue);
  1180. /// @brief 获取EtherCAT的DO输出状态, 按位进行获取
  1181. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatDoBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1182. public static extern UInt32 IMC_H_GetEcatDoBit(Int16 cardIndex, Int16 doIndex, ref Int16 pValue);
  1183. /// @brief 设置EtherCAT的DO输出状态, 按位进行设置
  1184. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatDoBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1185. public static extern UInt32 IMC_H_SetEcatDoBit(Int16 cardIndex, Int16 doIndex, Int16 value);
  1186. /// @brief 根据通道号获取EtherCAT对应通道的AD值
  1187. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatAdVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1188. public static extern UInt32 IMC_H_GetEcatAdVal(Int16 cardIndex, Int16 adIndex, ref Int16 pValue);
  1189. /// @brief 根据通道号设置EtherCAT对应通道的DA值
  1190. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatDaVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1191. public static extern UInt32 IMC_H_SetEcatDaVal(Int16 cardIndex, Int16 daIndex, Int16 Value);
  1192. /// @brief 根据通道号获取EtherCAT对应通道的DA值
  1193. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatDaVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1194. public static extern UInt32 IMC_H_GetEcatDaVal(Int16 cardIndex, Int16 daIndex, ref Int16 pValue);
  1195. /// @brief 根据通道号获取EtherCAT对应通道的RegIn值
  1196. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatRegInVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1197. public static extern UInt32 IMC_H_GetEcatRegInVal(Int16 cardIndex, Int16 regIndex, ref float pValue);
  1198. /// @brief 根据通道号设置EtherCAT对应通道的RegOut值
  1199. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatRegOutVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1200. public static extern UInt32 IMC_H_SetEcatRegOutVal(Int16 cardIndex, Int16 regIndex, float Value);
  1201. /// @brief 根据通道号获取EtherCAT对应通道的RegOut值
  1202. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatRegOutVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1203. public static extern UInt32 IMC_H_GetEcatRegOutVal(Int16 cardIndex, Int16 regIndex, ref float pValue);
  1204. /// @brief 根据通道号获取EtherCAT对应通道的AD值
  1205. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatAd", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1206. public static extern UInt32 IMC_H_GetEcatAd(Int16 cardIndex, Int16 adIndex, Int16[] pValueArray, Int16 count);
  1207. /// @brief 根据通道号设置EtherCAT对应通道的DA值
  1208. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatDa", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1209. public static extern UInt32 IMC_H_SetEcatDa(Int16 cardIndex, Int16 daIndex, Int16[] pValueArray, Int16 count);
  1210. /// @brief 根据通道号获取EtherCAT对应通道的DA值
  1211. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatDa", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1212. public static extern UInt32 IMC_H_GetEcatDa(Int16 cardIndex, Int16 daIndex, Int16[] pValueArray, Int16 count);
  1213. /// @brief 根据通道号获取EtherCAT对应通道的RegIn值
  1214. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatRegIn", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1215. public static extern UInt32 IMC_H_GetEcatRegIn(Int16 cardIndex, Int16 regIndex, float[] pValueArray, Int16 count);
  1216. /// @brief 根据通道号设置EtherCAT对应通道的RegOut值
  1217. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_SetEcatRegOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1218. public static extern UInt32 IMC_H_SetEcatRegOut(Int16 cardIndex, Int16 regIndex, float[] pValueArray, Int16 count);
  1219. /// @brief 根据通道号获取EtherCAT对应通道的RegOut值
  1220. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_H_GetEcatRegOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1221. public static extern UInt32 IMC_H_GetEcatRegOut(Int16 cardIndex, Int16 regIndex, float[] pValueArray, Int16 count);
  1222. #endregion
  1223. #endregion
  1224. ///@defgroup LocalBus LocalBus
  1225. ///@brief 板卡端子板功能
  1226. #region LocalBus
  1227. ///@defgroup LocalInfo LocalInfo
  1228. ///@brief 板卡端子板信息获取
  1229. #region LocalInfo
  1230. /// @brief 获取端子板的工作状态
  1231. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalBoardWorkSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1232. public static extern UInt32 IMC_GetLocalBoardWorkSts(Int16 cardIndex, ref Int16 pValue);
  1233. #endregion
  1234. ///@defgroup LocalParam LocalParam
  1235. ///@brief 板卡端子板参数设置
  1236. #region LocalParam
  1237. /// @brief 设置端子板 DI 滤波时间
  1238. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalDiFilterTime", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1239. public static extern UInt32 IMC_SetLocalDiFilterTime(Int16 cardIndex, UInt16 filterTime);
  1240. /// @brief 读取端子板 DI 滤波时间
  1241. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalDiFilterTime", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1242. public static extern UInt32 IMC_GetLocalDiFilterTime(Int16 cardIndex, ref UInt16 pFilterTime);
  1243. /// @brief 设置端子板编码器滤波参数
  1244. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalEncFilterPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1245. public static extern UInt32 IMC_SetLocalEncFilterPara(Int16 cardIndex, Int16 filterDepth, Int16 filterCoef);
  1246. /// @brief 读取端子板编码器滤波参数
  1247. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalEncFilterPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1248. public static extern UInt32 IMC_GetLocalEncFilterPara(Int16 cardIndex, ref Int16 pFilterDepth, ref Int16 pFilterCoef);
  1249. /// @brief 设置端子板编码器计数方向
  1250. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalEncDir", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1251. public static extern UInt32 IMC_SetLocalEncDir(Int16 cardIndex, Int16 encIndex, Int16[] pDirArray, Int16 count = 1);
  1252. /// @brief 读取端子板编码器计数方向
  1253. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalEncDir", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1254. public static extern UInt32 IMC_GetLocalEncDir(Int16 cardIndex, Int16 encIndex, Int16[] pDirArray, Int16 count = 1);
  1255. #endregion
  1256. ///@defgroup LocalDIO LocalDIO
  1257. ///@brief 板卡端子板IO操作
  1258. #region LocalDIO
  1259. /// @brief 获取本地 DI 值
  1260. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalDi", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1261. public static extern UInt32 IMC_GetLocalDi(Int16 cardIndex, ref Int16 pValue);
  1262. /// @brief 设置本地 DO 值
  1263. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1264. public static extern UInt32 IMC_SetLocalDo(Int16 cardIndex, Int16 value);
  1265. /// @brief 读取本地 DO 值
  1266. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1267. public static extern UInt32 IMC_GetLocalDo(Int16 cardIndex, ref Int16 pValue);
  1268. #endregion
  1269. /// @brief 按位获取本地第 diIndex 个 DI 值
  1270. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalDiBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1271. public static extern UInt32 IMC_GetLocalDiBit(Int16 cardIndex, Int16 diIndex, ref Int16 pValue);
  1272. /// @brief 按位设置本地第 doIndex 个 DO 值
  1273. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalDoBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1274. public static extern UInt32 IMC_SetLocalDoBit(Int16 cardIndex, Int16 doIndex, Int16 value);
  1275. /// @brief 按位设置本地第 doIndex 个 DO 值
  1276. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalDoBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1277. public static extern UInt32 IMC_GetLocalDoBit(Int16 cardIndex, Int16 doIndex, ref Int16 pValue);
  1278. /// @brief 按位脉冲输出本地第 doIndex 个 DO
  1279. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalDoBitPulse", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1280. public static extern UInt32 IMC_SetLocalDoBitPulse(Int16 cardIndex, Int16 doIndex, Int16 enable, UInt16 highLevelTime, UInt16 lowLevelTime, Int16 pulseNum, Int16 firstLevel);
  1281. ///@defgroup LocalEnc LocalEnc
  1282. ///@brief 板卡端子板编码器操作
  1283. #region LocalEnc
  1284. /// @brief 设置编码器值
  1285. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalEncPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1286. public static extern UInt32 IMC_SetLocalEncPos(Int16 cardIndex, Int16 encIndex, Int32 encPos);
  1287. /// @brief 读取编码器值
  1288. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalEncPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1289. public static extern UInt32 IMC_GetLocalEncPos(Int16 cardIndex, Int16 encIndex, Int32[] pEncPosArray, Int16 count = 1);
  1290. /// @brief 读取编码器速度
  1291. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalEncVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1292. public static extern UInt32 IMC_GetLocalEncVel(Int16 cardIndex, Int16 encIndex, Int32[] pEncVelArray, Int16 count = 1);
  1293. #endregion
  1294. ///@defgroup LocalCapt LocalCapt
  1295. ///@brief 板卡端子板捕获功能
  1296. #region LocalCapt
  1297. /// @brief 设置端子板编码器位置捕获模式, 配置捕获参数
  1298. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCaptMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1299. public static extern UInt32 IMC_SetLocalCaptMode(Int16 cardIndex, Int16 encIndex, Int16 trigType, Int16 edge);
  1300. /// @brief 获取端子板编码器位置捕获模式配置参数
  1301. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCaptMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1302. public static extern UInt32 IMC_GetLocalCaptMode(Int16 cardIndex, Int16 encIndex, ref Int16 pTrigType, ref Int16 pEdge);
  1303. /// @brief 获取端子板编码器位置捕获状态
  1304. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCaptStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1305. public static extern UInt32 IMC_GetLocalCaptStatus(Int16 cardIndex, Int16 encIndex, ref Int16 pSts, ref Int32 pPosVal, ref Int32 pNegVal);
  1306. /// @brief 设置端子板编码器连续位置捕获模式, 配置连续捕获参数
  1307. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCaptRepeatMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1308. public static extern UInt32 IMC_SetLocalCaptRepeatMode(Int16 cardIndex, Int16 encIndex, Int16 trigType, Int16 edge, Int16 captCount);
  1309. /// @brief 设置端子板编码器连续位置捕获模式配置参数
  1310. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCaptRepeatMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1311. public static extern UInt32 IMC_GetLocalCaptRepeatMode(Int16 cardIndex, Int16 encIndex, ref Int16 pTrigType, ref Int16 pEdge, ref Int16 pCaptCount);
  1312. /// @brief 获取端子板编码器连续位置捕获状态
  1313. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCaptRepeatStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1314. public static extern UInt32 IMC_GetLocalCaptRepeatStatus(Int16 cardIndex, Int16 encIndex, ref Int16 pCaptSts, ref Int16 pCaptCount);
  1315. /// @brief 获取端子板编码器连续位置捕获位置
  1316. /// @attention 双沿沿捕获时, 开辟存储数组长度应为 IMC_SetLocalCaptRepeatMode 设置 的 captCount 的 2 倍
  1317. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCaptRepeatPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1318. public static extern UInt32 IMC_GetLocalCaptRepeatPos(Int16 cardIndex, Int16 encIndex, Int16 startNo, Int16 count, Int32[] pCaptPosArray);
  1319. #endregion
  1320. ///@defgroup LocalPWM LocalPWM
  1321. ///@brief 板卡端子板PWM功能
  1322. #region LocalPWM
  1323. /// @brief 设置端子板PWM的输出参数
  1324. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalPwmPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1325. public static extern UInt32 IMC_SetLocalPwmPara(Int16 cardIndex, Int16 chn, Int32 frequency, double dutyRatio);
  1326. /// @brief 获取端子板PWM的输出参数
  1327. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalPwmPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1328. public static extern UInt32 IMC_GetLocalPwmPara(Int16 cardIndex, Int16 chn, ref Int32 pFrequency, ref double pDutyRatio);
  1329. /// @brief 设置端子板PWM的输出频率
  1330. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalPwmFrq", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1331. public static extern UInt32 IMC_SetLocalPwmFrq(Int16 cardIndex, Int16 chn, Int32 frequency);
  1332. /// @brief 设置端子板PWM的输出占空比
  1333. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalPwmDuty", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1334. public static extern UInt32 IMC_SetLocalPwmDuty(Int16 cardIndex, Int16 chn, double dutyRatio);
  1335. /// @brief 设置端子板PWM输出的开关及延时时间
  1336. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalPwmOnOffDelay", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1337. public static extern UInt32 IMC_SetLocalPwmOnOffDelay(Int16 cardIndex, Int16 chn, Int16 onOff, UInt16 delay);
  1338. #endregion
  1339. ///@defgroup LocalCompare LocalCompare
  1340. ///@brief 板卡端子板位置比较功能
  1341. #region LocalCompare
  1342. /// @brief 设置端子板位置比较输出源的配置
  1343. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpSrcCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1344. public static extern UInt32 IMC_SetLocalCmpSrcCfg(Int16 cardIndex, Int16 chn, Int16 compSrc);
  1345. /// @brief 设置端子板比较物理信号输出的配置
  1346. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpOutputCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1347. public static extern UInt32 IMC_SetLocalCmpOutputCfg(Int16 cardIndex, Int16 chn, Int16 ctrlMode, Int16 stLevel, Int16 outputType, UInt16 pulseWidth);
  1348. /// @brief 设置端子板比较数据的类型
  1349. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpDataType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1350. public static extern UInt32 IMC_SetLocalCmpDataType(Int16 cardIndex, Int16 chn, Int16 type);
  1351. /// @brief 获取端子板比较数据的类型
  1352. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCmpDataType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1353. public static extern UInt32 IMC_GetLocalCmpDataType(Int16 cardIndex, Int16 chn, ref Int16 pType);
  1354. /// @brief 设置端子板位置比较的位置类型
  1355. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpPosType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1356. public static extern UInt32 IMC_SetLocalCmpPosType(Int16 cardIndex, Int16 chn, Int16 type);
  1357. /// @brief 获取端子板位置比较的位置类型
  1358. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCmpPosType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1359. public static extern UInt32 IMC_GetLocalCmpPosType(Int16 cardIndex, Int16 chn, ref Int16 pType);
  1360. /// @brief 设置本地输出 EX-O bit0 ~ 3 位位置比较输出类型
  1361. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalGpoType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1362. public static extern UInt32 IMC_SetLocalGpoType(Int16 cardIndex, Int16 doIndex, Int16 type);
  1363. /// @brief 获取本地输出 EX-O bit0 ~ 3 位位置比较输出类型配置
  1364. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalGpoType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1365. public static extern UInt32 IMC_GetLocalGpoType(Int16 cardIndex, Int16 doIndex, ref Int16 pType);
  1366. /// @brief 获取端子板位置比较的状态
  1367. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalCmpSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1368. public static extern UInt32 IMC_GetLocalCmpSts(Int16 cardIndex, Int16 chn, ref Int16 pCmpSts, ref Int32 pCmpCount);
  1369. /// @brief 设置端子板手动输出脉冲或电平
  1370. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpManualOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1371. public static extern UInt32 IMC_SetLocalCmpManualOut(Int16 cardIndex, Int16 chn, Int16 outval);
  1372. /// @brief 设置端子板多脉冲手动输出
  1373. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpManualMultiOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1374. public static extern UInt32 IMC_SetLocalCmpManualMultiOut(Int16 cardIndex, Int16 chn, UInt16 pulseNum, UInt16 pulseCycle);
  1375. /// @brief 设置端子板等间距线性比较输出
  1376. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpLinearOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1377. public static extern UInt32 IMC_SetLocalCmpLinearOut(Int16 cardIndex, Int16 chn, Int32 intrvalLen, Int32 cmpCount);
  1378. /// @brief 停止端子板比较输出
  1379. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopLocalCmpOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1380. public static extern UInt32 IMC_StopLocalCmpOut(Int16 cardIndex, Int16 chn);
  1381. /// @brief 启动端子板比较输出
  1382. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartLocalCmpOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1383. public static extern UInt32 IMC_StartLocalCmpOut(Int16 cardIndex, Int16 chn);
  1384. /// @brief 设置端子板一维位置比较输出数据
  1385. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalCmpData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1386. public static extern UInt32 IMC_SetLocalCmpData(Int16 cardIndex, Int16 chn, Int16 compCount, Int32[] pPosBufArray);
  1387. #endregion
  1388. ///@defgroup LocalMultCompare LocalMultCompare
  1389. ///@brief 板卡端子板多维位置比较功能
  1390. #region LocalMultCompare
  1391. /// @brief 设置端子板位置比较输出源的配置
  1392. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalMultiCmpSrcCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1393. public static extern UInt32 IMC_SetLocalMultiCmpSrcCfg(Int16 cardIndex, Int16 chn, Int16 dimension, Int16[] pCompSrcArray);
  1394. /// @brief 设置端子板比较物理信号输出的配置
  1395. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalMultiCmpOutputCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1396. public static extern UInt32 IMC_SetLocalMultiCmpOutputCfg(Int16 cardIndex, Int16 chn, Int16 stLevel, Int16 outputType, UInt16 pulseWidth);
  1397. /// @brief 获取端子板位置比较的状态
  1398. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalMultiCmpSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1399. public static extern UInt32 IMC_GetLocalMultiCmpSts(Int16 cardIndex, Int16 chn, ref Int16 pCmpSts, ref Int32 pCmpCount);
  1400. /// @brief 设置端子板比较数据的类型
  1401. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalMultiCmpDataType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1402. public static extern UInt32 IMC_SetLocalMultiCmpDataType(Int16 cardIndex, Int16 chn, Int16 type);
  1403. /// @brief 获取端子板比较数据的类型
  1404. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalMultiCmpDataType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1405. public static extern UInt32 IMC_GetLocalMultiCmpDataType(Int16 cardIndex, Int16 chn, ref Int16 pType);
  1406. /// @brief 设置端子板多维位置比较参数
  1407. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalMultiCmpPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1408. public static extern UInt32 IMC_SetLocalMultiCmpPara(Int16 cardIndex, Int16 chn, UInt16 syncDeltaPos, Int16 outPinType);
  1409. /// @brief 获取端子板多维位置比较参数
  1410. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalMultiCmpPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1411. public static extern UInt32 IMC_GetLocalMultiCmpPara(Int16 cardIndex, Int16 chn, ref UInt16 pSyncDeltaPos, ref Int16 pOutPinType);
  1412. /// @brief 设置多维比较位置点
  1413. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalMultiCmpData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1414. public static extern UInt32 IMC_SetLocalMultiCmpData(Int16 cardIndex, Int16 chn, TMultiCmpData[] pComparaDataArray, Int16 count);
  1415. /// @brief 启动端子板比较输出
  1416. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartLocalMultiCmpOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1417. public static extern UInt32 IMC_StartLocalMultiCmpOut(Int16 cardIndex, Int16 chn);
  1418. /// @brief 停止端子板比较输出
  1419. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopLocalMultiCmpOut", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1420. public static extern UInt32 IMC_StopLocalMultiCmpOut(Int16 cardIndex, Int16 chn);
  1421. #endregion
  1422. ///@defgroup LocalPSO LocalPSO
  1423. ///@brief 板卡端子板PSO功能
  1424. #region LocalPSO
  1425. /// @brief 设置端子板PSO功能参数
  1426. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalPSOPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1427. public static extern UInt32 IMC_SetLocalPSOPara(Int16 cardIndex, Int16 chn, Int16 dimension, Int16 pinType, Int16[] pPsoPosIndexArray, UInt16 outPlsWidth, Int32 syncDeltaPos);
  1428. /// @brief 获取端子板PSO功能参数配置
  1429. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalPSOPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1430. public static extern UInt32 IMC_GetLocalPSOPara(Int16 cardIndex, Int16 chn, ref Int16 pDimension, ref Int16 pPinType, Int16[] pPsoPosIndexArray, ref UInt16 pOutPlsWidth, ref Int32 pSyncDeltaPos);
  1431. /// @brief 设置PSO基频
  1432. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetLocalPSOBaseFrq", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1433. public static extern UInt32 IMC_SetLocalPSOBaseFrq(Int16 cardIndex, Int16 chn, Int16 baseFrq);
  1434. /// @brief 获取PSO基频
  1435. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalPSOBaseFrq", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1436. public static extern UInt32 IMC_GetLocalPSOBaseFrq(Int16 cardIndex, Int16 chn, ref Int16 pBaseFrq);
  1437. /// @brief 启动PSO输出
  1438. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartLocalPSO", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1439. public static extern UInt32 IMC_StartLocalPSO(Int16 cardIndex, Int16 chn);
  1440. /// @brief 停止PSO输出
  1441. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopLocalPSO", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1442. public static extern UInt32 IMC_StopLocalPSO(Int16 cardIndex, Int16 chn);
  1443. /// @brief 获取PSO输出状态
  1444. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetLocalPSOSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1445. public static extern UInt32 IMC_GetLocalPSOSts(Int16 cardIndex, Int16 chn, ref Int16 pSts, ref UInt16 pPsoCount);
  1446. #endregion
  1447. #endregion
  1448. ///@defgroup Axis Axis
  1449. ///@brief 板卡轴操作相关函数
  1450. #region Axis
  1451. ///@defgroup AxisConfig AxisConfig
  1452. ///@brief 板卡轴配置函数
  1453. #region AxisConfig
  1454. /// @brief 设置轴激活状态
  1455. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxActive", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1456. public static extern UInt32 IMC_SetAxActive(Int16 cardIndex, Int16 axNo, Int16 active);
  1457. /// @brief 读取轴激活状态
  1458. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxActive", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1459. public static extern UInt32 IMC_GetAxActive(Int16 cardIndex, Int16 axNo, ref Int16 pActive);
  1460. /// @brief 设置控制器单轴安全运行参数
  1461. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxMaxMtPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1462. public static extern UInt32 IMC_SetAxMaxMtPara(Int16 cardIndex, Int16 axNo, ref TMtPara pMtPara);
  1463. /// @brief 读取控制器单轴安全运行参数
  1464. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxMaxMtPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1465. public static extern UInt32 IMC_GetAxMaxMtPara(Int16 cardIndex, Int16 axNo, ref TMtPara pMtPara);
  1466. /// @brief 设置轴当量参数
  1467. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxEquiv", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1468. public static extern UInt32 IMC_SetAxEquiv(Int16 cardIndex, Int16 axNo, double[] pAxEquArray, Int16 count = 1);
  1469. /// @brief 获取轴当量参数
  1470. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEquiv", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1471. public static extern UInt32 IMC_GetAxEquiv(Int16 cardIndex, Int16 axNo, double[] pAxEquArray, Int16 count = 1);
  1472. /// @brief 设置轴输出绑定
  1473. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxBondCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1474. public static extern UInt32 IMC_SetAxBondCfg(Int16 cardIndex, Int16 axNo, Int16 axType, Int16 outputChn);
  1475. /// @brief 获取轴输出绑定
  1476. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxBondCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1477. public static extern UInt32 IMC_GetAxBondCfg(Int16 cardIndex, Int16 axNo, ref Int16 pAxType, ref Int16 pOutputChn);
  1478. /// @brief 复位轴绑定状态, 让所有轴恢复到虚轴状态
  1479. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ResetAxBondCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1480. public static extern UInt32 IMC_ResetAxBondCfg(Int16 cardIndex);
  1481. /// @brief 设置轴属性参数, 包含软限位、到位误差、最大跟随误差
  1482. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxAttriPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1483. public static extern UInt32 IMC_SetAxAttriPara(Int16 cardIndex, Int16 axNo, ref TAxAttriPara pAxAttriPara);
  1484. /// @brief 获取轴属性参数, 包含软限位、到位误差、最大跟随误差
  1485. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxAttriPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1486. public static extern UInt32 IMC_GetAxAttriPara(Int16 cardIndex, Int16 axNo, ref TAxAttriPara pAxAttriPara);
  1487. /// @brief 设置轴软限位
  1488. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxSoftLimit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1489. public static extern UInt32 IMC_SetAxSoftLimit(Int16 cardIndex, Int16 axNo, Int32 positive, Int32 negative);
  1490. /// @brief 获取轴软限位
  1491. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxSoftLimit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1492. public static extern UInt32 IMC_GetAxSoftLimit(Int16 cardIndex, Int16 axNo, ref Int32 pPositive, ref Int32 pNegative);
  1493. /// @brief 设置轴到位检查参数
  1494. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxArrivalBand", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1495. public static extern UInt32 IMC_SetAxArrivalBand(Int16 cardIndex, Int16 axNo, Int16 arrivalBand, UInt16 arrivalTime);
  1496. /// @brief 获取轴到位检查参数
  1497. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxArrivalBand", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1498. public static extern UInt32 IMC_GetAxArrivalBand(Int16 cardIndex, Int16 axNo, ref Int16 pArrivalBand, ref UInt16 pArrivalTime);
  1499. /// @brief 设置轴最大跟随误差
  1500. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxErrorPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1501. public static extern UInt32 IMC_SetAxErrorPos(Int16 cardIndex, Int16 axNo, Int32 errorPos);
  1502. /// @brief 获取轴最大跟随误差
  1503. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxErrorPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1504. public static extern UInt32 IMC_GetAxErrorPos(Int16 cardIndex, Int16 axNo, ref Int32 pErrorPos);
  1505. /// @brief 设置轴反向间隙补偿
  1506. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxBacklash", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1507. public static extern UInt32 IMC_SetAxBacklash(Int16 cardIndex, Int16 axNo, Int32 wholeCmpVal, Int32 cmpVel, Int16 cmpDir);
  1508. /// @brief 获取轴反向间隙补偿
  1509. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxBacklash", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1510. public static extern UInt32 IMC_GetAxBacklash(Int16 cardIndex, Int16 axNo, ref Int32 pWholeCmpVal, ref Int32 pCmpVel, ref Int16 pCmpDir);
  1511. /// @brief 设置轴安全检查使能综合配置
  1512. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxSafeCheck", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1513. public static extern UInt32 IMC_SetAxSafeCheck(Int16 cardIndex, Int16 axNo, ref TAxCheckEn pAxCheckEn);
  1514. /// @brief 获取轴安全检查使能综合配置
  1515. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxSafeCheck", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1516. public static extern UInt32 IMC_GetAxSafeCheck(Int16 cardIndex, Int16 axNo, ref TAxCheckEn pAxCheckEn);
  1517. /// @brief 设置轴报警检查使能配置
  1518. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxAlarmCheck", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1519. public static extern UInt32 IMC_SetAxAlarmCheck(Int16 cardIndex, Int16 axNo, Int16 enable, Int16 count = 1);
  1520. /// @brief 设置轴软限位检查使能配置
  1521. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxSoftLmtsCheck", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1522. public static extern UInt32 IMC_SetAxSoftLmtsCheck(Int16 cardIndex, Int16 axNo, Int16 enable, Int16 count = 1);
  1523. /// @brief 设置轴硬限位检查使能配置
  1524. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetHwLmtsCheck", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1525. public static extern UInt32 IMC_SetHwLmtsCheck(Int16 cardIndex, Int16 axNo, Int16 enable, Int16 count = 1);
  1526. /// @brief 设置轴跟随误差位检查使能配置
  1527. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxErrPosCheck", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1528. public static extern UInt32 IMC_SetAxErrPosCheck(Int16 cardIndex, Int16 axNo, Int16 enable, Int16 count = 1);
  1529. /// @brief 设定轴停止的平滑停止减速度和急停减速度
  1530. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxStopDec", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1531. public static extern UInt32 IMC_SetAxStopDec(Int16 cardIndex, Int16 axNo, double decSmoothStop, double decAbruptStop);
  1532. /// @brief 获取轴停止的平滑停止减速度和急停减速度
  1533. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxStopDec", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1534. public static extern UInt32 IMC_GetAxStopDec(Int16 cardIndex, Int16 axNo, ref double pDecSmoothStop, ref double pDecAbruptStop);
  1535. /// @brief 设定轴急停减速限制时间
  1536. /// @details 急停时根据当前速度和设定的急停减速度计算停止时间, 若超过设定的限制时间, 则按照当前限制时间重新计算减速度, 否则按照设定的减速度执行
  1537. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxEmgMaxDecLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1538. public static extern UInt32 IMC_SetAxEmgMaxDecLmt(Int16 cardIndex, Int16 axNo, UInt16 decLmtTime);
  1539. /// @brief 获取轴急停减速限制时间
  1540. /// @details 急停时根据当前速度和设定的急停减速度计算停止时间, 若超过设定的限制时间, 则按照当前限制时间重新计算加速度, 否则按照设定的加速度执行
  1541. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEmgMaxDecLmt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1542. public static extern UInt32 IMC_GetAxEmgMaxDecLmt(Int16 cardIndex, Int16 axNo, ref UInt16 pDecLmtTime);
  1543. /// @brief 设置轴的结束速度
  1544. /// @details 点位运动时,运动规划结束速度可以不为0,注意合理设置结束速度值,运动规划完成后,结束速度直接突跳速度为0,可能引起机台抖动
  1545. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxEndVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1546. public static extern UInt32 IMC_SetAxEndVel(Int16 cardIndex, Int16 axNo, double endVel);
  1547. /// @brief 获取轴的结束速度设定
  1548. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEndVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1549. public static extern UInt32 IMC_GetAxEndVel(Int16 cardIndex, Int16 axNo, ref double pEndVel);
  1550. /// @brief 设置圆形软限位参数
  1551. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ArcZoneLmtSetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1552. public static extern UInt32 IMC_ArcZoneLmtSetParam(Int16 cardIndex, Int16[] pAxNoArray, Int32[] pCenterArray, Int32 radius, Int16 sourceType);
  1553. /// @brief 获取圆形软限位参数
  1554. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ArcZoneLmtGetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1555. public static extern UInt32 IMC_ArcZoneLmtGetParam(Int16 cardIndex, Int16[] pAxNoArray, Int32[] pCenterArray, ref Int32 pRadius, ref Int16 pSourceType);
  1556. /// @brief 使能圆形软限位
  1557. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ArcZoneLmtEnable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1558. public static extern UInt32 IMC_ArcZoneLmtEnable(Int16 cardIndex, Int16 enable);
  1559. /// @brief 设置分段软限位参数
  1560. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SegLmtSetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1561. public static extern UInt32 IMC_SegLmtSetParam(Int16 cardIndex, Int16[] pAxNoArray, Int16 sourceType, Int32[] pPointXArray, Int32[] pPointYArray, Int16 pointCount, Int16 yLmtDir);
  1562. /// @brief 获取分段软限位参数
  1563. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SegLmtGetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1564. public static extern UInt32 IMC_SegLmtGetParam(Int16 cardIndex, Int16[] pAxNoArray, ref Int16 pSourceType, Int32[] pPointXArray, Int32[] pPointYArray, ref Int16 pPointCount, ref Int16 pYLmtDir);
  1565. /// @brief 使能分段软限位
  1566. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SegLmtEnable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1567. public static extern UInt32 IMC_SegLmtEnable(Int16 cardIndex, Int16 enable);
  1568. #endregion
  1569. ///@defgroup AxisStatus AxisStatus
  1570. ///@brief 轴状态监控
  1571. #region AxisStatus
  1572. /// @brief 获取轴规划模式, 该值中包含单轴模式和多轴模式的信息
  1573. /// @todo 是否取消单轴多轴状态分区, 底层需要做修改
  1574. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxPrfMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1575. public static extern UInt32 IMC_GetAxPrfMode(Int16 cardIndex, Int16 axNo, Int16[] pPrfModeArray, Int16 count = 1);
  1576. /// @brief 获取轴状态
  1577. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1578. public static extern UInt32 IMC_GetAxSts(Int16 cardIndex, Int16 axNo, Int32[] pAxStsArray, Int16 count = 1);
  1579. /// @brief 清除轴的错误状态, 当发生报警时, 需要调用该指令进行清除, 但如果实际物理报警还在, 则无法清除
  1580. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ClrAxSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1581. public static extern UInt32 IMC_ClrAxSts(Int16 cardIndex, Int16 axNo, Int16 count = 1);
  1582. /// @brief 获取轴规划位置
  1583. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxPrfPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1584. public static extern UInt32 IMC_GetAxPrfPos(Int16 cardIndex, Int16 axNo, double[] pPrfPosArray, Int16 count = 1);
  1585. /// @brief 获取轴规划速度
  1586. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxPrfVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1587. public static extern UInt32 IMC_GetAxPrfVel(Int16 cardIndex, Int16 axNo, double[] pPrfVelArray, Int16 count = 1);
  1588. /// @brief 获取轴规划加速度
  1589. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxPrfAcc", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1590. public static extern UInt32 IMC_GetAxPrfAcc(Int16 cardIndex, Int16 axNo, double[] pPrfAccArray, Int16 count = 1);
  1591. /// @brief 获取轴编码器反馈位置
  1592. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEncPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1593. public static extern UInt32 IMC_GetAxEncPos(Int16 cardIndex, Int16 axNo, double[] pEncPosArray, Int16 count = 1);
  1594. /// @brief 获取轴编码器反馈速度
  1595. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEncVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1596. public static extern UInt32 IMC_GetAxEncVel(Int16 cardIndex, Int16 axNo, double[] pEncVelArray, Int16 count = 1);
  1597. /// @brief 获取轴编码器反馈加速度
  1598. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEncAcc", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1599. public static extern UInt32 IMC_GetAxEncAcc(Int16 cardIndex, Int16 axNo, double[] pEncAccArray, Int16 count = 1);
  1600. /// @brief 获取指定轴是否均已到位的状态
  1601. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetMultiAxArrivalSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1602. public static extern UInt32 IMC_GetMultiAxArrivalSts(Int16 cardIndex, UInt32 axMask, ref Int16 pSts, Int16 groupNo);
  1603. /// @brief 获取轴反向间隙差值
  1604. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxBacklashCmpVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1605. public static extern UInt32 IMC_GetAxBacklashCmpVal(Int16 cardIndex, Int16 axNo, ref Int32 pCmpVal);
  1606. /// @brief 获取轴规划位置(32位整形指令)
  1607. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxPrfPos32", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1608. public static extern UInt32 IMC_GetAxPrfPos32(Int16 cardIndex, Int16 axNo, Int32[] pPrfPosArray, Int16 count = 1);
  1609. /// @brief 获取轴编码器反馈位置(32位整形指令)
  1610. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEncPos32", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1611. public static extern UInt32 IMC_GetAxEncPos32(Int16 cardIndex, Int16 axNo, Int32[] pEncPosArray, Int16 count = 1);
  1612. /// @brief 获取轴规划位置(脉冲位置指令)
  1613. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPrfPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1614. public static extern UInt32 IMC_GetPrfPos(Int16 cardIndex, Int16 axNo, double[] pPrfPosArray, Int16 count = 1);
  1615. /// @brief 获取轴编码器原点位置
  1616. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxOrgEncPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1617. public static extern UInt32 IMC_GetAxOrgEncPos(Int16 cardIndex, Int16 axNo, Int32[] pOrgEncPosArray, Int16 count = 1);
  1618. /// @brief 获取轴停止原因
  1619. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxStopReason", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1620. public static extern UInt32 IMC_GetAxStopReason(Int16 cardIndex, Int16 axNo, Int16[] pAxStopReason, Int16 count = 1);
  1621. /// @brief 获取轴状态(Ex指令)
  1622. /// @todo 补充ex类型指令描述
  1623. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxStsEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1624. public static extern UInt32 IMC_GetAxStsEx(Int16 cardIndex, Int16 axNo, Int32[] pAxStsArray, Int16 count = 1);
  1625. /// @brief 获取轴规划位置(Ex指令)
  1626. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxPrfPosEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1627. public static extern UInt32 IMC_GetAxPrfPosEx(Int16 cardIndex, Int16 axNo, double[] pPrfPosArray, Int16 count = 1);
  1628. /// @brief 获取轴编码器反馈位置(Ex指令)
  1629. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxEncPosEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1630. public static extern UInt32 IMC_GetAxEncPosEx(Int16 cardIndex, Int16 axNo, double[] pEncPosArray, Int16 count = 1);
  1631. /// @brief 获取 EtherCAT 类型轴的实际转矩, 根据count值可一次获取多个轴的扭矩(Ex类型指令)
  1632. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxActTorqEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1633. public static extern UInt32 IMC_GetAxActTorqEx(Int16 cardIndex, Int16 axNo, Int16[] pActTorqArray, Int16 count = 1);
  1634. #endregion
  1635. ///@defgroup AxisControl AxisControl
  1636. ///@brief 轴功能控制
  1637. #region AxisControl
  1638. /// @brief 使能伺服
  1639. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ServoOn", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1640. public static extern UInt32 IMC_ServoOn(Int16 cardIndex, Int16 axNo, Int16 count = 1);
  1641. /// @brief 关闭伺服
  1642. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ServoOff", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1643. public static extern UInt32 IMC_ServoOff(Int16 cardIndex, Int16 axNo, Int16 count = 1);
  1644. /// @brief 停止单轴轴运动
  1645. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1646. public static extern UInt32 IMC_StopMove(Int16 cardIndex, Int16 axNo, Int16 stopType);
  1647. /// @brief 按位停止单轴轴运动
  1648. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopMoveBits", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1649. public static extern UInt32 IMC_StopMoveBits(Int16 cardIndex, UInt32 axMask, UInt32 stopTypeBits);
  1650. /// @brief 设置轴的触发停止参数
  1651. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxStopTrigPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1652. public static extern UInt32 IMC_SetAxStopTrigPara(Int16 cardIndex, Int16 axNo, Int16 uselessFlag, Int16 bitNo, Int16 stopType, Int16 diType);
  1653. /// @brief 获取轴的触发停止参数
  1654. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxStopTrigPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1655. public static extern UInt32 IMC_GetAxStopTrigPara(Int16 cardIndex, Int16 axNo, ref Int16 pUselessFlag, ref Int16 pBitNo, ref Int16 pStopType, ref Int16 pDiType);
  1656. /// @brief 设置当前轴位置为用户指定位置
  1657. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxCurPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1658. public static extern UInt32 IMC_SetAxCurPos(Int16 cardIndex, Int16 axNo, double setPos);
  1659. /// @brief 同步轴位置, 将轴的规划位置与编码器位置同步
  1660. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SyncAxPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1661. public static extern UInt32 IMC_SyncAxPos(Int16 cardIndex, Int16 axNo);
  1662. #endregion
  1663. #endregion
  1664. ///@defgroup MotionControl MotionControl
  1665. ///@brief 板卡运动模式
  1666. #region MotionControl
  1667. ///@defgroup MotionPara MotionPara
  1668. ///@brief 全局运动参数相关接口
  1669. #region MotionPara
  1670. /// @brief 设置单轴运动参数
  1671. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxMvPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1672. public static extern UInt32 IMC_SetAxMvPara(Int16 cardIndex, Int16 axNo, double vel, double acc, double dec);
  1673. /// @brief 获取单轴运动参数
  1674. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxMvPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1675. public static extern UInt32 IMC_GetAxMvPara(Int16 cardIndex, Int16 axNo, ref double pVel, ref double pAcc, ref double pDec);
  1676. /// @brief 设定单轴速度规划类型
  1677. /// @details ratio 越大, 则 S 越接近 T 型速度规划, 冲击也越大; 反之, ratio 越小, 则规划越平顺, 冲击越小
  1678. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxVelType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1679. public static extern UInt32 IMC_SetAxVelType(Int16 cardIndex, Int16 axNo, Int16 velType, double ratio);
  1680. /// @brief 获取单轴速度规划类型
  1681. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxVelType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1682. public static extern UInt32 IMC_GetAxVelType(Int16 cardIndex, Int16 axNo, ref Int16 pVelType, ref double pRatio);
  1683. #endregion
  1684. ///@defgroup BasicMotion BasicMotion
  1685. ///@brief 基础运动功能
  1686. #region BasicMotion
  1687. ///@defgroup EcatAxisHoming EcatAxisHoming
  1688. ///@brief 板卡ECAT轴402回零功能功能
  1689. #region EcatAxisHoming
  1690. /// @brief 设置EtherCAT类型轴402回零参数
  1691. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatHomingPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1692. public static extern UInt32 IMC_SetEcatHomingPara(Int16 cardIndex, Int16 axNo, Int16 method, UInt32 highVel, UInt32 lowVel, UInt32 acc, Int32 offset);
  1693. /// @brief 将EtherCAT类型轴设置为回零模式
  1694. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatHomingMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1695. public static extern UInt32 IMC_SetEcatHomingMode(Int16 cardIndex, Int16 axNo);
  1696. /// @brief 控制EtherCAT类型轴开始402回零
  1697. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartEcatHoming", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1698. public static extern UInt32 IMC_StartEcatHoming(Int16 cardIndex, Int16 axNo);
  1699. /// @brief 控制EtherCAT类型轴停止402回零
  1700. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopEcatHoming", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1701. public static extern UInt32 IMC_StopEcatHoming(Int16 cardIndex, Int16 axNo);
  1702. /// @brief 控制EtherCAT类型轴退出回零模式
  1703. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ExitEcatHomingMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1704. public static extern UInt32 IMC_ExitEcatHomingMode(Int16 cardIndex, Int16 axNo);
  1705. /// @brief 获取EtherCAT类型轴的402回零状态
  1706. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetHomingStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1707. public static extern UInt32 IMC_GetHomingStatus(Int16 cardIndex, Int16 axNo, ref Int16 pStatus);
  1708. /// @brief EtherCAT类型轴402回零合成函数, 包含设定回零参数, 切回零模式以及启动回零运动
  1709. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartHoming", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1710. public static extern UInt32 IMC_StartHoming(Int16 cardIndex, Int16 axNo, ref THomingPara pHomingPara);
  1711. /// @brief 完成402回零动作合成函数, 包含停止回零, 退出ecat回零模式, 暂默认切到CSP模式
  1712. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_FinishHoming", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1713. public static extern UInt32 IMC_FinishHoming(Int16 cardIndex, Int16 axNo);
  1714. #endregion
  1715. ///@defgroup EcatCSPHoming EcatCSPHoming
  1716. ///@brief 板卡ECAT轴CSP模式规划回零功能功能
  1717. #region EcatCSPHoming
  1718. /// @brief 设置 CSP 模式下回原点中 DI 触发对应 0x60FD(digitalInput)中的 bit 位置
  1719. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEcatAxProbeMaskBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1720. public static extern UInt32 IMC_SetEcatAxProbeMaskBit(Int16 cardIndex, Int16 axNo, Int16 prbDiBitNo);
  1721. /// @brief 获取 CSP 模式下回原点中 DI 触发对应 0x60FD(digitalInput)中的 bit 位置
  1722. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxProbeMaskBit", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1723. public static extern UInt32 IMC_GetEcatAxProbeMaskBit(Int16 cardIndex, Int16 axNo, ref Int16 pPrbDiBitNo);
  1724. /// @brief 开始EtherCAT类型轴CSP模式规划回零
  1725. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartEcatAxCSPHoming", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1726. public static extern UInt32 IMC_StartEcatAxCSPHoming(Int16 cardIndex, Int16 axNo, Int16 method, Int16 dir, Int16 level, double hVel, double lVel, double acc, double offset);
  1727. /// @brief 停止EtherCAT类型轴CSP模式规划回零
  1728. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopEcatAxCSPHoming", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1729. public static extern UInt32 IMC_StopEcatAxCSPHoming(Int16 cardIndex, Int16 axNo, Int16 stopMode);
  1730. /// @brief 获取EtherCAT类型轴CSP模式规划回零状态
  1731. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEcatAxCSPHomingSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1732. public static extern UInt32 IMC_GetEcatAxCSPHomingSts(Int16 cardIndex, Int16 axNo, ref Int16 pHomingMethod, ref Int16 pHomingState);
  1733. /// @brief 完成EtherCAT类型轴CSP模式规划回零
  1734. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_FinishEcatAxCSPHoming", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1735. public static extern UInt32 IMC_FinishEcatAxCSPHoming(Int16 cardIndex, Int16 axNo);
  1736. #endregion
  1737. ///@defgroup PTP PTP
  1738. ///@brief PTP运动模式相关接口
  1739. #region PTP
  1740. /// @brief 启动单轴PTP运动
  1741. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartPtpMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1742. public static extern UInt32 IMC_StartPtpMove(Int16 cardIndex, Int16 axNo, double tgtPos, Int16 posType = 0);
  1743. /// @brief 启动多轴PTP的运动
  1744. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartMultiPtpMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1745. public static extern UInt32 IMC_StartMultiPtpMove(Int16 cardIndex, Int16 axNum, Int16[] pAxNoArray, double[] pTgtPosArray, Int16[] pPosTypeArray);
  1746. /// @brief 在线更新PTP目标位置
  1747. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdatePtpTgtPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1748. public static extern UInt32 IMC_UpdatePtpTgtPos(Int16 cardIndex, Int16 axNo, double tgtPos);
  1749. /// @brief 获取PTP目标位置
  1750. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtpTgtPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1751. public static extern UInt32 IMC_GetPtpTgtPos(Int16 cardIndex, Int16 axNo, ref double pTgtPos);
  1752. /// @brief 在线更新PTP运动参数
  1753. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdatePtpMvPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1754. public static extern UInt32 IMC_UpdatePtpMvPara(Int16 cardIndex, Int16 axNo, double tgtVel, double acc, double dec);
  1755. /// @brief 在线更新PTP目标速度
  1756. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdatePtpTgtVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1757. public static extern UInt32 IMC_UpdatePtpTgtVel(Int16 cardIndex, Int16 axNo, double tgtVel);
  1758. /// @brief 切换PTP规划模式
  1759. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PtpPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1760. public static extern UInt32 IMC_PtpPrf(Int16 cardIndex, Int16 axNo);
  1761. #endregion
  1762. ///@defgroup Jog Jog
  1763. ///@brief Jog运动模式相关接口
  1764. #region Jog
  1765. /// @brief 启动单轴JOG运动
  1766. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartJogMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1767. public static extern UInt32 IMC_StartJogMove(Int16 cardIndex, Int16 axNo, double tgVel);
  1768. /// @brief 启动多轴JOG运动
  1769. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartMultiJogMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1770. public static extern UInt32 IMC_StartMultiJogMove(Int16 cardIndex, Int16 axNum, Int16[] pAxNoArray, double[] pTgtVelArray);
  1771. /// @brief 在线更新JOG目标速度
  1772. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdateJogTgtVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1773. public static extern UInt32 IMC_UpdateJogTgtVel(Int16 cardIndex, Int16 axNo, double tgVel);
  1774. /// @brief 在线更新JOG运动参数
  1775. /// 注意:JOG规划减速度仅作用于JOG在线变速
  1776. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdateJogMvPara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1777. public static extern UInt32 IMC_UpdateJogMvPara(Int16 cardIndex, Int16 axNo, double tgVel, double acc, double dec);
  1778. /// @brief 切换JOG规划模式
  1779. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_JogPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1780. public static extern UInt32 IMC_JogPrf(Int16 cardIndex, Int16 axNo);
  1781. #endregion
  1782. ///@defgroup PTPS PTPS
  1783. ///@brief PTPS运动模式相关接口
  1784. #region PTPS
  1785. /// @brief 切换PTPS规划模式
  1786. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PrfPtps", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1787. public static extern UInt32 IMC_PrfPtps(Int16 cardIndex, Int16 axNo);
  1788. /// @brief 设置PTPS运动启动速度
  1789. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetPtpsBeginVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1790. public static extern UInt32 IMC_SetPtpsBeginVel(Int16 cardIndex, Int16 axNo, double beginVel);
  1791. /// @brief 设置PTPS运动结束速度
  1792. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetPtpsEndVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1793. public static extern UInt32 IMC_SetPtpsEndVel(Int16 cardIndex, Int16 axNo, double endVel);
  1794. /// @brief 设置PTPS运动参数
  1795. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetPtpsMovePara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1796. public static extern UInt32 IMC_SetPtpsMovePara(Int16 cardIndex, Int16 axNo, double tgVel, double acc, double dec);
  1797. /// @brief 设置PTPS运动参数
  1798. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetPtpsMoveParaEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1799. public static extern UInt32 IMC_SetPtpsMoveParaEx(Int16 cardIndex, Int16 axNo, double tgtVel, double tgtAcc, double tgtDec, double prfAcc, double prfDec);
  1800. /// @brief 启动单轴PTPS快速规划
  1801. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartPtpsMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1802. public static extern UInt32 IMC_StartPtpsMove(Int16 cardIndex, Int16 axNo, double tgtPos, short posType);
  1803. /// @brief 启动单轴PTPS软启动规划
  1804. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartPtpsMoveA", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1805. public static extern UInt32 IMC_StartPtpsMoveA(Int16 cardIndex, Int16 axNo, double tgtPos, double startSlowPos, double startSlowVel, short posType);
  1806. /// @brief 启动单轴PTPS软着陆规划
  1807. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartPtpsMoveD", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1808. public static extern UInt32 IMC_StartPtpsMoveD(Int16 cardIndex, Int16 axNo, double tgtPos, double stopSlowPos, double stopSlowVel, short posType);
  1809. /// @brief 启动单轴PTPS多段运动规划,可实现软启动及软着陆
  1810. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartPtpsMoveM", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1811. public static extern UInt32 IMC_StartPtpsMoveM(Int16 cardIndex, Int16 axNo, double tgtPos, double startSlowPos, double startSlowVel, double stopSlowPos, double stopSlowVel, short posType);
  1812. /// @brief 在线更新PTPS目标位置,无法实现软着陆
  1813. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdatePtpsMovePos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1814. public static extern UInt32 IMC_UpdatePtpsMovePos(Int16 cardIndex, Int16 axNo, double tgtPos);
  1815. /// @brief 在线更新PTPS目标速度,无法实现软着陆
  1816. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdatePtpsMoveVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1817. public static extern UInt32 IMC_UpdatePtpsMoveVel(Int16 cardIndex, Int16 axNo, double tgtVel);
  1818. /// @brief 在线更新PTPS运动参数,无法实现软着陆
  1819. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdatePtpsMovePara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1820. public static extern UInt32 IMC_UpdatePtpsMovePara(Int16 cardIndex, Int16 axNo, double tgVel, double acc, double dec);
  1821. /// @brief 在线更新PTPS软着陆规划,实现软着陆
  1822. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UpdatePtpsMoveD", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1823. public static extern UInt32 IMC_UpdatePtpsMoveD(Int16 cardIndex, Int16 axNo, double tgtPos, double stopSlowPos, double stopSlowVel);
  1824. /// @brief 获取PTPS运动启动速度
  1825. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtpsBeginVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1826. public static extern UInt32 IMC_GetPtpsBeginVel(Int16 cardIndex, Int16 axNo, ref double pBeginVel);
  1827. /// @brief 获取PTPS运动结束速度
  1828. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtpsEndVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1829. public static extern UInt32 IMC_GetPtpsEndVel(Int16 cardIndex, Int16 axNo, ref double pEendVel);
  1830. /// @brief 获取PTPS运动参数
  1831. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtpsMovePara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1832. public static extern UInt32 IMC_GetPtpsMovePara(Int16 cardIndex, Int16 axNo, ref double pTgtVel, ref double pAcc, ref double pDec);
  1833. /// @brief 获取PTPS运动参数
  1834. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtpsMoveParaEx", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1835. public static extern UInt32 IMC_GetPtpsMoveParaEx(Int16 cardIndex, Int16 axNo, double pTgtVel, double pTgtAcc, double pTgtDec, double tPrfAcc, double tPrfDec);
  1836. #endregion
  1837. ///@defgroup Gear Gear
  1838. ///@brief Gear运动模式相关接口
  1839. #region Gear
  1840. /// @brief 切换为电子齿轮模式
  1841. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GearPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1842. public static extern UInt32 IMC_GearPrf(Int16 cardIndex, Int16 axNo);
  1843. /// @brief 设置电子齿轮参数
  1844. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GearSetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1845. public static extern UInt32 IMC_GearSetParam(Int16 cardIndex, Int16 axNo, ref TGearParam pGearParam);
  1846. /// @brief 获取电子齿轮参数
  1847. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GearGetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1848. public static extern UInt32 IMC_GearGetParam(Int16 cardIndex, Int16 axNo, ref TGearParam pGearParam);
  1849. /// @brief 启动电子齿轮运动
  1850. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GearStart", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1851. public static extern UInt32 IMC_GearStart(Int16 cardIndex, Int16 axNo);
  1852. /// @brief 停止电子齿轮运动
  1853. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GearStop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1854. public static extern UInt32 IMC_GearStop(Int16 cardIndex, Int16 axNo, Int16 stopType);
  1855. /// @brief 获取电子齿轮状态
  1856. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GearGetStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1857. public static extern UInt32 IMC_GearGetStatus(Int16 cardIndex, Int16 axNo, ref Int16 pStatus, ref Int16 pErr);
  1858. /// @brief 更新电子齿轮比
  1859. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GearUpdateScale", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1860. public static extern UInt32 IMC_GearUpdateScale(Int16 cardIndex, Int16 axNo, Int32 masterScale, Int32 slaveScale, Int32 masterDis);
  1861. #endregion
  1862. ///@defgroup Pvt Pvt
  1863. ///@brief Pvt运动模式相关接口
  1864. #region Pvt
  1865. /// @brief 切换为PVT模式
  1866. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1867. public static extern UInt32 IMC_PvtPrf(Int16 cardIndex, Int16 axNo);
  1868. /// @brief 选择PVT数据表
  1869. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtTableSelect", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1870. public static extern UInt32 IMC_PvtTableSelect(Int16 cardIndex, Int16 axNo, Int16 tableId);
  1871. /// @brief 启动PVT运动
  1872. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtStart", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1873. public static extern UInt32 IMC_PvtStart(Int16 cardIndex, Int16 axNum, Int16[] pAxArray);
  1874. /// @brief 获取PVT状态
  1875. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtGetStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1876. public static extern UInt32 IMC_PvtGetStatus(Int16 cardIndex, Int16 axNo, Int16[] pTableId, double[] pTime, Int16 count = 1);
  1877. /// @brief 设置PVT循环
  1878. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtSetLoop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1879. public static extern UInt32 IMC_PvtSetLoop(Int16 cardIndex, Int16 axNo, Int32 loop);
  1880. /// @brief 获取PVT循环
  1881. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtGetLoop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1882. public static extern UInt32 IMC_PvtGetLoop(Int16 cardIndex, Int16 axNo, ref Int32 pCurLoop, ref Int32 pLoop);
  1883. /// @brief 向PVT的指定数据表传送PT数据
  1884. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtTablePt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1885. public static extern UInt32 IMC_PvtTablePt(Int16 cardIndex, Int16 tableId, Int32 count, double[] P, double[] T);
  1886. /// @brief 向PVT的指定数据表传送数据, 采用PVT描述方式
  1887. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtTablePvt", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1888. public static extern UInt32 IMC_PvtTablePvt(Int16 cardIndex, Int16 tableId, Int32 count, double[] P, double[] V, double[] T);
  1889. /// @brief 向PVT的指定数据表传送数据, 采用Percent描述方式(1段Percent描述方式消耗1~3个缓存空间)
  1890. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtTablePercent", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1891. public static extern UInt32 IMC_PvtTablePercent(Int16 cardIndex, Int16 tableId, Int32 count, double[] P, double[] T, double[] percent, double startVel = 0);
  1892. /// @brief 向PVT的指定数据表传送数据, 采用Complete描述方式
  1893. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PvtTableComplete", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1894. public static extern UInt32 IMC_PvtTableComplete(Int16 cardIndex, Int16 tableId, Int32 count, double[] P, double[] T, double startVel = 0, double endVel = 0);
  1895. #endregion
  1896. ///@defgroup Cam Cam
  1897. ///@brief Cam运动模式相关接口
  1898. #region Cam
  1899. /// @brief 设置凸轮规划模式
  1900. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamPrf", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1901. public static extern UInt32 IMC_CamPrf(Int16 cardIndex, Int16 axNo);
  1902. /// @brief 凸轮参数设置
  1903. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamSetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1904. public static extern UInt32 IMC_CamSetParam(Int16 cardIndex, Int16 axNo, Int16 masterType, Int16 masterNo, Int16 dirMode = 0);
  1905. /// @brief 凸轮参数获取
  1906. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamGetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1907. public static extern UInt32 IMC_CamGetParam(Int16 cardIndex, Int16 axNo, ref Int16 pMasterType, ref Int16 pMasterNo, ref Int16 pDirMode);
  1908. /// @brief 凸轮表选择
  1909. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamTableSelect", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1910. public static extern UInt32 IMC_CamTableSelect(Int16 cardIndex, Int16 axNo, Int16 tableId);
  1911. /// @brief 启动凸轮运动
  1912. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamStart", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1913. public static extern UInt32 IMC_CamStart(Int16 cardIndex, Int16 axNo);
  1914. /// @brief 停止凸轮运动
  1915. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamStop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1916. public static extern UInt32 IMC_CamStop(Int16 cardIndex, Int16 axNo, Int16 stopType);
  1917. /// @brief 获取凸轮状态
  1918. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamGetStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1919. public static extern UInt32 IMC_CamGetStatus(Int16 cardIndex, Int16 axNo, ref Int16 pStatus, ref Int16 pTableId, ref Int32 pCurUserID);
  1920. /// @brief 获取凸轮在表中的主轴位置和从轴位置
  1921. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamGetCurPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1922. public static extern UInt32 IMC_CamGetCurPos(Int16 cardIndex, Int16 axNo, ref double pMasterPos, ref double pSlavePos);
  1923. /// @brief 设置凸轮循环次数
  1924. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamSetLoop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1925. public static extern UInt32 IMC_CamSetLoop(Int16 cardIndex, Int16 axNo, UInt32 loop);
  1926. /// @brief 获取凸轮循环次数
  1927. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamGetLoop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1928. public static extern UInt32 IMC_CamGetLoop(Int16 cardIndex, Int16 axNo, ref UInt32 pCurLoop, ref UInt32 pLoop);
  1929. /// @brief 设置凸轮启动方式
  1930. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamSetEvent", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1931. public static extern UInt32 IMC_CamSetEvent(Int16 cardIndex, Int16 axNo, Int16 type, Int32 masterPos);
  1932. /// @brief 获取凸轮启动方式
  1933. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamGetEvent", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1934. public static extern UInt32 IMC_CamGetEvent(Int16 cardIndex, Int16 axNo, ref Int16 pType, ref Int32 pMasterPos);
  1935. /// @brief 主轴相位偏移(由速度参数指定)
  1936. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamPhasing", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1937. public static extern UInt32 IMC_CamPhasing(Int16 cardIndex, Int16 axNo, double phaseShift, double phaseVel, double phaseAcc, double phaseDec, Int16 phaseShiftType = 0);
  1938. /// @brief 主轴相位偏移(指定主轴位移完成偏移)
  1939. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamPhasingDist", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1940. public static extern UInt32 IMC_CamPhasingDist(Int16 cardIndex, Int16 axNo, double phaseShift, double masterDist, double accDistRatio, double decDistRatio, Int16 phaseShiftType = 0);
  1941. /// @brief 停止主轴相位偏移
  1942. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamStopPhasing", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1943. public static extern UInt32 IMC_CamStopPhasing(Int16 cardIndex, Int16 axNo);
  1944. /// @brief 获取主轴相位偏移状态
  1945. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamGetPhasing", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1946. public static extern UInt32 IMC_CamGetPhasing(Int16 cardIndex, Int16 axNo, ref Int16 phasingSts, ref double pPhase, ref double pPhaseVel);
  1947. /// @brief 清除凸轮表数据
  1948. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamTableClrData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1949. public static extern UInt32 IMC_CamTableClrData(Int16 cardIndex, Int16 tableId);
  1950. /// @brief 获取凸轮表剩余空间
  1951. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamTableGetSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1952. public static extern UInt32 IMC_CamTableGetSpace(Int16 cardIndex, Int16 tableId, ref Int32 pSpace);
  1953. /// @brief 重新分配凸轮表数量和大小(总深度为8*2048)
  1954. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamTableResize", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1955. public static extern UInt32 IMC_CamTableResize(Int16 cardIndex, Int16 tableNum);
  1956. /// @brief 获取凸轮表数量和大小信息
  1957. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamTableGetInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1958. public static extern UInt32 IMC_CamTableGetInfo(Int16 cardIndex, ref Int16 pTableNum, ref Int32 pTableSize);
  1959. /// @brief 凸轮表数据压入指令-通用压入指令
  1960. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamTableData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1961. public static extern UInt32 IMC_CamTableData(Int16 cardIndex, Int16 tableId, Int32 count, Int16[] pCurveType, double[] pKeyPointParam, Int32[] pUserID = null);
  1962. /// @brief 凸轮表获取关键点之间指定相位的位移
  1963. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CamTableGetDist", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1964. public static extern UInt32 IMC_CamTableGetDist(Int16 cardIndex, Int32 count, Int16[] pCurveType, double[] pKeyPointParam, double x, double[] pOutput);
  1965. #endregion
  1966. #endregion
  1967. ///@defgroup AdvMotion AdvMotion
  1968. ///@brief 高级运动功能
  1969. #region AdvMotion
  1970. ///@defgroup Crd Crd
  1971. ///@brief Crd坐标系插补运动模式相关接口
  1972. #region Crd
  1973. /// @brief 创建插补坐标系, 配置坐标系插补参数
  1974. /// @attention 注意!用户必须定义长度为 3 的数组进行传值
  1975. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetMtSys", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1976. public static extern UInt32 IMC_CrdSetMtSys(Int16 cardIndex, Int16 crdNo, Int16[] pMaskAxNoArray, Int16 lookAheadLen, double estopDec);
  1977. /// @brief 获取插补坐标系配置参数
  1978. /// @attention 注意!用户必须定义长度为 3 的数组进行传值
  1979. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetMtSysParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1980. public static extern UInt32 IMC_CrdGetMtSysParam(Int16 cardIndex, Int16 crdNo, Int16[] pMaskAxNoArray, ref Int16 pLookAheadLen, ref double pEstopDec);
  1981. /// @brief 删除插补坐标系
  1982. /// @attention 需对创建的坐标系进行删除, 否则接口报错
  1983. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdDeleteMtSys", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1984. public static extern UInt32 IMC_CrdDeleteMtSys(Int16 cardIndex, Int16 crdNo);
  1985. /// @brief 设置插补坐标系高级参数
  1986. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetAdvParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1987. public static extern UInt32 IMC_CrdSetAdvParam(Int16 cardIndex, Int16 crdNo, ref TCrdAdvParam pCrdAdvParam);
  1988. /// @brief 获取插补坐标系高级参数
  1989. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetAdvParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1990. public static extern UInt32 IMC_CrdGetAdvParam(Int16 cardIndex, Int16 crdNo, ref TCrdAdvParam pCrdAdvParam);
  1991. /// @brief 插补运动指令用户模式下的运动段的始末速度设置
  1992. /// @details 该指令主要用于用户规划模式下, 指定每段运动, 段的起始和段末的速度。一般情况下, 运动段的起始速度等于上一段的段末速度
  1993. /// @todo 插补模式用户速度功能待完成, 速度参数范围待补充
  1994. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetUserVelPlan", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1995. public static extern UInt32 IMC_CrdSetUserVelPlan(Int16 cardIndex, Int16 crdNo, double uStartVel, double uEndVel);
  1996. /// @brief 插补运动指令在用户规划模式下设置的运动段的始末速度的获取
  1997. /// @todo 插补模式用户速度功能待完成, 速度参数范围待补充
  1998. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetUserVelPlan", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  1999. public static extern UInt32 IMC_CrdGetUserVelPlan(Int16 cardIndex, Int16 crdNo, ref double pUStartVel, ref double pUEndVel);
  2000. /// @brief 设置插补平滑参数。通过设置平滑等级和平滑精度, 使插补运动轨迹更平滑
  2001. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetSmoothParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2002. public static extern UInt32 IMC_CrdSetSmoothParam(Int16 cardIndex, Int16 crdNo, Int32 smoothLevel, double smoothTol);
  2003. /// @brief 获取插补平滑参数。通过设置平滑等级和平滑精度, 使插补运动轨迹更平滑
  2004. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetSmoothParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2005. public static extern UInt32 IMC_CrdGetSmoothParam(Int16 cardIndex, Int16 crdNo, ref Int32 pSmoothLevel, ref double pSmoothTol);
  2006. /// @brief 设置插补轨迹速度
  2007. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetTrajVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2008. public static extern UInt32 IMC_CrdSetTrajVel(Int16 cardIndex, Int16 crdNo, double tgtVel);
  2009. /// @brief 获取插补轨迹速度
  2010. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetTrajVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2011. public static extern UInt32 IMC_CrdGetTrajVel(Int16 cardIndex, Int16 crdNo, ref double pTgtVel);
  2012. /// @brief 设置插补轨迹加速度和减速度
  2013. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetTrajAccAndDec", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2014. public static extern UInt32 IMC_CrdSetTrajAccAndDec(Int16 cardIndex, Int16 crdNo, double tgtAcc, double tgtDec);
  2015. /// @brief 获取插补轨迹加速度和减速度
  2016. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetTrajAccAndDec", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2017. public static extern UInt32 IMC_CrdGetTrajAccAndDec(Int16 cardIndex, Int16 crdNo, ref double pTgtAcc, ref double pTgtDec);
  2018. /// @brief 设置插补强制规划末速度降为 0 标识
  2019. /// @details 如果将强制规划末速度降为 0, 则下面所有线段末速度为 0
  2020. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetZeroFlag", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2021. public static extern UInt32 IMC_CrdSetZeroFlag(Int16 cardIndex, Int16 crdNo, Int16 ZeroFlag);
  2022. /// @brief 获取插补强制规划末速度降为 0 标识
  2023. /// @details 如果将强制规划末速度降为 0, 则下面所有线段末速度为 0
  2024. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetZeroFlag", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2025. public static extern UInt32 IMC_CrdGetZeroFlag(Int16 cardIndex, Int16 crdNo, ref Int16 pZeroFlag);
  2026. /// @brief 设置插补运动指令的位置编程模式
  2027. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetIncMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2028. public static extern UInt32 IMC_CrdSetIncMode(Int16 cardIndex, Int16 crdNo, Int16 mode);
  2029. /// @brief 获取插补运动指令的位置编程模式
  2030. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetIncMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2031. public static extern UInt32 IMC_CrdGetIncMode(Int16 cardIndex, Int16 crdNo, ref Int16 pMode);
  2032. /// @brief 设置插补同步跟随轴的速度模式
  2033. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetFolVelMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2034. public static extern UInt32 IMC_CrdSetFolVelMode(Int16 cardIndex, Int16 crdNo, Int16 mode);
  2035. /// @brief 获取插补同步跟随轴的速度模式
  2036. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetFolVelMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2037. public static extern UInt32 IMC_CrdGetFolVelMode(Int16 cardIndex, Int16 crdNo, ref Int16 pMode);
  2038. /// @brief 设置插补运动指令的过渡精度
  2039. /// @details 该指令属于高级参数指令, 只有在启动过渡模式才生效
  2040. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetTrajTol", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2041. public static extern UInt32 IMC_CrdSetTrajTol(Int16 cardIndex, Int16 crdNo, double tol);
  2042. /// @brief 设置插补运动指令的拐弯系数。
  2043. /// @details 该指令属于高级参数指令, 只有在启动过渡模式才生效, 该参数越 小, 在过渡拐弯时速度降至越低, 参数越大, 则拐弯速度越高, 默认参数为 1
  2044. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetTrajTurnCoef", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2045. public static extern UInt32 IMC_CrdSetTrajTurnCoef(Int16 cardIndex, Int16 crdNo, double turnCoef);
  2046. /// @brief 三维直线插补运动
  2047. /// @attention[]]pEndPosArray 应传入长度为 3 的数组指针
  2048. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdLineXYZ", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2049. public static extern UInt32 IMC_CrdLineXYZ(Int16 cardIndex, Int16 crdNo, double[] pEndPosArray, Int32 userID = 0);
  2050. /// @brief XY平面内直线插补运动
  2051. /// @attention[]]pEndPosArray 应传入长度为 2 的数组指针
  2052. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdLineXY", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2053. public static extern UInt32 IMC_CrdLineXY(Int16 cardIndex, Int16 crdNo, double[] pEndPosArray, Int32 userID = 0);
  2054. /// @brief XZ平面内直线插补运动
  2055. /// @attention[]]pEndPosArray 应传入长度为 2 的数组指针
  2056. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdLineZX", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2057. public static extern UInt32 IMC_CrdLineZX(Int16 cardIndex, Int16 crdNo, double[] pEndPosArray, Int32 userID = 0);
  2058. /// @brief YZ平面内直线插补运动
  2059. /// @attention[]]pEndPosArray 应传入长度为 2 的数组指针
  2060. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdLineYZ", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2061. public static extern UInt32 IMC_CrdLineYZ(Int16 cardIndex, Int16 crdNo, double[] pEndPosArray, Int32 userID = 0);
  2062. /// @brief 给定三点的三维圆弧插补
  2063. /// @details 如果输入三点共线会导致圆弧几何错误, 此函数只能画小于一圈的圆不能画整圆和多圈圆
  2064. /// @attention pMidPos 、pEndPos 应传入长度为 3 的数组指针
  2065. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcThreePoint", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2066. public static extern UInt32 IMC_CrdArcThreePoint(Int16 cardIndex, Int16 crdNo, double[] pMidPosArray, double[] pEndPosArray, Int32 userID);
  2067. /// @brief 给定圆心, 末点法向量的三维圆弧插补
  2068. /// @details 当 height 不为 0 的时候可衍生为螺旋线插补。当起点和终点重合的时候几何参数错误。
  2069. /// @attention[]]pCenterArray[] pEndPosArray[] pNormalArray 应传入长度为 3 的数组指针
  2070. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_Crd3DArcCenterNormal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2071. public static extern UInt32 IMC_Crd3DArcCenterNormal(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, double[] pNormalArray, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2072. /// @brief 给定圆弧半径, 圆弧末点和圆弧法向量的三维圆弧插补
  2073. /// @details 当 height 不为 0 的时候可衍生为螺旋线插补。 此函数无法插补整圆
  2074. /// @attention[]]pEndPosArray[] pNormalArray 应传入长度为 3 的数组指针
  2075. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_Crd3DArcRadiusNormal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2076. public static extern UInt32 IMC_Crd3DArcRadiusNormal(Int16 cardIndex, Int16 crdNo, double radius, double[] pEndPosArray, double[] pNormalArray, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2077. /// @brief 给定圆弧圆心, 圆弧角度和圆弧法向量的三维圆弧插补
  2078. /// @details 当 height 不为 0 的时候可衍生为螺旋线插补。此函数可以画整圆
  2079. /// @attention[]]pCenterArray[] pNormalArray 应传入长度为 3 的数组指针
  2080. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_Crd3DArcAngleNormal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2081. public static extern UInt32 IMC_Crd3DArcAngleNormal(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double angle, double[] pNormalArray, double height = 0, Int32 userID = 0);
  2082. /// @brief 给定圆弧圆心和圆弧末点, XY平面内的圆弧插补
  2083. /// @attention[]]pCenterArray[] pEndPosArray 应传入长度为 2 的数组指针
  2084. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcCenterXYPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2085. public static extern UInt32 IMC_CrdArcCenterXYPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2086. /// @brief 给定圆弧圆心和圆弧末点, YZ平面内的圆弧插补
  2087. /// @attention[]]pCenterArray[] pEndPosArray 应传入长度为 2 的数组指针
  2088. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcCenterYZPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2089. public static extern UInt32 IMC_CrdArcCenterYZPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2090. /// @brief 给定圆弧圆心和圆弧末点, ZX平面内的圆弧插补
  2091. /// @attention[]]pCenterArray[] pEndPosArray 应传入长度为 2 的数组指针
  2092. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcCenterZXPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2093. public static extern UInt32 IMC_CrdArcCenterZXPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2094. /// @brief 给定圆弧半径和圆弧末点, XY平面内的圆弧插补
  2095. /// @attention[]]pEndPosArray 应传入长度为 2 的数组指针
  2096. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcRadiusXYPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2097. public static extern UInt32 IMC_CrdArcRadiusXYPlane(Int16 cardIndex, Int16 crdNo, double radius, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2098. /// @brief 给定圆弧半径和圆弧末点, YZ平面内的圆弧插补
  2099. /// @attention[]]pEndPosArray 应传入长度为 2 的数组指针
  2100. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcRadiusYZPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2101. public static extern UInt32 IMC_CrdArcRadiusYZPlane(Int16 cardIndex, Int16 crdNo, double radius, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2102. /// @brief 给定圆弧半径和圆弧末点, ZX平面内的圆弧插补
  2103. /// @attention[]]pEndPosArray 应传入长度为 2 的数组指针
  2104. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcRadiusZXPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2105. public static extern UInt32 IMC_CrdArcRadiusZXPlane(Int16 cardIndex, Int16 crdNo, double radius, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2106. /// @brief 给定圆弧圆心和和圆弧角度, XY平面内的圆弧插补
  2107. /// @attention[]]pCenterArray 应传入长度为 2 的数组指针
  2108. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcAngleXYPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2109. public static extern UInt32 IMC_CrdArcAngleXYPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double angle, double height = 0, Int32 userID = 0);
  2110. /// @brief 给定圆弧圆心和和圆弧角度, YZ平面内的圆弧插补
  2111. /// @attention[]]pCenterArray 应传入长度为 2 的数组指针
  2112. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcAngleYZPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2113. public static extern UInt32 IMC_CrdArcAngleYZPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double angle, double height = 0, Int32 userID = 0);
  2114. /// @brief 给定圆弧圆心和和圆弧角度, ZX平面内的圆弧插补
  2115. /// @attention[]]pCenterArray 应传入长度为 2 的数组指针
  2116. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdArcAngleZXPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2117. public static extern UInt32 IMC_CrdArcAngleZXPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double angle, double height = 0, Int32 userID = 0);
  2118. /// @brief 给定圆心, 末点法向量的三维涡旋线插补
  2119. /// @details 当 height 不为 0 的时候可衍生为螺旋线插补。当起点和终点重合的时候几何参数错误。
  2120. /// @attention[]]pCenterArray[] pEndPosArray[] pNormalArray 应传入长度为 3 的数组指针
  2121. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_Crd3DVortexCenterNormal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2122. public static extern UInt32 IMC_Crd3DVortexCenterNormal(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, double[] pNormalArray, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2123. /// @brief 给定涡旋线圆心和涡旋线末点, XY平面内的涡旋线插补
  2124. /// @attention[]]pCenterArray[] pEndPosArray 应传入长度为 2 的数组指针
  2125. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdVortexCenterXYPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2126. public static extern UInt32 IMC_CrdVortexCenterXYPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2127. /// @brief 给定涡旋线圆心和涡旋线末点, YZ平面内的涡旋线插补
  2128. /// @attention[]]pCenterArray[] pEndPosArray 应传入长度为 2 的数组指针
  2129. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdVortexCenterYZPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2130. public static extern UInt32 IMC_CrdVortexCenterYZPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2131. /// @brief 给定涡旋线圆心和涡旋线末点, ZX平面内的涡旋线插补
  2132. /// @attention[]]pCenterArray[] pEndPosArray 应传入长度为 2 的数组指针
  2133. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdVortexCenterZXPlane", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2134. public static extern UInt32 IMC_CrdVortexCenterZXPlane(Int16 cardIndex, Int16 crdNo, double[] pCenterArray, double[] pEndPosArray, Int16 dir, double height = 0, Int32 turn = 0, Int32 userID = 0);
  2135. /// @brief 插补缓冲区等待延时
  2136. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdWaitTime", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2137. public static extern UInt32 IMC_CrdWaitTime(Int16 cardIndex, Int16 crdNo, Int32 waitTime, Int32 userID = 0);
  2138. /// @brief 插补缓冲区等待 DI
  2139. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdWaitDI", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2140. public static extern UInt32 IMC_CrdWaitDI(Int16 cardIndex, Int16 crdNo, Int16 diNO, Int16 diType, Int16 diLevel, Int32 userID = 0);
  2141. /// @brief 插补缓冲区等待 DI
  2142. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdWaitTimeDI", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2143. public static extern UInt32 IMC_CrdWaitTimeDI(Int16 cardIndex, Int16 crdNo, Int16 diNO, Int16 diType, Int16 diLevel, Int32 waitTime, Int32 userID = 0);
  2144. /// @brief 插补缓冲区输出 DO
  2145. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetDO", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2146. public static extern UInt32 IMC_CrdSetDO(Int16 cardIndex, Int16 crdNo, Int16 doNO, Int16 doType, Int16 doLevel, Int32 userID = 0);
  2147. /// @brief 插补缓冲区指令, 执行到该段时, 以该段为起始, 在 waitPos 距离处输出指定的 DO 信号
  2148. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetDistanceDO", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2149. public static extern UInt32 IMC_CrdSetDistanceDO(Int16 cardIndex, Int16 crdNo, double waitPos, Int16 doNO, Int16 doType, Int16 doLevel, Int32 userID = 0);
  2150. /// @brief 插补缓冲区指令, 执行到该段时, 以该段为起始, 延时设定时间, 输出指定的 DO 信号
  2151. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetTimeDO", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2152. public static extern UInt32 IMC_CrdSetTimeDO(Int16 cardIndex, Int16 crdNo, Int32 waitTime, Int16 doNO, Int16 doType, Int16 doLevel, Int32 userID = 0);
  2153. /// @brief 插补缓冲区启动插补轴以外的轴 PTP 运动
  2154. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdPTPMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2155. public static extern UInt32 IMC_CrdPTPMove(Int16 cardIndex, Int16 crdNo, Int16 axNo, double tgtPos, double tgtVel, double acc, Int16 mvType, Int16 waitFlag, Int32 userID = 0);
  2156. /// @brief 插补缓冲区中启动插补轴之外的轴同步运动(相对位移)
  2157. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSyncMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2158. public static extern UInt32 IMC_CrdSyncMove(Int16 cardIndex, Int16 crdNo, Int16 axNo, double syncPos, Int32 userID = 0);
  2159. /// @brief 插补缓冲区中启动插补轴之外的轴同步运动(绝对位移)
  2160. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSyncMoveAbs", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2161. public static extern UInt32 IMC_CrdSyncMoveAbs(Int16 cardIndex, Int16 crdNo, Int16 axNo, double syncTgtPos, Int32 userID = 0);
  2162. /// @brief 插补缓冲区等待上一条运动指令到位
  2163. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdWaitInPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2164. public static extern UInt32 IMC_CrdWaitInPos(Int16 cardIndex, Int16 crdNo, Int32 userID = 0);
  2165. /// @brief 缓冲区插补轴外的多轴(两轴)同步运动
  2166. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdMultiSyncMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2167. public static extern UInt32 IMC_CrdMultiSyncMove(Int16 cardIndex, Int16 crdNo, Int16 axNum, Int16[] pAxNo, double[] pTgtPos, double tgtVel, double tgtAcc, Int16 contiFlag, Int32 userID = 0);
  2168. /// @brief 插补缓存运动停止
  2169. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdBufStop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2170. public static extern UInt32 IMC_CrdBufStop(Int16 cardIndex, Int16 crdNo, Int32 userID = 0);
  2171. /// @brief 插补缓存区设置全局变量
  2172. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetUserVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2173. public static extern UInt32 IMC_CrdSetUserVal(Int16 cardIndex, Int16 crdNo, Int16 index, Int32 value, Int32 userID = 0);
  2174. /// @brief 插补缓存区等待全局变量
  2175. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdWaitUserVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2176. public static extern UInt32 IMC_CrdWaitUserVal(Int16 cardIndex, Int16 crdNo, Int16 index, Int16 condition, Int32 compareValue, Int32 waitTime, Int32 userID = 0);
  2177. /// @brief 一次性往 DSP 队列发送 PC 部分的队列数据
  2178. /// @details 每次发送若干条, 如果完全发送完成, pIsFinished 标 识记为 1
  2179. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdEndData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2180. public static extern UInt32 IMC_CrdEndData(Int16 cardIndex, Int16 crdNo, ref Int16 pIsFinished);
  2181. /// @brief 插补运动使能函数, 调用此函数后, 会开始插补运动。如果停止插补运动, 需要调用停止运动函数 进行去插补使能
  2182. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdStart", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2183. public static extern UInt32 IMC_CrdStart(Int16 cardIndex, Int16 crdNo);
  2184. /// @brief 多个插补坐标系同时运动使能函数, 调用此函数后, 会开始插补运动。如果停止插补运动, 需要调用停止运动函数 进行去插补使能
  2185. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdMultiStart", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2186. public static extern UInt32 IMC_CrdMultiStart(Int16 cardIndex, Int16[] pCrdNo, Int16 count);
  2187. /// @brief 调用此函数进行插补停止, 用户可以选择正常平滑停止和急停。
  2188. /// @details 正常平滑停止按照用户设定的轨迹加速度进行减速停止。急停是利用用户在建立坐标系设定的急停加速度进行停止, 停止后系统不会清空队列, 需要用户自己清空队列。
  2189. /// @attention 急停停止后, 插补会报出急停错误号, 需要手动清除此错误才能再次运行
  2190. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdStop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2191. public static extern UInt32 IMC_CrdStop(Int16 cardIndex, Int16 crdNo, Int16 stopType);
  2192. /// @brief 清除缓存区压入曲线数据
  2193. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdClrData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2194. public static extern UInt32 IMC_CrdClrData(Int16 cardIndex, Int16 crdNo);
  2195. /// @brief 清除插补错误号。可以清除 IMC_CrdGetStatus 获取到的故障号
  2196. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdClrError", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2197. public static extern UInt32 IMC_CrdClrError(Int16 cardIndex, Int16 crdNo);
  2198. /// @brief 插补倍率设定函数。插补实际进给速度 = 用户插补进给速度 × 倍率值。
  2199. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetRatio", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2200. public static extern UInt32 IMC_CrdSetRatio(Int16 cardIndex, Int16 crdNo, double ratio);
  2201. /// @brief 插补倍率获取函数
  2202. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetRatio", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2203. public static extern UInt32 IMC_CrdGetRatio(Int16 cardIndex, Int16 crdNo, ref double pRatio);
  2204. /// @brief 插补状态获取。bit0-bit7 是插补运行状态。bi8-bit15 是插补故障状态
  2205. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2206. public static extern UInt32 IMC_CrdGetStatus(Int16 cardIndex, Int16 crdNo, ref Int16 pStatus);
  2207. /// @brief 获取插补运动执行缓冲区最后一段的运动状态
  2208. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetArrivalSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2209. public static extern UInt32 IMC_CrdGetArrivalSts(Int16 cardIndex, Int16 crdNo, ref Int16 pSts);
  2210. /// @brief 获取插补目标位置。目标位置指的是最后压入曲线的末点位置
  2211. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetTargetPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2212. public static extern UInt32 IMC_CrdGetTargetPos(Int16 cardIndex, Int16 crdNo, double[] pPosArray);
  2213. /// @brief 获取插补暂停运动的位置。该位置一般用于当用户使用单轴移动过插补轴后, 需要返回继续加工时使用
  2214. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetPausePos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2215. public static extern UInt32 IMC_CrdGetPausePos(Int16 cardIndex, Int16 crdNo, double[] pPosArray);
  2216. /// @brief 当前插补坐标系坐标读取函数
  2217. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2218. public static extern UInt32 IMC_CrdGetPos(Int16 cardIndex, Int16 crdNo, double[] pCrdPosArray);
  2219. /// @brief 插补轨迹速度读取函数
  2220. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2221. public static extern UInt32 IMC_CrdGetVel(Int16 cardIndex, Int16 crdNo, ref double pCrdVel);
  2222. /// @brief 插补当前运动曲线用户索引获取
  2223. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetUserID", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2224. public static extern UInt32 IMC_CrdGetUserID(Int16 cardIndex, Int16 crdNo, ref Int32 pUserID);
  2225. /// @brief 获取队列当前的剩余余量
  2226. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2227. public static extern UInt32 IMC_CrdGetSpace(Int16 cardIndex, Int16 crdNo, ref Int32 pSpace);
  2228. /// @brief 获取 CPU 缓存队列当前的剩余空间
  2229. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetBufSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2230. public static extern UInt32 IMC_CrdGetBufSpace(Int16 cardIndex, Int16 crdNo, ref Int32 pSpace);
  2231. /// @brief 获取前瞻缓存队列当前的剩余空间
  2232. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetLookAheadSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2233. public static extern UInt32 IMC_CrdGetLookAheadSpace(Int16 cardIndex, Int16 crdNo, ref Int32 pSpace);
  2234. /// @brief 插补缓冲区模式设置
  2235. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetBufferMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2236. public static extern UInt32 IMC_CrdSetBufferMode(Int16 cardIndex, Int16 crdNo, Int16 bufferMode);
  2237. /// @brief 获取插补缓冲区模式
  2238. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdGetBufferMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2239. public static extern UInt32 IMC_CrdGetBufferMode(Int16 cardIndex, Int16 crdNo, ref Int16 pBufferMode);
  2240. /// @brief 插补数据恢复
  2241. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CrdSetDataRestore", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2242. public static extern UInt32 IMC_CrdSetDataRestore(Int16 cardIndex, Int16 crdNo);
  2243. #endregion
  2244. ///@defgroup MultiCrd MultiCrd
  2245. ///@brief MultiCrd 多轴插补运动模式相关接口
  2246. #region MultiCrd
  2247. /// @brief 建立多轴插补系统
  2248. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiSetupSys", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2249. public static extern UInt32 IMC_MultiSetupSys(Int16 cardIndex, Int16 groupNo, Int16[] pAxNo, Int16 maxAxNum);
  2250. /// @brief 销毁多轴插补系统
  2251. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiDeleteSys", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2252. public static extern UInt32 IMC_MultiDeleteSys(Int16 cardIndex, Int16 groupNo);
  2253. /// @brief 启动多轴插补运动
  2254. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiStart", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2255. public static extern UInt32 IMC_MultiStart(Int16 cardIndex, Int16 groupNo);
  2256. /// @brief 停止多轴插补运动
  2257. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiStop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2258. public static extern UInt32 IMC_MultiStop(Int16 cardIndex, Int16 groupNo, Int16 stopType);
  2259. /// @brief 获取多轴插补数据剩余空间
  2260. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2261. public static extern UInt32 IMC_MultiGetSpace(Int16 cardIndex, Int16 groupNo, ref Int32 pSpace);
  2262. /// @brief 清除多轴插补系统错误状态
  2263. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiClrData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2264. public static extern UInt32 IMC_MultiClrData(Int16 cardIndex, Int16 groupNo);
  2265. /// @brief 清除多轴插补数据队列
  2266. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiClrError", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2267. public static extern UInt32 IMC_MultiClrError(Int16 cardIndex, Int16 groupNo);
  2268. /// @brief 设置多轴插补位置类型
  2269. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiSetPosType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2270. public static extern UInt32 IMC_MultiSetPosType(Int16 cardIndex, Int16 groupNo, Int16 posType);
  2271. /// @brief 获取多轴插补位置类型
  2272. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetPosType", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2273. public static extern UInt32 IMC_MultiGetPosType(Int16 cardIndex, Int16 groupNo, ref Int16 pPosType);
  2274. /// @brief 获取多轴插补当前段UserID
  2275. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetUserID", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2276. public static extern UInt32 IMC_MultiGetUserID(Int16 cardIndex, Int16 groupNo, ref Int32 pUserID);
  2277. /// @brief 获取多轴插补系统运行状态
  2278. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2279. public static extern UInt32 IMC_MultiGetSts(Int16 cardIndex, Int16 groupNo, ref Int16 pSts, ref Int16 pErrocode);
  2280. /// @brief 获取多轴插补运动到位状态
  2281. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetArrivalSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2282. public static extern UInt32 IMC_MultiGetArrivalSts(Int16 cardIndex, Int16 groupNo, ref Int16 pArrivalSts);
  2283. /// @brief 设置多轴插补系统运动速度倍率
  2284. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiSetRatio", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2285. public static extern UInt32 IMC_MultiSetRatio(Int16 cardIndex, Int16 groupNo, double ratio);
  2286. /// @brief 获取多轴插补系统运动速度倍率
  2287. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetRatio", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2288. public static extern UInt32 IMC_MultiGetRatio(Int16 cardIndex, Int16 groupNo, ref double pRatio);
  2289. /// @brief 获取多轴插补运动轨迹位置
  2290. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetTrajPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2291. public static extern UInt32 IMC_MultiGetTrajPos(Int16 cardIndex, Int16 groupNo, double[] pPos);
  2292. /// @brief 获取多轴插补运动轨迹速度
  2293. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiGetTrajVel", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2294. public static extern UInt32 IMC_MultiGetTrajVel(Int16 cardIndex, Int16 groupNo, ref double pVel);
  2295. /// @brief 多轴插补直线运动
  2296. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiLineMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2297. public static extern UInt32 IMC_MultiLineMove(Int16 cardIndex, Int16 groupNo, double[] pEndPos, double trajVel, double trajAcc, double trajDec, Int16 blendType, double blendRatio, Int32 userID = 0);
  2298. /// @brief 多轴插补等待事件
  2299. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiWaitTime", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2300. public static extern UInt32 IMC_MultiWaitTime(Int16 cardIndex, Int16 groupNo, Int32 waitTime, Int32 userID);
  2301. /// @brief 多轴插补等待DI输入事件
  2302. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiWaitDI", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2303. public static extern UInt32 IMC_MultiWaitDI(Int16 cardIndex, Int16 groupNo, Int16 diIndex, Int16 diType, Int16 diLevel, Int32 waitTime, Int32 userID);
  2304. /// @brief 多轴插补设置DO输出事件
  2305. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiSetDO", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2306. public static extern UInt32 IMC_MultiSetDO(Int16 cardIndex, Int16 groupNo, Int16 doIndex, Int16 doType, Int16 doLevel, Int32 userID);
  2307. /// @brief 多轴插补设置翻转DO输出事件
  2308. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiSetReverseDO", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2309. public static extern UInt32 IMC_MultiSetReverseDO(Int16 cardIndex, Int16 groupNo, Int16 doIndex, Int16 doType, Int16 doLevel, Int32 waitTime, Int32 userID);
  2310. #endregion
  2311. ///@defgroup BandPt BandPt
  2312. ///@brief BandPt 缓冲区插补运动模式相关接口
  2313. #region BandPt
  2314. /// @brief 建立多轴捆绑 PT 运行系统
  2315. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetupPtPackSys", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2316. public static extern UInt32 IMC_SetupPtPackSys(Int16 cardIndex, Int16 sysNo, Int16[] pMaskAxNoArray, Int16 maxAxNum);
  2317. /// @brief 销毁捆绑 PT 运动系统
  2318. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_DeletePtPackSys", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2319. public static extern UInt32 IMC_DeletePtPackSys(Int16 cardIndex, Int16 sysNo);
  2320. /// @brief 设置捆绑 PT 运动位置的编程类型
  2321. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetPtPackIncMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2322. public static extern UInt32 IMC_SetPtPackIncMode(Int16 cardIndex, Int16 sysNo, Int16 incMode);
  2323. /// @brief 获取捆绑 PT 运动位置的编程类型
  2324. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtPackIncMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2325. public static extern UInt32 IMC_GetPtPackIncMode(Int16 cardIndex, Int16 sysNo, ref Int16 pIncMode);
  2326. /// @brief 使能捆绑 PT 运动数据断流保护。当使能后, 根据缓冲区是否有数据, 同时判断各轴的速度是否大 于设定的阈值。
  2327. /// @details 如果系统中有任意一个轴的速度大于了设定的阈值, 则进行断流保护, 按照设定的 平滑停加速度进行停止。
  2328. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_EnablePtPackNoDataProtect", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2329. public static extern UInt32 IMC_EnablePtPackNoDataProtect(Int16 cardIndex, Int16 sysNo, double[] pThresholdVelArray);
  2330. /// @brief 取消捆绑 PT 运动数据断流保护
  2331. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_DisablePtPackNoDataProtect", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2332. public static extern UInt32 IMC_DisablePtPackNoDataProtect(Int16 cardIndex, Int16 sysNo);
  2333. /// @brief 获取捆绑 PT 运动数据断流保护的设置状态
  2334. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtPackNoDataProtectStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2335. public static extern UInt32 IMC_GetPtPackNoDataProtectStatus(Int16 cardIndex, Int16 sysNo, ref Int16 pEnSts, double[] pThresholdVelArray);
  2336. /// @brief 添加捆绑 PT 运动数据
  2337. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_AddMotionPointPtPack", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2338. public static extern UInt32 IMC_AddMotionPointPtPack(Int16 cardIndex, Int16 sysNo, double[] pPosArray, Int16[] pTypeArray, double T, Int16 dataNum);
  2339. /// @brief 添加捆绑 PT 中的 DO 输出事件
  2340. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_AddDoPointPtPack", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2341. public static extern UInt32 IMC_AddDoPointPtPack(Int16 cardIndex, Int16 sysNo, Int16 doNo, Int16 doType, Int16 doLevel);
  2342. /// @brief 启动捆绑 PT 运动
  2343. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StartPtPack", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2344. public static extern UInt32 IMC_StartPtPack(Int16 cardIndex, Int16 sysNo);
  2345. /// @brief 停止捆绑 PT 运动
  2346. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopPtPack", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2347. public static extern UInt32 IMC_StopPtPack(Int16 cardIndex, Int16 sysNo, Int16 type);
  2348. /// @brief 清除捆绑 PT 运动数据
  2349. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ClrPtPackData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2350. public static extern UInt32 IMC_ClrPtPackData(Int16 cardIndex, Int16 sysNo);
  2351. /// @brief 清除捆绑 PT 运动错误
  2352. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ClrPtPackError", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2353. public static extern UInt32 IMC_ClrPtPackError(Int16 cardIndex, Int16 sysNo);
  2354. /// @brief 获取捆绑 PT 运动数据的空间
  2355. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtPackRestSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2356. public static extern UInt32 IMC_GetPtPackRestSpace(Int16 cardIndex, Int16 sysNo, ref Int16 pSpace);
  2357. /// @brief 获取捆绑 PT 运动的状态
  2358. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtPackStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2359. public static extern UInt32 IMC_GetPtPackStatus(Int16 cardIndex, Int16 sysNo, ref Int16 pStatus);
  2360. /// @brief 获取捆绑 PT 运动错误
  2361. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtPackError", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2362. public static extern UInt32 IMC_GetPtPackError(Int16 cardIndex, Int16 sysNo, ref Int16 pErr);
  2363. /// @brief 获取捆绑 PT 运动到位状态
  2364. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPtPackArrivalSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2365. public static extern UInt32 IMC_GetPtPackArrivalSts(Int16 cardIndex, Int16 sysNo, ref Int16 pSts);
  2366. #endregion
  2367. #endregion
  2368. #endregion
  2369. ///@defgroup Compensation Compensation
  2370. ///@brief 运动补偿功能
  2371. #region Compensation
  2372. ///@defgroup ScrewComp ScrewComp
  2373. ///@brief 螺距误差补偿
  2374. #region ScrewComp
  2375. /// @brief 设置螺距误差补偿表
  2376. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxScrewCompTable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2377. public static extern UInt32 IMC_SetAxScrewCompTable(Int16 cardIndex, Int16 tableId, Int16 cnt, Int32[] pPosCompArray, Int32[] pNegCompArray);
  2378. /// @brief 获取螺距误差补偿表
  2379. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxScrewCompTable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2380. public static extern UInt32 IMC_GetAxScrewCompTable(Int16 cardIndex, Int16 tableId, ref Int16 pCnt, Int32[] pPosCompArray, Int32[] pNegCompArray);
  2381. /// @brief 设置螺距误差补偿参数
  2382. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxScrewCompParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2383. public static extern UInt32 IMC_SetAxScrewCompParam(Int16 cardIndex, Int16 axNo, Int16 pointCnt, Int32 startPos, Int32 len);
  2384. /// @brief 获取螺距误差补偿参数
  2385. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxScrewCompParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2386. public static extern UInt32 IMC_GetAxScrewCompParam(Int16 cardIndex, Int16 axNo, ref Int16 pPointCnt, ref Int32 pStartPos, ref Int32 pLen);
  2387. /// @brief 使能螺距误差补偿
  2388. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_EnableAxScrewComp", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2389. public static extern UInt32 IMC_EnableAxScrewComp(Int16 cardIndex, Int16 axNo, Int16 enable);
  2390. /// @brief 获取螺距误差补偿状态
  2391. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxScrewCompSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2392. public static extern UInt32 IMC_GetAxScrewCompSts(Int16 cardIndex, Int16 axNo, ref Int16 pEnable, ref double pCompVal);
  2393. #endregion
  2394. ///@defgroup TableComp TableComp
  2395. ///@brief 表补偿功能
  2396. #region TableComp
  2397. /// @brief 设置表补偿的数据表
  2398. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompSetTable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2399. public static extern UInt32 IMC_TableCompSetTable(Int16 cardIndex, Int16 tableId, Int32 cnt, Int32[] pDataArray);
  2400. /// @brief 获取表补偿的数据表
  2401. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompGetTable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2402. public static extern UInt32 IMC_TableCompGetTable(Int16 cardIndex, Int16 tableId, ref Int32 pCnt, Int32[] pDataArray);
  2403. /// @brief 设置表补偿参数
  2404. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompSetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2405. public static extern UInt32 IMC_TableCompSetParam(Int16 cardIndex, Int16 axNo, ref TTableCompParam pTTableCompParam);
  2406. /// @brief 获取表补偿参数
  2407. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompGetParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2408. public static extern UInt32 IMC_TableCompGetParam(Int16 cardIndex, Int16 axNo, ref TTableCompParam pTTableCompParam);
  2409. /// @brief 使能表补偿
  2410. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompEnable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2411. public static extern UInt32 IMC_TableCompEnable(Int16 cardIndex, Int16 axNo, Int16 enable);
  2412. /// @brief 获取表补偿状态
  2413. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompGetSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2414. public static extern UInt32 IMC_TableCompGetSts(Int16 cardIndex, Int16 axNo, ref Int16 pEnable, ref double pCompVal);
  2415. /// @brief 重新分配表补偿的表数量和大小(总大小为40000)
  2416. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompTableResize", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2417. public static extern UInt32 IMC_TableCompTableResize(Int16 cardIndex, Int16 tableNum);
  2418. /// @brief 获取表补偿的表数量和大小信息
  2419. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_TableCompTableGetInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2420. public static extern UInt32 IMC_TableCompTableGetInfo(Int16 cardIndex, ref Int16 pTableNum, ref Int32 pTableSize);
  2421. #endregion
  2422. ///@defgroup AxPrfComp AxPrfComp
  2423. ///@brief 轴规划补偿功能
  2424. #region AxPrfComp
  2425. /// @brief 设置轴规划补偿
  2426. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetAxCompPos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2427. public static extern UInt32 IMC_SetAxCompPos(Int16 cardIndex, Int16 axNo, double compPos, double compTime, Int16 posType);
  2428. /// @brief 获取轴规划补偿状态
  2429. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetAxCompSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2430. public static extern UInt32 IMC_GetAxCompSts(Int16 cardIndex, Int16 axNo, ref Int16 pSts, ref double pCompPos);
  2431. #endregion
  2432. #endregion
  2433. ///@defgroup Virtual Resource
  2434. ///@brief 板卡虚拟功能
  2435. #region VirtualResource
  2436. ///@defgroup UserVal
  2437. ///@brief 全局变量功能
  2438. #region UserVal
  2439. /// @brief 设置全局变量
  2440. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetUserVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2441. public static extern UInt32 IMC_SetUserVal(Int16 cardIndex, Int16 index, Int32 value);
  2442. /// @brief 读取全局变量
  2443. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetUserVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2444. public static extern UInt32 IMC_GetUserVal(Int16 cardIndex, Int16 index, ref Int32 pValue);
  2445. #endregion
  2446. #endregion
  2447. ///@defgroup Sample Sample
  2448. ///@brief 板卡采样功能相关接口
  2449. #region Sample
  2450. /// @brief 配置数据采集的参数
  2451. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ConfigSamplePara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2452. public static extern UInt32 IMC_ConfigSamplePara(Int16 cardIndex, ref TSamplePara pSamplePara);
  2453. /// @brief 配置数据采集的采集对象
  2454. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ConfigSampleData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2455. public static extern UInt32 IMC_ConfigSampleData(Int16 cardIndex, Int16 count, Int16[] pDataTypeArray, Int32[] pDataIndexArray);
  2456. /// @brief 使能数据采集
  2457. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ConfigSampleEnable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2458. public static extern UInt32 IMC_ConfigSampleEnable(Int16 cardIndex, Int16 enable);
  2459. /// @brief 获取数据采集的状态
  2460. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetSampleStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2461. public static extern UInt32 IMC_GetSampleStatus(Int16 cardIndex, ref Int16 pStatus, ref Int32 pLen, ref Int32 pLeakageCount);
  2462. /// @brief 获取数据采集的速度
  2463. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetSampleData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2464. public static extern UInt32 IMC_GetSampleData(Int16 cardIndex, ref Int16 pPackNum, Int16[] pDataArray);
  2465. #endregion
  2466. ///@defgroup MultiAxCmp MultiAxCmp
  2467. ///@brief 板卡多轴位置比较功能相关接口
  2468. #region MultiAxCmp
  2469. /// @brief 配置多轴比较输入源
  2470. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiAxCmpSrcCfg", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2471. public static extern UInt32 IMC_MultiAxCmpSrcCfg(Int16 cardIndex, Int16 groupNo, Int16 cmpDimNum, Int16 cmpSrcType, Int16[] pCmpSrcArray, Int32 errorLmt);
  2472. /// @brief 使能多轴比较
  2473. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiAxCmpEnable", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2474. public static extern UInt32 IMC_MultiAxCmpEnable(Int16 cardIndex, Int16 groupNo, Int16 enable);
  2475. /// @brief 压入多轴比较数据
  2476. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiAxCmpPushData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2477. public static extern UInt32 IMC_MultiAxCmpPushData(Int16 cardIndex, Int16 groupNo, Int16 cmpDimNum, Int16 eventIndex, Int32[] pCmpPosArray, ref Int16 pSpace);
  2478. /// @brief 清除多轴比较缓冲区数据
  2479. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiAxCmpClrData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2480. public static extern UInt32 IMC_MultiAxCmpClrData(Int16 cardIndex, Int16 groupNo);
  2481. /// @brief 获取多轴比较剩余空间
  2482. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiAxCmpGetSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2483. public static extern UInt32 IMC_MultiAxCmpGetSpace(Int16 cardIndex, Int16 groupNo, ref Int16 pSpace);
  2484. /// @brief 获取多轴比较状态
  2485. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_MultiAxCmpGetSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2486. public static extern UInt32 IMC_MultiAxCmpGetSts(Int16 cardIndex, Int16 groupNo, ref Int16 pStatus, ref Int16 pCmpCnt, ref Int16 pCmpIndex);
  2487. #endregion
  2488. ///@defgroup PLC PLC
  2489. ///@brief 板卡PLC功能相关接口
  2490. #region PLC
  2491. /// @brief 编译参数结构体
  2492. [StructLayout(LayoutKind.Sequential)]
  2493. public struct TCompileInfo
  2494. {
  2495. public IntPtr pFileName;
  2496. public IntPtr pLineNo;
  2497. public IntPtr pMessage;
  2498. };
  2499. /// @brief 编译参数结构体
  2500. [StructLayout(LayoutKind.Sequential)]
  2501. public struct TVarInfo
  2502. {
  2503. public Int16 id;
  2504. public Int16 dataType;
  2505. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
  2506. public char[] name;
  2507. //public string name;
  2508. };
  2509. /// @brief 状态参数结构体
  2510. [StructLayout(LayoutKind.Sequential)]
  2511. public struct TThreadSts
  2512. {
  2513. public Int16 run;
  2514. public Int16 error;
  2515. public double result;
  2516. public Int16 line;
  2517. };
  2518. [StructLayout(LayoutKind.Sequential)]
  2519. public struct TBindDi
  2520. {
  2521. public Int16 diType;
  2522. public Int16 index; //绑定索引从1 开始
  2523. public Int16 reverse;
  2524. };
  2525. [StructLayout(LayoutKind.Sequential)]
  2526. public struct TBindDo
  2527. {
  2528. public Int16 doType;
  2529. public Int16 index; //绑定索引从1 开始
  2530. public Int16 reverse;
  2531. };
  2532. [StructLayout(LayoutKind.Sequential)]
  2533. public struct TBindTimer
  2534. {
  2535. public Int16 timerType; // 0 TT 1:TF 2:TTF
  2536. public Int32 delay; // 单位:ms
  2537. public Int16 inputVarId; //输入控制变量
  2538. };
  2539. [StructLayout(LayoutKind.Sequential)]
  2540. public struct TBindCounter
  2541. {
  2542. public Int16 counterType; //计数器类型:0-等于输出1 1-小于等于输出1 2-大于等于输出1
  2543. public Int16 edge; //计数沿: 0-上升沿 1-下降沿 2-双边沿
  2544. public Int32 init; //计数初值:复位变量为1时,内部计数恢复初值,(起点,终点)
  2545. public Int32 target; //计数器目标值
  2546. public Int32 begin; //计数器起点
  2547. public Int32 end; //计数器终点
  2548. public Int16 dir; //计数方向: 1-正向计数 -1-负向计数
  2549. public Int32 unit; //计数单位:计数器累加1次需要输入端出现边沿的次数
  2550. public Int16 inputVarId; //计数器输入变量
  2551. public Int16 resetVarId; //计数器复位变量
  2552. };
  2553. [StructLayout(LayoutKind.Sequential)]
  2554. public struct TBindFlank
  2555. {
  2556. public Int16 flankType; //边沿触发器类型:0-下降沿触发 1-上升沿触发 2-双边沿触发
  2557. public Int16 inputVarId; //边沿触发器输入变量,触发后保持到执行周期结束
  2558. };
  2559. [StructLayout(LayoutKind.Sequential)]
  2560. public struct TBindSrff
  2561. {
  2562. public Int16 setVarId; //置位变量 置位为1,输出1
  2563. public Int16 resetVarId; //复位变量 复位为1,置位为0,输出0
  2564. };
  2565. /// @brief 编译
  2566. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_Compile", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2567. public static extern UInt32 IMC_Compile(string pFileName, ref TCompileInfo pWrongInfo);
  2568. /// @brief 下载
  2569. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_Download", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2570. public static extern UInt32 IMC_Download(Int16 cardIndex, string pFileName);
  2571. /// @brief 获取函数id
  2572. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetFunId", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2573. public static extern UInt32 IMC_GetFunId(Int16 cardIndex, string pFunName, ref Int16 pFunId);
  2574. /// @brief 获取变量id
  2575. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetVarId", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2576. public static extern UInt32 IMC_GetVarId(Int16 cardIndex, string pFunName, string pVarName, ref TVarInfo pVarInfo);
  2577. /// @brief 绑定线程
  2578. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_Bind", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2579. public static extern UInt32 IMC_Bind(Int16 cardIndex, Int16 thread, Int16 funId, Int16 page);
  2580. /// @brief 运行线程
  2581. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_RunThread", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2582. public static extern UInt32 IMC_RunThread(Int16 cardIndex, Int16 thread);
  2583. /// @brief 按周期运行线程
  2584. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_RunThreadPeriod", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2585. public static extern UInt32 IMC_RunThreadPeriod(Int16 cardIndex, Int16 thread, Int16 period, Int16 priority);
  2586. /// @brief 按断点运行线程
  2587. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_RunThreadToBreakpoint", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2588. public static extern UInt32 IMC_RunThreadToBreakpoint(Int16 cardIndex, Int16 thread, Int16 line);
  2589. /// @brief 单步运行线程
  2590. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StepThread", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2591. public static extern UInt32 IMC_StepThread(Int16 cardIndex, Int16 thread);
  2592. /// @brief 停止线程
  2593. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_StopThread", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2594. public static extern UInt32 IMC_StopThread(Int16 cardIndex, Int16 thread);
  2595. /// @brief 暂停线程
  2596. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_PauseThread", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2597. public static extern UInt32 IMC_PauseThread(Int16 cardIndex, Int16 thread);
  2598. /// @brief 获取线程状态
  2599. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetThreadSts", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2600. public static extern UInt32 IMC_GetThreadSts(Int16 cardIndex, Int16 thread, ref TThreadSts pThreadSts);
  2601. /// @brief 获取线程运行周期
  2602. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetThreadTime", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2603. public static extern UInt32 IMC_GetThreadTime(Int16 cardIndex, Int16 thread, ref Int16 pPeriod, ref UInt32 pExecuteTime, ref UInt32 pExecuteTimeMax);
  2604. /// @brief 获取线程运行时间
  2605. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetThreadRunTime", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2606. public static extern UInt32 IMC_GetThreadRunTime(Int16 cardIndex, Int16 thread, ref UInt32 pExecuteTime, ref UInt32 pExecuteTimeMax);
  2607. /// @brief 设置变量值
  2608. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetVarValue", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2609. public static extern UInt32 IMC_SetVarValue(Int16 cardIndex, Int16 page, ref TVarInfo pVarInfo, double[] pValue, Int16 count);
  2610. /// @brief 获取变量值
  2611. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetVarValue", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2612. public static extern UInt32 IMC_GetVarValue(Int16 cardIndex, Int16 page, ref TVarInfo pVarInfo, double[] pValue, Int16 count);
  2613. /// @brief 解除绑定
  2614. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_UnbindVar", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2615. public static extern UInt32 IMC_UnbindVar(Int16 cardIndex, Int16 thread);
  2616. /// @brief 绑定DI
  2617. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_BindDi", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2618. public static extern UInt32 IMC_BindDi(Int16 cardIndex, Int16 thread, ref TVarInfo pVarInfo, ref TBindDi pBindDi);
  2619. /// @brief 绑定DO
  2620. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_BindDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2621. public static extern UInt32 IMC_BindDo(Int16 cardIndex, Int16 thread, ref TVarInfo pVarInfo, ref TBindDo pBindDo);
  2622. /// @brief 绑定Timer
  2623. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_BindTimer", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2624. public static extern UInt32 IMC_BindTimer(Int16 cardIndex, Int16 thread, ref TVarInfo pVarInfo, ref TBindTimer pBindTimer);
  2625. /// @brief 绑定计数器
  2626. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_BindCounter", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2627. public static extern UInt32 IMC_BindCounter(Int16 cardIndex, Int16 thread, ref TVarInfo pVarInfo, ref TBindCounter pBindCounter);
  2628. /// @brief 绑定触发器Flank
  2629. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_BindFlank", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2630. public static extern UInt32 IMC_BindFlank(Int16 cardIndex, Int16 thread, ref TVarInfo pVarInfo, ref TBindFlank pBindFlank);
  2631. /// @brief 绑定置位器
  2632. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_BindSrff", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2633. public static extern UInt32 IMC_BindSrff(Int16 cardIndex, Int16 thread, ref TVarInfo pVarInfo, ref TBindSrff pBindSrff);
  2634. /// @brief 获取绑定DI输入状态
  2635. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindDi", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2636. public static extern UInt32 IMC_GetBindDi(Int16 cardIndex, ref TVarInfo pVarInfo, ref TBindDi pBindDi);
  2637. /// @brief 获取绑定DO输出状态
  2638. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2639. public static extern UInt32 IMC_GetBindDo(Int16 cardIndex, ref TVarInfo pVarInfo, ref TBindDo pBindDo);
  2640. /// @brief 获取绑定Timer输出状态
  2641. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindTimer", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2642. public static extern UInt32 IMC_GetBindTimer(Int16 cardIndex, ref TVarInfo pVarInfo, ref TBindTimer pBindTimer, ref Int32 pCount);
  2643. /// @brief 获取绑定计数器输出状态
  2644. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindCounter", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2645. public static extern UInt32 IMC_GetBindCounter(Int16 cardIndex, ref TVarInfo pVarInfo, ref TBindCounter pBindCounter, ref Int32 pUnitCount, ref Int32 pCount);
  2646. /// @brief 获取绑定触发器Flank输出状态
  2647. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindFlank", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2648. public static extern UInt32 IMC_GetBindFlank(Int16 cardIndex, ref TVarInfo pVarInfo, ref TBindFlank pBindFlank);
  2649. /// @brief 获取绑定置位器Srff输出状态
  2650. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindSrff", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2651. public static extern UInt32 IMC_GetBindSrff(Int16 cardIndex, ref TVarInfo pVarInfo, ref TBindSrff pBindSrff);
  2652. /// @brief 获取绑定Di数量
  2653. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindDiCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2654. public static extern UInt32 IMC_GetBindDiCount(Int16 cardIndex, Int16 thread, ref Int16 pCount);
  2655. /// @brief 获取绑定Do数量
  2656. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindDoCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2657. public static extern UInt32 IMC_GetBindDoCount(Int16 cardIndex, Int16 thread, ref Int16 pCount);
  2658. /// @brief 获取绑定Timer数量
  2659. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindTimerCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2660. public static extern UInt32 IMC_GetBindTimerCount(Int16 cardIndex, Int16 thread, ref Int16 pCount);
  2661. /// @brief 获取绑定Counter数量
  2662. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindCounterCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2663. public static extern UInt32 IMC_GetBindCounterCount(Int16 cardIndex, Int16 thread, ref Int16 pCount);
  2664. /// @brief 获取绑定Flank数量
  2665. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindFlankCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2666. public static extern UInt32 IMC_GetBindFlankCount(Int16 cardIndex, Int16 thread, ref Int16 pCount);
  2667. /// @brief 获取绑定Srff数量
  2668. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindSrffCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2669. public static extern UInt32 IMC_GetBindSrffCount(Int16 cardIndex, Int16 thread, ref Int16 pCount);
  2670. /// @brief 获取绑定DI信息
  2671. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindDiInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2672. public static extern UInt32 IMC_GetBindDiInfo(Int16 cardIndex, Int16 thread, Int16 index, ref Int16 pVar, ref TBindDi pBindDi);
  2673. /// @brief 获取绑定DO信息
  2674. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindDoInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2675. public static extern UInt32 IMC_GetBindDoInfo(Int16 cardIndex, Int16 thread, Int16 index, ref Int16 pVar, ref TBindDo pBindDo);
  2676. /// @brief 获取绑定Timer信息
  2677. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindTimerInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2678. public static extern UInt32 IMC_GetBindTimerInfo(Int16 cardIndex, Int16 thread, Int16 index, ref Int16 pVar, ref TBindTimer pBindTimer);
  2679. /// @brief 获取绑定计数器信息
  2680. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindCounterInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2681. public static extern UInt32 IMC_GetBindCounterInfo(Int16 cardIndex, Int16 thread, Int16 index, ref Int16 pVar, ref TBindCounter pBindCounter);
  2682. /// @brief 获取绑定触发器Flank信息
  2683. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindFlankInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2684. public static extern UInt32 IMC_GetBindFlankInfo(Int16 cardIndex, Int16 thread, Int16 index, ref Int16 pVar, ref TBindFlank pBindFlank);
  2685. /// @brief 获取绑定置位器Srff信息
  2686. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetBindSrffInfo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2687. public static extern UInt32 IMC_GetBindSrffInfo(Int16 cardIndex, Int16 thread, Int16 index, ref Int16 pVar, ref TBindSrff pBindSrff);
  2688. #endregion
  2689. ///@defgroup PulseDO PulseDO
  2690. ///@brief 板卡脉冲DO输出功能相关接口
  2691. #region PulseDO
  2692. /// @brief 设置脉冲DO输出映射
  2693. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetPulseDoMap", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2694. public static extern UInt32 IMC_SetPulseDoMap(Int16 cardIndex, Int16 index, Int16 doIndex);
  2695. /// @brief 获取脉冲DO输出映射
  2696. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPulseDoMap", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2697. public static extern UInt32 IMC_GetPulseDoMap(Int16 cardIndex, Int16 index, ref Int16 pDoIndex);
  2698. /// @brief 设置脉冲DO输出通道参数
  2699. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetPulseDoOutputParam", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2700. public static extern UInt32 IMC_SetPulseDoOutputParam(Int16 cardIndex, Int16 index, UInt16 highLevelTime, UInt16 lowLevTime, Int16 firstLevel, Int16 pulseNum);
  2701. /// @brief 使能脉冲DO输出
  2702. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_EnablePulseDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2703. public static extern UInt32 IMC_EnablePulseDo(Int16 cardIndex, Int16 index, UInt16 highLevelTime, UInt16 lowLevTime, Int16 firstLevel, Int16 pulseNum);
  2704. /// @brief 停止脉冲DO输出
  2705. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_DisablePulseDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2706. public static extern UInt32 IMC_DisablePulseDo(Int16 cardIndex, Int16 index);
  2707. /// @brief 获取脉冲DO输出状态
  2708. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetPulseDoStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2709. public static extern UInt32 IMC_GetPulseDoStatus(Int16 cardIndex, Int16 index, ref Int16 pStatus);
  2710. #endregion
  2711. ///@defgroup Event Event
  2712. ///@brief 板卡事件功能相关接口
  2713. #region Event
  2714. /// @brief 设置事件
  2715. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEvent", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2716. public static extern UInt32 IMC_SetEvent(Int16 cardIndex, Int16 eventIndex, ref TEvent pEvent);
  2717. /// @brief 设置任务
  2718. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetTask", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2719. public static extern UInt32 IMC_SetTask(Int16 cardIndex, Int16 taskIndex, Int16 taskType, IntPtr pTask);
  2720. /// @brief 设置事件与任务连接
  2721. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_SetEventTaskLink", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2722. public static extern UInt32 IMC_SetEventTaskLink(Int16 cardIndex, Int16 eventIndex, Int16[] taskIndexArray, Int16 count);
  2723. /// @brief 事件开启
  2724. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_EventOn", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2725. public static extern UInt32 IMC_EventOn(Int16 cardIndex, Int16 eventIndex, Int16 count = 1);
  2726. /// @brief 事件关闭
  2727. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_EventOff", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2728. public static extern UInt32 IMC_EventOff(Int16 cardIndex, Int16 eventIndex, Int16 count = 1);
  2729. /// @brief 事件强制触发
  2730. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_EventForceTrigger", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2731. public static extern UInt32 IMC_EventForceTrigger(Int16 cardIndex, Int16 eventIndex, Int16 count = 1);
  2732. /// @brief 清除事件
  2733. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ClearEvent", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2734. public static extern UInt32 IMC_ClearEvent(Int16 cardIndex, Int16 eventIndex, Int16 count = 1);
  2735. /// @brief 清除任务
  2736. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ClearTask", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2737. public static extern UInt32 IMC_ClearTask(Int16 cardIndex, Int16 taskIndex, Int16 count = 1);
  2738. /// @brief 清除事件与任务的连接
  2739. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_ClearEventTaskLink", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2740. public static extern UInt32 IMC_ClearEventTaskLink(Int16 cardIndex, Int16 eventIndex, Int16 count = 1);
  2741. /// @brief 获取设置的事件数量
  2742. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEventCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2743. public static extern UInt32 IMC_GetEventCount(Int16 cardIndex, ref Int16 pCount);
  2744. /// @brief 获取设置的事件
  2745. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEvent", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2746. public static extern UInt32 IMC_GetEvent(Int16 cardIndex, Int16 eventIndex, ref TEvent pEvent);
  2747. /// @brief 获取事件的触发次数
  2748. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEventTriggerCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2749. public static extern UInt32 IMC_GetEventTriggerCount(Int16 cardIndex, Int16 eventIndex, ref Int16 pTriggerCount);
  2750. /// @brief 获取设置的任务数量
  2751. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetTaskCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2752. public static extern UInt32 IMC_GetTaskCount(Int16 cardIndex, ref Int16 pCount);
  2753. /// @brief 获取任务
  2754. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetTask", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2755. public static extern UInt32 IMC_GetTask(Int16 cardIndex, Int16 taskIndex, ref Int16 pTaskType, IntPtr pTaskData);
  2756. /// @brief 获取设置的事件与任务连接数量
  2757. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetEventTaskLinkCount", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2758. public static extern UInt32 IMC_GetEventTaskLinkCount(Int16 cardIndex, Int16 eventIndex, ref Int16 pCount);
  2759. /// @brief 获取任务执行结果
  2760. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_GetTaskResult", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2761. public static extern UInt32 IMC_GetTaskResult(Int16 cardIndex, Int16 taskIndex, ref Int16 pResult);
  2762. #endregion
  2763. ///@defgroup CmdList CmdList
  2764. ///@brief 板卡指令缓存输出功能相关接口
  2765. #region CmdList
  2766. /// @brief 启动缓存区指令执行
  2767. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListStart", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2768. public static extern UInt32 IMC_CmdListStart(Int16 cardIndex, Int16 index, Int16 type);
  2769. /// @brief 停止指令缓存区执行
  2770. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListStop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2771. public static extern UInt32 IMC_CmdListStop(Int16 cardIndex, Int16 index);
  2772. /// @brief 设置指令缓存区运行模式
  2773. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListSetMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2774. public static extern UInt32 IMC_CmdListSetMode(Int16 cardIndex, Int16 index, Int16 mode);
  2775. /// @brief 获取指令缓存区运行模式
  2776. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListGetMode", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2777. public static extern UInt32 IMC_CmdListGetMode(Int16 cardIndex, Int16 index, ref Int16 mode);
  2778. /// @brief 获取指令缓存区运行状态、错误码和当前执行段号
  2779. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListGetStatus", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2780. public static extern UInt32 IMC_CmdListGetStatus(Int16 cardIndex, Int16 index, ref Int16 pStatus, ref Int16 pErrorCode, ref Int32 pCurrentId);
  2781. /// @brief 获取指令缓存区剩余空间
  2782. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListGetSpace", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2783. public static extern UInt32 IMC_CmdListGetSpace(Int16 cardIndex, Int16 index, ref Int16 pSpace);
  2784. /// @brief 清除指令缓存区数据
  2785. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListClearData", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2786. public static extern UInt32 IMC_CmdListClearData(Int16 cardIndex, Int16 index);
  2787. /// @brief 清除指令缓存区错误
  2788. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListClearError", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2789. public static extern UInt32 IMC_CmdListClearError(Int16 cardIndex, Int16 index);
  2790. /// @brief 设置指令缓存区循环执行次数
  2791. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListSetLoop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2792. public static extern UInt32 IMC_CmdListSetLoop(Int16 cardIndex, Int16 index, Int32 setCount);
  2793. /// @brief 获取指令缓存区循环执行次数
  2794. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListGetLoop", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2795. public static extern UInt32 IMC_CmdListGetLoop(Int16 cardIndex, Int16 index, ref Int32 setCount, ref Int32 doneCount);
  2796. /// @brief 缓存区运动指令,执行轴PTP运动
  2797. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListAxMove", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2798. public static extern UInt32 IMC_CmdListAxMove(Int16 cardIndex, Int16 index, Int16 axNo, double tgtPos, Int32 userID);
  2799. /// @brief 缓存区运动指令,在线更新ptp运动目标位置
  2800. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListUpdateAxMovePos", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2801. public static extern UInt32 IMC_CmdListUpdateAxMovePos(Int16 cardIndex, Int16 index, Int16 axNo, double tgtPos, Int32 userID);
  2802. /// @brief 缓存区运动指令,在线更新轴运动速度参数
  2803. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListUpdateAxMovePara", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2804. public static extern UInt32 IMC_CmdListUpdateAxMovePara(Int16 cardIndex, Int16 index, Int16 axNo, double tgtVel, double tgtAcc, double tgtDec, Int32 userID);
  2805. /// @brief 缓存区运动指令,执行轴ptp运动,目标位置来源为全局变量值
  2806. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListAxMoveUserVar", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2807. public static extern UInt32 IMC_CmdListAxMoveUserVar(Int16 cardIndex, Int16 index, Int16 axNo, Int16 eventIndex, Int32 userID);
  2808. /// @brief 缓存区等待指令,延时等待一段时间
  2809. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListWaitTime", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2810. public static extern UInt32 IMC_CmdListWaitTime(Int16 cardIndex, Int16 index, Int16 waitTime, Int32 userID);
  2811. /// @brief 缓存区等待指令,等待DI触发
  2812. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListWaitDi", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2813. public static extern UInt32 IMC_CmdListWaitDi(Int16 cardIndex, Int16 index, Int16 diNo, Int16 diLevel, Int16 diType, Int32 userID);
  2814. /// @brief 缓存区等待指令,等待轴运动到位
  2815. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListWaitAxMoveDone", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2816. public static extern UInt32 IMC_CmdListWaitAxMoveDone(Int16 cardIndex, Int16 index, Int16 axNo, Int16 arrvType, Int32 userID);
  2817. /// @brief 缓存区等待指令,等待轴位置穿越位置
  2818. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListWaitAxPosCross", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2819. public static extern UInt32 IMC_CmdListWaitAxPosCross(Int16 cardIndex, Int16 index, Int16 axNo, Int32 Pos, Int16 crossType, Int32 userID);
  2820. /// @brief 缓存区等待指令,等待全局变量值
  2821. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListWaitUserVar", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2822. public static extern UInt32 IMC_CmdListWaitUserVar(Int16 cardIndex, Int16 index, Int16 varIndex, Int32 varValue, Int32 userID);
  2823. /// @brief 缓存区等待指令,等待事件执行完成
  2824. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListWaitEventDone", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2825. public static extern UInt32 IMC_CmdListWaitEventDone(Int16 cardIndex, Int16 index, Int16 eventIndex, Int32 userID);
  2826. /// @brief 缓存区设置指令,设置DO输出
  2827. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListSetDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2828. public static extern UInt32 IMC_CmdListSetDo(Int16 cardIndex, Int16 index, Int16 doNo, Int16 doLevel, Int16 doType, Int32 userID);
  2829. /// @brief 缓存区设置指令,设置脉冲DO输出
  2830. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListSetPulseDo", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2831. public static extern UInt32 IMC_CmdListSetPulseDo(Int16 cardIndex, Int16 index, Int16 outIndex, Int32 userID);
  2832. /// @brief 缓存区设置指令,设置事件启动
  2833. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListSetUserVal", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2834. public static extern UInt32 IMC_CmdListSetUserVal(Int16 cardIndex, Int16 index, Int16 varIndex, Int32 varValue, Int32 userID);
  2835. /// @brief 缓存区设置指令,设置全局变量值
  2836. [DllImport(Imc60ApiDllName, EntryPoint = "IMC_CmdListSetEventTrigger", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
  2837. public static extern UInt32 IMC_CmdListSetEventTrigger(Int16 cardIndex, Int16 index, Int16 eventIndex, Int32 userID);
  2838. #endregion
  2839. }
  2840. }