| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414 |
- // ***********************************************************************
- // Module : ModbusRTUHelper for C#
- // Author : Lei Youbing
- // Created : 12-27-2017
- //
- // Last Modified By : Lei Youbing
- // Last Modified On : 2020-08-18
- // ***********************************************************************
- // Copyright (c) Shanghai AMP & MOONS' Automation Co., Ltd.. All rights reserved.
- // ***********************************************************************
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace SHJX.Service.ServerClient.Modbus
- {
- public delegate void CSCallback();
- public struct StructRegisterValue
- {
- public int Count;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2048)]
- public int[] Values;
- };
- public struct StructCommand
- {
- public int Count;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4096)]
- public byte[] Values;
- };
- public struct ErrorInfo
- {
- public int ErrorCode;
- public string Command;
- public string ErrorMessage;
- }
- public enum SCLCommandEncodingTable
- {
- AlarmReset = 0xBA,
- StartJogging = 0x96,
- StopJogging = 0xD8,
- EncoderFunction = 0xD6,
- EncoderPosition = 0x98,
- FeedtoDoubleSensor = 0x69,
- FollowEncoder = 0xCC,
- FeedtoLength = 0x66,
- FeedtoSensorwithMaskDistance = 0x6A,
- FeedandSetOutput = 0x68,
- FeedtoPosition = 0x67,
- FeedtoSensor = 0x6B,
- FeedtoSensorwithSafetyDistance = 0x6C,
- JogDisable = 0xA3,
- JogEnable = 0xA2,
- MotorDisable = 0x9E,
- MotorEnable = 0x9F,
- SeekHome = 0x6E,
- SetPosition = 0xA5,
- FilterInput = 0xC0,
- FilterSelectInputs = 0xD3,
- StepFilterFreq = 0x06,
- WriteAnalogDeadband = 0xD2,
- WriteAlarmResetInput = 0x46,
- WriteAlarmOutput = 0x47,
- WriteAnalogScaling = 0xD1,
- WriteDefineLimits = 0x42,
- SetOutput = 0x8B,
- WriteWaitforInput = 0x70,
- QueueLoadAndExecute = 0x78,
- WriteWaitTime = 0x6F,
- StopAndKill = 0xE1,
- StopAndKillWithNormalDecel = 0xE2,
- }
- public class ModbusRTU
- {
- //if (Environment.Is64BitOperatingSystem)
- //? "Resources/ModbusRTU_x86.dll" :
- private const string DLL_FILENAME = "Lib/ModbusRTU_x86.dll"; // for 64-bit windows, please comment this line and uncomment next line
- //private const string DLL_FILENAME = "ModbusRTU_x64.dll"; // for 32-bit windows,, please comment this line and uncomment previous line
- private byte m_COMPort = 1;
- public byte COMPort
- {
- get
- {
- return m_COMPort;
- }
- }
- #region public fields
- //standard specific
- public int MBERROR_ILLEGAL_FUNCTION = 0x01;
- public int MBERROR_ILLEGAL_DATA_ADDRESS = 0x02;
- public int MBERROR_ILLEGAL_DATA_VALUE = 0x03;
- public int MBERROR_SLAVE_DEVICE_FAILURE = 0x04;
- public int MBERROR_ACKNOWLEDGE = 0x05;
- public int MBERROR_SLAVE_DEVICE_BUSY = 0x06;
- public int MBERROR_NEGATIVE_ACKNOWLEDGE = 0x07;
- public int MBERROR_MEMORY_PARITY_ERROR = 0x08;
- public int MBERROR_GATEWAY_PATH_UNAVAILABLE = 0x0A;
- public int MBERROR_GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND = 0x0B;
- //manufacture specific
- public int MBERROR_CAN_NOT_READ = 0x11;
- public int MBERROR_CAN_NOT_WRITE = 0x12;
- public int MBERROR_DATA_RANG = 0x13;
- //other
- public int MBERROR_FAIL_TO_OPEN_PORT = 0x100;
- public int MBERROR_PORT_IS_CLOSED = 0x101;
- public int MBERROR_SEND_FAILED = 0x102;
- public int MBERROR_THREAD_ERROR = 0x103;
- public int MBERROR_NO_RESPONSE = 0x104;
- public int MBERROR_DATA_NOT_ENOUGH = 0x105;
- public int MBERROR_CRC_ERROR = 0x106;
- public int MBERROR_SCLREGISTER_NOTFOUND = 0x107;
- public int MBERROR_UNKNOWN_EXCEPTION = 0xFFFF;
- #endregion
- #region DllImport
- // Trigger when send data to drive
- [DllImport(DLL_FILENAME, EntryPoint = "OnDataSend", CharSet = CharSet.Auto)]
- private static extern void _OnDataSend(CSCallback func);
- // Trigger when received data from drive
- [DllImport(DLL_FILENAME, EntryPoint = "OnDataReceive", CharSet = CharSet.Auto)]
- private static extern void _OnDataReceive(CSCallback func);
- // Get the port is open or closed
- [DllImport(DLL_FILENAME, EntryPoint = "IsOpen", CharSet = CharSet.Auto)]
- private static extern bool _IsOpen(byte nCOMPort);
- // Open serial port communication
- [DllImport(DLL_FILENAME, EntryPoint = "Open", CharSet = CharSet.Auto)]
- private static extern bool _Open(byte nCOMPort, int nBaudRate, bool bBigEndian);
- // Close serial port communication
- [DllImport(DLL_FILENAME, EntryPoint = "Close", CharSet = CharSet.Auto)]
- private static extern bool _Close(byte nCOMPort);
- // Set endian type
- [DllImport(DLL_FILENAME, EntryPoint = "SetEndianType", CharSet = CharSet.Auto)]
- private static extern void _SetEndianType(byte nCOMPort, bool bBigEndian);
- // Return it is big endian type or not
- [DllImport(DLL_FILENAME, EntryPoint = "IsBigEndian", CharSet = CharSet.Auto)]
- private static extern bool _IsBigEndian(byte nCOMPort);
- // Get execute time out
- [DllImport(DLL_FILENAME, EntryPoint = "GetExecuteTimeOut", CharSet = CharSet.Auto)]
- private static extern uint _GetExecuteTimeOut(byte nCOMPort);
- // Set execute time out
- [DllImport(DLL_FILENAME, EntryPoint = "SetExecuteTimeOut", CharSet = CharSet.Auto)]
- private static extern void _SetExecuteTimeOut(byte nCOMPort, uint nExecuteTimeOut);
- // Set it will trigger send event or not when sending command
- [DllImport(DLL_FILENAME, EntryPoint = "SetTriggerSendEvent", CharSet = CharSet.Auto)]
- private static extern void _SetTriggerSendEvent(bool bTriggerSendEvent);
- // Set it will trigger received event or not when receive data
- [DllImport(DLL_FILENAME, EntryPoint = "SetTriggerReceiveEvent", CharSet = CharSet.Auto)]
- private static extern void _SetTriggerReceiveEvent(bool bTriggerReceiveEvent);
- // Clear send buffer
- [DllImport(DLL_FILENAME, EntryPoint = "ClearSendBuffer", CharSet = CharSet.Auto)]
- private static extern void _ClearSendBuffer(byte nCOMPort);
- // Clear received buffer
- [DllImport(DLL_FILENAME, EntryPoint = "ClearReceivedBuffer", CharSet = CharSet.Auto)]
- private static extern void _ClearReceivedBuffer(byte nCOMPort);
- // Clear send and received Buffer
- [DllImport(DLL_FILENAME, EntryPoint = "ClearBuffer", CharSet = CharSet.Auto)]
- private static extern void _ClearBuffer(byte nCOMPort);
- // Get last error information, includes code and description
- [DllImport(DLL_FILENAME, EntryPoint = "GetLastErrorInfo", CharSet = CharSet.Ansi)]
- private static extern void _GetLastErrorInfo(ref ErrorInfo errorInfo);
- // Get the last command that send
- [DllImport(DLL_FILENAME, EntryPoint = "GetLastCommandSent", CharSet = CharSet.Auto)]
- private static extern bool _GetLastCommandSent(byte nCOMPort, IntPtr ptrCommandStu);
- // Get the last command that received
- [DllImport(DLL_FILENAME, EntryPoint = "GetLastCommandReceived", CharSet = CharSet.Auto)]
- private static extern bool _GetLastCommandReceived(byte nCOMPort, IntPtr ptrCommandStu);
- // Read single holding register from the drive
- [DllImport(DLL_FILENAME, EntryPoint = "ReadSingleHoldingRegister", CharSet = CharSet.Auto)]
- private static extern bool _ReadSingleHoldingRegister(byte nCOMPort, byte nNodeID, int registerNo, ref int value);
- // Write single holding register value to the drive
- [DllImport(DLL_FILENAME, EntryPoint = "WriteSingleHoldingRegister", CharSet = CharSet.Auto)]
- private static extern bool _WriteSingleHoldingRegister(byte nCOMPort, byte nNodeID, int registerNo, int value);
- // Read multiple holding register from the drive
- [DllImport(DLL_FILENAME, EntryPoint = "ReadMultiHoldingRegisters", CharSet = CharSet.Auto)]
- private static extern bool _ReadMultiHoldingRegisters(byte nCOMPort, byte nNodeID, int registerNo, int count, IntPtr ptrHoldingRegisterStu);
- // Write multiple holding register values to the drive
- [DllImport(DLL_FILENAME, EntryPoint = "WriteMultiHoldingRegisters", CharSet = CharSet.Auto)]
- private static extern bool _WriteMultiHoldingRegisters(byte nCOMPort, byte nNodeID, int registerNo, int count, [MarshalAs(UnmanagedType.LPArray, SizeConst = 100)] int[] valueList);
- // Read 16-bit int data from the drive
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDataInt16", CharSet = CharSet.Auto)]
- private static extern bool _ReadDataInt16(byte nCOMPort, byte nNodeID, int nRegisterNo, ref short nValue);
- // Write 16-bit int data to the drive
- [DllImport(DLL_FILENAME, EntryPoint = "WriteDataInt16", CharSet = CharSet.Auto)]
- private static extern bool _WriteDataInt16(byte nCOMPort, byte nNodeID, int nRegisterNo, short nValue);
- // Read 16-bit unsighed int data from the drive
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDataUInt16", CharSet = CharSet.Auto)]
- private static extern bool _ReadDataUInt16(byte nCOMPort, byte nNodeID, int nRegisterNo, ref ushort nValue);
- // Write 16-bit unsigned int data to the drive
- [DllImport(DLL_FILENAME, EntryPoint = "WriteDataUInt16", CharSet = CharSet.Auto)]
- private static extern bool _WriteDataUInt16(byte nCOMPort, byte nNodeID, int nRegisterNo, ushort nValue);
- // Read 32-bit int data from the drive
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDataInt32", CharSet = CharSet.Auto)]
- private static extern bool _ReadDataInt32(byte nCOMPort, byte nNodeID, int nRegisterNo, ref int nValue);
- // Write 32-bit int data to the drive
- [DllImport(DLL_FILENAME, EntryPoint = "WriteDataInt32", CharSet = CharSet.Auto)]
- private static extern bool _WriteDataInt32(byte nCOMPort, byte nNodeID, int nRegisterNo, int nValue);
- // Read 32-bit unsighed int data from the drive
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDataUInt32", CharSet = CharSet.Auto)]
- private static extern bool _ReadDataUInt32(byte nCOMPort, byte nNodeID, int nRegisterNo, ref uint nValue);
- // Write 32-bit unsigned int data to the drive
- [DllImport(DLL_FILENAME, EntryPoint = "WriteDataUInt32", CharSet = CharSet.Auto)]
- private static extern bool _WriteDataUInt32(byte nCOMPort, byte nNodeID, int nRegisterNo, uint nValue);
- // Execute command with opcode
- [DllImport(DLL_FILENAME, EntryPoint = "ExecuteCommandWithOpcode", CharSet = CharSet.Auto)]
- private static extern bool _ExecuteCommandWithOpcode(byte nCOMPort, byte nNodeID, int nOpCode, int nParam1, int nParam2, int nParam3, int nParam4, int nParam5);
- [DllImport(DLL_FILENAME, EntryPoint = "ExecuteSCLCommand", CharSet = CharSet.Ansi)]
- private static extern bool _ExecuteSCLCommand(byte nCOMPort, byte nNodeID, int registerNo, byte[] arrCommand, ref IntPtr ptrResponse);
- // Set P2P profile arguments
- [DllImport(DLL_FILENAME, EntryPoint = "SetP2PProfile", CharSet = CharSet.Auto)]
- private static extern bool _SetP2PProfile(byte nCOMPort, byte nNodeID, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- // Set Jog profile arguments
- [DllImport(DLL_FILENAME, EntryPoint = "SetJogProfile", CharSet = CharSet.Auto)]
- private static extern bool _SetJogProfile(byte nCOMPort, byte nNodeID, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- // Set the drive enabled or disabled
- [DllImport(DLL_FILENAME, EntryPoint = "DriveEnable", CharSet = CharSet.Auto)]
- private static extern bool _DriveEnable(byte nCOMPort, byte nNodeID, bool bEnable);
- // Reset drive's dlarm
- [DllImport(DLL_FILENAME, EntryPoint = "AlarmReset", CharSet = CharSet.Auto)]
- private static extern bool _AlarmReset(byte nCOMPort, byte nNodeID);
- // Launch feed to position move
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoPosition", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoPosition(byte nCOMPort, byte nNodeID, IntPtr nDistance);
- // Launch feed to length move
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoLength", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoLength(byte nCOMPort, byte nNodeID, IntPtr nDistance);
- [DllImport(DLL_FILENAME, EntryPoint = "AbsMove")]
- public static extern bool _AbsMove(byte nCOMPort, byte nNodeID, int nDistance, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- [DllImport(DLL_FILENAME, EntryPoint = "RelMove")]
- public static extern bool _RelMove(byte nCOMPort, byte nNodeID, int nDistance, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- // Launch feed to sensor move
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoSensor", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoSensor(byte nCOMPort, byte nNodeID, byte nInputSensor, char chInputStatus);
- // Lanuch feed to sensor move with safety distance
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoSensorwithSafetyDistance", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoSensorwithSafetyDistance(byte nCOMPort, byte nNodeID, byte nInputSensor, char chInputStatus);
- // Launch feed to double sensor move with mask distance
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoSensorwithMaskDistance", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoSensorwithMaskDistance(byte nCOMPort, byte nNodeID, byte nInputSensor, char chInputStatus);
- // Launch Point to Point Move and set output
- [DllImport(DLL_FILENAME, EntryPoint = "FeedandSetOutput", CharSet = CharSet.Auto)]
- private static extern bool _FeedandSetOutput(byte nCOMPort, byte nNodeID, byte nOutput, char chOutputStatus);
- // Launch feed to double sensor move
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoDoubleSensor", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoDoubleSensor(byte nCOMPort, byte nNodeID, byte nInput1, char chInputStatus1, byte nInput2, char chInputStatus2);
- // Launch follow encoder move
- [DllImport(DLL_FILENAME, EntryPoint = "FollowEncoder", CharSet = CharSet.Auto)]
- private static extern bool _FollowEncoder(byte nCOMPort, byte nNodeID, byte nInputSensor, char chInputStatus);
- // Commence Jogging
- [DllImport(DLL_FILENAME, EntryPoint = "StartJogging", CharSet = CharSet.Auto)]
- private static extern bool _StartJogging(byte nCOMPort, byte nNodeID);
- // Stop Jogging
- [DllImport(DLL_FILENAME, EntryPoint = "StopJogging", CharSet = CharSet.Auto)]
- private static extern bool _StopJogging(byte nCOMPort, byte nNodeID);
- // Set encoder function to the stepper drives with encoder feedback
- [DllImport(DLL_FILENAME, EntryPoint = "SetEncoderFunction", CharSet = CharSet.Auto)]
- private static extern bool _SetEncoderFunction(byte nCOMPort, byte nNodeID, byte nFunc);
- // Set encoder position
- [DllImport(DLL_FILENAME, EntryPoint = "SetEncoderPosition", CharSet = CharSet.Auto)]
- private static extern bool _SetEncoderPosition(byte nCOMPort, byte nNodeID, int nPosition);
- // Jog disable
- [DllImport(DLL_FILENAME, EntryPoint = "JogDisable", CharSet = CharSet.Auto)]
- private static extern bool _JogDisable(byte nCOMPort, byte nNodeID);
- // Jog enable
- [DllImport(DLL_FILENAME, EntryPoint = "JogEnable", CharSet = CharSet.Auto)]
- private static extern bool _JogEnable(byte nCOMPort, byte nNodeID);
- // Launch seek home move
- [DllImport(DLL_FILENAME, EntryPoint = "SeekHome", CharSet = CharSet.Auto)]
- private static extern bool _SeekHome(byte nCOMPort, byte nNodeID, byte nInputSensor, char chInputStatus);
- // Set position
- [DllImport(DLL_FILENAME, EntryPoint = "SetPosition", CharSet = CharSet.Auto)]
- private static extern bool _SetPosition(byte nCOMPort, byte nNodeID, int nPosition);
- // Set filter input
- [DllImport(DLL_FILENAME, EntryPoint = "SetFilterInput", CharSet = CharSet.Auto)]
- private static extern bool _SetFilterInput(byte nCOMPort, byte nNodeID, byte nInputSensor, int nFilterTime);
- // Write analog deadband
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogDeadband", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogDeadband(byte nCOMPort, byte nNodeID, byte nDeadband);
- // Set output of the drive
- [DllImport(DLL_FILENAME, EntryPoint = "SetOutput", CharSet = CharSet.Auto)]
- private static extern bool _SetOutput(byte nCOMPort, byte nNodeID, byte nOutput, char nCondition);
- // Write wait for input
- [DllImport(DLL_FILENAME, EntryPoint = "WriteWaitforInput", CharSet = CharSet.Auto)]
- private static extern bool _WriteWaitforInput(byte nCOMPort, byte nNodeID, byte nInputSensor, char nCondition);
- // Queue Load and Execute
- [DllImport(DLL_FILENAME, EntryPoint = "QueueLoadAndExecute", CharSet = CharSet.Auto)]
- private static extern bool _QueueLoadAndExecute(byte nCOMPort, byte nNodeID, byte nSegment);
- // Write wait time
- [DllImport(DLL_FILENAME, EntryPoint = "WriteWaitTime", CharSet = CharSet.Auto)]
- private static extern bool _WriteWaitTime(byte nCOMPort, byte nNodeID, ushort nTime);
- // Stop and kill current move
- [DllImport(DLL_FILENAME, EntryPoint = "StopAndKill", CharSet = CharSet.Auto)]
- private static extern bool _StopAndKill(byte nCOMPort, byte nNodeID);
- // Stop and kill current move with normal deceleration
- [DllImport(DLL_FILENAME, EntryPoint = "StopAndKillwithNormalDecel", CharSet = CharSet.Auto)]
- private static extern bool _StopAndKillwithNormalDecel(byte nCOMPort, byte nNodeID);
- // Set P2P profile arguments
- [DllImport(DLL_FILENAME, EntryPoint = "SetP2PProfile_M3", CharSet = CharSet.Auto)]
- private static extern bool _SetP2PProfile_M3(byte nCOMPort, byte nNodeID, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- // Set Jog profile arguments
- [DllImport(DLL_FILENAME, EntryPoint = "SetJogProfile_M3", CharSet = CharSet.Auto)]
- private static extern bool _SetJogProfile_M3(byte nCOMPort, byte nNodeID, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- // Set the drive enabled or disabled
- [DllImport(DLL_FILENAME, EntryPoint = "DriveEnable_M3", CharSet = CharSet.Auto)]
- private static extern bool _DriveEnable_M3(byte nCOMPort, byte nNodeID, bool bEnable);
- // Reset drive's dlarm
- [DllImport(DLL_FILENAME, EntryPoint = "AlarmReset_M3", CharSet = CharSet.Auto)]
- private static extern bool _AlarmReset_M3(byte nCOMPort, byte nNodeID);
- // Launch feed to position move
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoPosition_M3", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoPosition_M3(byte nCOMPort, byte nNodeID, IntPtr nDistance);
- // Launch feed to length move
- [DllImport(DLL_FILENAME, EntryPoint = "FeedtoLength_M3", CharSet = CharSet.Auto)]
- private static extern bool _FeedtoLength_M3(byte nCOMPort, byte nNodeID, IntPtr nDistance);
- [DllImport(DLL_FILENAME, EntryPoint = "AbsMove_M3")]
- public static extern bool _AbsMove_M3(byte nCOMPort, byte nNodeID, int nDistance, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- [DllImport(DLL_FILENAME, EntryPoint = "RelMove_M3")]
- public static extern bool _RelMove_M3(byte nCOMPort, byte nNodeID, int nDistance, IntPtr dVelocity, IntPtr dAccel, IntPtr dDecel);
- // Set Home profile
- [DllImport(DLL_FILENAME, EntryPoint = "SetHomeProfile", CharSet = CharSet.Auto)]
- private static extern bool _SetHomeProfile(byte nCOMPort, byte nNodeID, IntPtr dVelocity1, IntPtr dVelocity2, IntPtr dAccel, IntPtr nHomingOffset);
- // Set Home method
- [DllImport(DLL_FILENAME, EntryPoint = "SetHomeMethod", CharSet = CharSet.Auto)]
- private static extern bool _SetHomeMethod(byte nCOMPort, byte nNodeID, sbyte nHomeMethod);
- // Launch feed home move
- [DllImport(DLL_FILENAME, EntryPoint = "FeedHome", CharSet = CharSet.Auto)]
- private static extern bool _FeedHome(byte nCOMPort, byte nNodeID, sbyte nHomeMethod, IntPtr dVelocity1, IntPtr dVelocity2, IntPtr dAccel, IntPtr nHomingOffset);
- // Read alarm code
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAlarmCode", CharSet = CharSet.Auto)]
- private static extern bool _ReadAlarmCode(byte nCOMPort, byte nNodeID, ref uint nAlarmCode);
- // Read status code
- [DllImport(DLL_FILENAME, EntryPoint = "ReadStatusCode", CharSet = CharSet.Auto)]
- private static extern bool _ReadStatusCode(byte nCOMPort, byte nNodeID, ref uint nStatusCode);
- // Read immediate expanded inputs
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateExpandedInputs", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateExpandedInputs(byte nCOMPort, byte nNodeID, ref ushort nInputsStatus);
- // Read driver board inputs
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDriverBoardInputs", CharSet = CharSet.Auto)]
- private static extern bool _ReadDriverBoardInputs(byte nCOMPort, byte nNodeID, ref ushort nInputsStatus);
- // Read encoder position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadEncoderPosition", CharSet = CharSet.Auto)]
- private static extern bool _ReadEncoderPosition(byte nCOMPort, byte nNodeID, ref int nEncoderPosition);
- // Read immediate absolute position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAbsolutePosition", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAbsolutePosition(byte nCOMPort, byte nNodeID, ref int nImmediateAbsolutePosition);
- // Read immediate actual velocity
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateActualVelocity", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateActualVelocity(byte nCOMPort, byte nNodeID, ref double dImmediateActualVelocity);
- // Read immediate target velocity
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateTargetVelocity", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateTargetVelocity(byte nCOMPort, byte nNodeID, ref double dImmediateTargetVelocity);
- // Read immediate drive temperature
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateDriveTemperature", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateDriveTemperature(byte nCOMPort, byte nNodeID, ref double dImmediateDriveTemperature);
- // Read immediate bus voltage
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateBusVoltage", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateBusVoltage(byte nCOMPort, byte nNodeID, ref double dImmediateBusVoltage);
- // Read immediate position error
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediatePositionError", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediatePositionError(byte nCOMPort, byte nNodeID, ref int nImmediatePositionError);
- // Read immediate analog input value
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAnalogInputValue", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAnalogInputValue(byte nCOMPort, byte nNodeID, ref short nImmediateAnalogInputValue);
- // Read immediate analog input1 Value
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAnalogInput1Value", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAnalogInput1Value(byte nCOMPort, byte nNodeID, ref short nImmediateAnalogInputValue);
- // Read immediate analog input2 Value
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAnalogInput2Value", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAnalogInput2Value(byte nCOMPort, byte nNodeID, ref short nImmediateAnalogInputValue);
- // Read Q program line number
- [DllImport(DLL_FILENAME, EntryPoint = "ReadQProgramLineNumber", CharSet = CharSet.Auto)]
- private static extern bool _ReadQProgramLineNumber(byte nCOMPort, byte nNodeID, ref ushort nQProgramLineNumber);
- // Read immediate current command
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateCurrentCommand", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateCurrentCommand(byte nCOMPort, byte nNodeID, ref short nImmediateCurrentCommand);
- // Read relative distance
- [DllImport(DLL_FILENAME, EntryPoint = "ReadRelativeDistance", CharSet = CharSet.Auto)]
- private static extern bool _ReadRelativeDistance(byte nCOMPort, byte nNodeID, ref int nRelativeDistance);
- // Read sensor position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadSensorPosition", CharSet = CharSet.Auto)]
- private static extern bool _ReadSensorPosition(byte nCOMPort, byte nNodeID, ref int nSensorPosition);
- // Read condition code
- [DllImport(DLL_FILENAME, EntryPoint = "ReadConditionCode", CharSet = CharSet.Auto)]
- private static extern bool _ReadConditionCode(byte nCOMPort, byte nNodeID, ref ushort nConditionCode);
- // Read command mode
- [DllImport(DLL_FILENAME, EntryPoint = "ReadCommandMode", CharSet = CharSet.Auto)]
- private static extern bool _ReadCommandMode(byte nCOMPort, byte nNodeID, ref ushort nCommandMode);
- // Read distance or position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDistanceOrPosition", CharSet = CharSet.Auto)]
- private static extern bool _ReadDistanceOrPosition(byte nCOMPort, byte nNodeID, ref int nDistanceOrPosition);
- // Write distance or position
- [DllImport(DLL_FILENAME, EntryPoint = "WriteDistanceOrPosition", CharSet = CharSet.Auto)]
- private static extern bool _WriteDistanceOrPosition(byte nCOMPort, byte nNodeID, int nDistanceOrPosition);
- // Read change distance
- [DllImport(DLL_FILENAME, EntryPoint = "ReadChangeDistance", CharSet = CharSet.Auto)]
- private static extern bool _ReadChangeDistance(byte nCOMPort, byte nNodeID, ref int nChangeDistance);
- // Write change distance
- [DllImport(DLL_FILENAME, EntryPoint = "WriteChangeDistance", CharSet = CharSet.Auto)]
- private static extern bool _WriteChangeDistance(byte nCOMPort, byte nNodeID, int nChangeDistance);
- // Read change velocity
- [DllImport(DLL_FILENAME, EntryPoint = "ReadChangeVelocity", CharSet = CharSet.Auto)]
- private static extern bool _ReadChangeVelocity(byte nCOMPort, byte nNodeID, ref double dChangeVelocity);
- // Write change velocity
- [DllImport(DLL_FILENAME, EntryPoint = "WriteChangeVelocity", CharSet = CharSet.Auto)]
- private static extern bool _WriteChangeVelocity(byte nCOMPort, byte nNodeID, double dChangeVelocity);
- // Read velocity move state
- [DllImport(DLL_FILENAME, EntryPoint = "ReadVelocityMoveState", CharSet = CharSet.Auto)]
- private static extern bool _ReadVelocityMoveState(byte nCOMPort, byte nNodeID, ref ushort nVelocityMoveState);
- // Read P2P move state
- [DllImport(DLL_FILENAME, EntryPoint = "ReadP2PMoveState", CharSet = CharSet.Auto)]
- private static extern bool _ReadP2PMoveState(byte nCOMPort, byte nNodeID, ref ushort nP2PMoveState);
- // Read Q program segment number
- [DllImport(DLL_FILENAME, EntryPoint = "ReadQProgramSegmentNumber", CharSet = CharSet.Auto)]
- private static extern bool _ReadQProgramSegmentNumber(byte nCOMPort, byte nNodeID, ref ushort nQProgramSegmentNumber);
- // Read position offset
- [DllImport(DLL_FILENAME, EntryPoint = "ReadPositionOffset", CharSet = CharSet.Auto)]
- private static extern bool _ReadPositionOffset(byte nCOMPort, byte nNodeID, ref int nPositionOffset);
- // Write position offset
- [DllImport(DLL_FILENAME, EntryPoint = "WritePositionOffset", CharSet = CharSet.Auto)]
- private static extern bool _WritePositionOffset(byte nCOMPort, byte nNodeID, int nPositionOffset);
- // Read running current
- [DllImport(DLL_FILENAME, EntryPoint = "ReadRunningCurrent", CharSet = CharSet.Auto)]
- private static extern bool _ReadRunningCurrent(byte nCOMPort, byte nNodeID, ref double dRunningCurrent);
- // Write running current
- [DllImport(DLL_FILENAME, EntryPoint = "WriteRunningCurrent", CharSet = CharSet.Auto)]
- private static extern bool _WriteRunningCurrent(byte nCOMPort, byte nNodeID, double dRunningCurrent);
- // Read electronic gearing
- [DllImport(DLL_FILENAME, EntryPoint = "ReadElectronicGearing", CharSet = CharSet.Auto)]
- private static extern bool _ReadElectronicGearing(byte nCOMPort, byte nNodeID, ref ushort nElectronicGearing);
- // Write electronic gearing
- [DllImport(DLL_FILENAME, EntryPoint = "WriteElectronicGearing", CharSet = CharSet.Auto)]
- private static extern bool _WriteElectronicGearing(byte nCOMPort, byte nNodeID, ushort nElectronicGearing);
- // Read pulse counter
- [DllImport(DLL_FILENAME, EntryPoint = "ReadPulseCounter", CharSet = CharSet.Auto)]
- private static extern bool _ReadPulseCounter(byte nCOMPort, byte nNodeID, ref int nPulseCounter);
- // Write pulse counter
- [DllImport(DLL_FILENAME, EntryPoint = "WritePulseCounter", CharSet = CharSet.Auto)]
- private static extern bool _WritePulseCounter(byte nCOMPort, byte nNodeID, int nPulseCounter);
- // Read analog position gain
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogPositionGain", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogPositionGain(byte nCOMPort, byte nNodeID, ref ushort nAnalogPositionGain);
- // Write analog position gain
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogPositionGain", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogPositionGain(byte nCOMPort, byte nNodeID, ushort nAnalogPositionGain);
- // Read analog threshold
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogThreshold", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogThreshold(byte nCOMPort, byte nNodeID, ref ushort nAnalogThreshold);
- // Write analog threshold
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogThreshold", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogThreshold(byte nCOMPort, byte nNodeID, ushort nAnalogThreshold);
- // Read analogoffset
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogOffset", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogOffset(byte nCOMPort, byte nNodeID, ref ushort nAnalogOffset);
- // Write analog offset
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogOffset", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogOffset(byte nCOMPort, byte nNodeID, ushort nAnalogOffset);
- // Read accumulator
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAccumulator", CharSet = CharSet.Auto)]
- private static extern bool _ReadAccumulator(byte nCOMPort, byte nNodeID, ref int nAccumulator);
- // Read user defined register
- [DllImport(DLL_FILENAME, EntryPoint = "ReadUserDefinedRegister", CharSet = CharSet.Auto)]
- private static extern bool _ReadUserDefinedRegister(byte nCOMPort, byte nNodeID, char chRegister, ref int nValue);
- // Write user defined register
- [DllImport(DLL_FILENAME, EntryPoint = "WriteUserDefinedRegister", CharSet = CharSet.Auto)]
- private static extern bool _WriteUserDefinedRegister(byte nCOMPort, byte nNodeID, char chRegister, int nValue);
- // Read brake release delay
- [DllImport(DLL_FILENAME, EntryPoint = "ReadBrakeReleaseDelay", CharSet = CharSet.Auto)]
- private static extern bool _ReadBrakeReleaseDelay(byte nCOMPort, byte nNodeID, ref double dBrakeReleaseDelay);
- // Write brake release delay
- [DllImport(DLL_FILENAME, EntryPoint = "WriteBrakeReleaseDelay", CharSet = CharSet.Auto)]
- private static extern bool _WriteBrakeReleaseDelay(byte nCOMPort, byte nNodeID, double dBrakeReleaseDelay);
- // Read brake engage delay
- [DllImport(DLL_FILENAME, EntryPoint = "ReadBrakeEngageDelay", CharSet = CharSet.Auto)]
- private static extern bool _ReadBrakeEngageDelay(byte nCOMPort, byte nNodeID, ref double dBrakeEngageDelay);
- // Write brake engage delay
- [DllImport(DLL_FILENAME, EntryPoint = "WriteBrakeEngageDelay", CharSet = CharSet.Auto)]
- private static extern bool _WriteBrakeEngageDelay(byte nCOMPort, byte nNodeID, double dBrakeEngageDelay);
- // Read analog filter gain
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogFilterGain", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogFilterGain(byte nCOMPort, byte nNodeID, ref ushort nAnalogFilterGain);
- // Write analog filter gain
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogFilterGain", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogFilterGain(byte nCOMPort, byte nNodeID, ushort nAnalogFilterGain);
- // Read alarm code
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAlarmCode_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAlarmCode_M3(byte nCOMPort, byte nNodeID, ref uint nAlarmCode);
- // Read status code
- [DllImport(DLL_FILENAME, EntryPoint = "ReadStatusCode_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadStatusCode_M3(byte nCOMPort, byte nNodeID, ref uint nStatusCode);
- // Read driver board inputs
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDriverBoardInputs_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadDriverBoardInputs_M3(byte nCOMPort, byte nNodeID, ref ushort nInputsStatus);
- // Read driver board Outputs
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDriverBoardOutputs_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadDriverBoardOutputs_M3(byte nCOMPort, byte nNodeID, ref ushort nOutputsStatus);
- // Read encoder position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadEncoderPosition_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadEncoderPosition_M3(byte nCOMPort, byte nNodeID, ref int nEncoderPosition);
- // Read encoder position
- [DllImport(DLL_FILENAME, EntryPoint = "Read2ndEncoderPosition_M3", CharSet = CharSet.Auto)]
- private static extern bool _Read2ndEncoderPosition_M3(byte nCOMPort, byte nNodeID, ref int nEncoderPosition);
- // Read immediate absolute position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAbsolutePosition_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAbsolutePosition_M3(byte nCOMPort, byte nNodeID, ref int nImmediateAbsolutePosition);
- // Read immediate actual velocity
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateActualVelocity_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateActualVelocity_M3(byte nCOMPort, byte nNodeID, ref double dImmediateActualVelocity);
- // Read immediate target velocity
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateTargetVelocity_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateTargetVelocity_M3(byte nCOMPort, byte nNodeID, ref double dImmediateTargetVelocity);
- // Read immediate drive temperature
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateDriveTemperature_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateDriveTemperature_M3(byte nCOMPort, byte nNodeID, ref double dImmediateDriveTemperature);
- // Read immediate bus voltage
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateBusVoltage_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateBusVoltage_M3(byte nCOMPort, byte nNodeID, ref double dImmediateBusVoltage);
- // Read immediate position error
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediatePositionError_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediatePositionError_M3(byte nCOMPort, byte nNodeID, ref int nImmediatePositionError);
- // Read immediate analog input1 Value
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAnalogInput1Value_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAnalogInput1Value_M3(byte nCOMPort, byte nNodeID, ref short nImmediateAnalogInputValue);
- // Read immediate analog input2 Value
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAnalogInput2Value_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAnalogInput2Value_M3(byte nCOMPort, byte nNodeID, ref short nImmediateAnalogInputValue);
- // Read immediate analog Output1 Value
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAnalogOutput1Value_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAnalogOutput1Value_M3(byte nCOMPort, byte nNodeID, ref short nImmediateAnalogOutputValue);
- // Write immediate analog Output1 Value
- [DllImport(DLL_FILENAME, EntryPoint = "WriteImmediateAnalogOutput1Value_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteImmediateAnalogOutput1Value_M3(byte nCOMPort, byte nNodeID, short nImmediateAnalogOutputValue);
- // Read immediate analog Output2 Value
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateAnalogOutput2Value_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateAnalogOutput2Value_M3(byte nCOMPort, byte nNodeID, ref short nImmediateAnalogOutputValue);
- // Write immediate analog Output2 Value
- [DllImport(DLL_FILENAME, EntryPoint = "WriteImmediateAnalogOutput2Value_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteImmediateAnalogOutput2Value_M3(byte nCOMPort, byte nNodeID, short nImmediateAnalogOutputValue);
- // Read Q program line number
- [DllImport(DLL_FILENAME, EntryPoint = "ReadQProgramLineNumber_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadQProgramLineNumber_M3(byte nCOMPort, byte nNodeID, ref ushort nQProgramLineNumber);
- // Read immediate current command
- [DllImport(DLL_FILENAME, EntryPoint = "ReadImmediateCurrentCommand_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadImmediateCurrentCommand_M3(byte nCOMPort, byte nNodeID, ref short nImmediateCurrentCommand);
- // Read relative distance
- [DllImport(DLL_FILENAME, EntryPoint = "ReadRelativeDistance_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadRelativeDistance_M3(byte nCOMPort, byte nNodeID, ref int nRelativeDistance);
- // Read sensor position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadSensorPosition_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadSensorPosition_M3(byte nCOMPort, byte nNodeID, ref int nSensorPosition);
- // Read condition code
- [DllImport(DLL_FILENAME, EntryPoint = "ReadConditionCode_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadConditionCode_M3(byte nCOMPort, byte nNodeID, ref ushort nConditionCode);
- // Read command mode
- [DllImport(DLL_FILENAME, EntryPoint = "ReadCommandMode_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadCommandMode_M3(byte nCOMPort, byte nNodeID, ref ushort nCommandMode);
- // Read distance or position
- [DllImport(DLL_FILENAME, EntryPoint = "ReadDistanceOrPosition_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadDistanceOrPosition_M3(byte nCOMPort, byte nNodeID, ref int nDistanceOrPosition);
- // Write distance or position
- [DllImport(DLL_FILENAME, EntryPoint = "WriteDistanceOrPosition_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteDistanceOrPosition_M3(byte nCOMPort, byte nNodeID, int nDistanceOrPosition);
- // Read change distance
- [DllImport(DLL_FILENAME, EntryPoint = "ReadChangeDistance_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadChangeDistance_M3(byte nCOMPort, byte nNodeID, ref int nChangeDistance);
- // Write change distance
- [DllImport(DLL_FILENAME, EntryPoint = "WriteChangeDistance_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteChangeDistance_M3(byte nCOMPort, byte nNodeID, int nChangeDistance);
- // Read change velocity
- [DllImport(DLL_FILENAME, EntryPoint = "ReadChangeVelocity_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadChangeVelocity_M3(byte nCOMPort, byte nNodeID, ref double dChangeVelocity);
- // Write change velocity
- [DllImport(DLL_FILENAME, EntryPoint = "WriteChangeVelocity_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteChangeVelocity_M3(byte nCOMPort, byte nNodeID, double dChangeVelocity);
- // Read velocity move state
- [DllImport(DLL_FILENAME, EntryPoint = "ReadVelocityMoveState_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadVelocityMoveState_M3(byte nCOMPort, byte nNodeID, ref ushort nVelocityMoveState);
- // Read P2P move state
- [DllImport(DLL_FILENAME, EntryPoint = "ReadP2PMoveState_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadP2PMoveState_M3(byte nCOMPort, byte nNodeID, ref ushort nP2PMoveState);
- // Read Q program segment number
- [DllImport(DLL_FILENAME, EntryPoint = "ReadQProgramSegmentNumber_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadQProgramSegmentNumber_M3(byte nCOMPort, byte nNodeID, ref ushort nQProgramSegmentNumber);
- // Read Command current
- [DllImport(DLL_FILENAME, EntryPoint = "ReadCommandCurrent_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadCommandCurrent_M3(byte nCOMPort, byte nNodeID, ref double dCommandCurrent);
- // Write Command current
- [DllImport(DLL_FILENAME, EntryPoint = "WriteCommandCurrent_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteCommandCurrent_M3(byte nCOMPort, byte nNodeID, double dCommandCurrent);
- // Read Max current
- [DllImport(DLL_FILENAME, EntryPoint = "ReadMaximumCurrent_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadMaximumCurrent_M3(byte nCOMPort, byte nNodeID, ref double dMaximumCurrent);
- // Write Max current
- [DllImport(DLL_FILENAME, EntryPoint = "WriteMaximumCurrent_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteMaximumCurrent_M3(byte nCOMPort, byte nNodeID, double dMaximumCurrent);
- // Read electronic gearing
- [DllImport(DLL_FILENAME, EntryPoint = "ReadElectronicGearing_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadElectronicGearing_M3(byte nCOMPort, byte nNodeID, ref uint nElectronicGearing);
- // Write electronic gearing
- [DllImport(DLL_FILENAME, EntryPoint = "WriteElectronicGearing_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteElectronicGearing_M3(byte nCOMPort, byte nNodeID, uint nElectronicGearing);
- // Read pulse counter
- [DllImport(DLL_FILENAME, EntryPoint = "ReadPulseCounter_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadPulseCounter_M3(byte nCOMPort, byte nNodeID, ref int nPulseCounter);
- // Write pulse counter
- [DllImport(DLL_FILENAME, EntryPoint = "WritePulseCounter_M3", CharSet = CharSet.Auto)]
- private static extern bool _WritePulseCounter_M3(byte nCOMPort, byte nNodeID, int nPulseCounter);
- // Read analog position gain
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogPositionGain_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogPositionGain_M3(byte nCOMPort, byte nNodeID, ref int nAnalogPositionGain);
- // Write analog position gain
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogPositionGain_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogPositionGain_M3(byte nCOMPort, byte nNodeID, int nAnalogPositionGain);
- // Read analog velocity gain
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogVelocityGain_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogVelocityGain_M3(byte nCOMPort, byte nNodeID, ref double nAnalogVelocityGain);
- // Write analog velocity gain
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogVelocityGain_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogVelocityGain_M3(byte nCOMPort, byte nNodeID, double nAnalogVelocityGain);
- // Read analog torque gain
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogTorqueGain_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogTorqueGain_M3(byte nCOMPort, byte nNodeID, ref double nAnalogTorqueGain);
- // Write analog torque gain
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogTorqueGain_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogTorqueGain_M3(byte nCOMPort, byte nNodeID, double nAnalogTorqueGain);
- // Read analog threshold
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogThreshold1_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogThreshold1_M3(byte nCOMPort, byte nNodeID, ref int nAnalogThreshold);
- // Write analog threshold
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogThreshold1_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogThreshold1_M3(byte nCOMPort, byte nNodeID, int nAnalogThreshold);
- // Read analog threshold
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogThreshold2_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogThreshold2_M3(byte nCOMPort, byte nNodeID, ref int nAnalogThreshold);
- // Write analog threshold
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogThreshold2_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogThreshold2_M3(byte nCOMPort, byte nNodeID, int nAnalogThreshold);
- // Read analogoffset
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogOffset1_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogOffset1_M3(byte nCOMPort, byte nNodeID, ref int nAnalogOffset);
- // Write analog offset
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogOffset1_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogOffset1_M3(byte nCOMPort, byte nNodeID, int nAnalogOffset);
- // Read analogoffset
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogOffset2_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogOffset2_M3(byte nCOMPort, byte nNodeID, ref int nAnalogOffset);
- // Write analog offset
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogOffset2_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogOffset2_M3(byte nCOMPort, byte nNodeID, int nAnalogOffset);
- // Read accumulator
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAccumulator_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAccumulator_M3(byte nCOMPort, byte nNodeID, ref int nAccumulator);
- // Read user defined register
- [DllImport(DLL_FILENAME, EntryPoint = "ReadUserDefinedRegister_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadUserDefinedRegister_M3(byte nCOMPort, byte nNodeID, char chRegister, ref int nValue);
- // Write user defined register
- [DllImport(DLL_FILENAME, EntryPoint = "WriteUserDefinedRegister_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteUserDefinedRegister_M3(byte nCOMPort, byte nNodeID, char chRegister, int nValue);
- // Read brake release delay
- [DllImport(DLL_FILENAME, EntryPoint = "ReadBrakeReleaseDelay_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadBrakeReleaseDelay_M3(byte nCOMPort, byte nNodeID, ref double dBrakeReleaseDelay);
- // Write brake release delay
- [DllImport(DLL_FILENAME, EntryPoint = "WriteBrakeReleaseDelay_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteBrakeReleaseDelay_M3(byte nCOMPort, byte nNodeID, double dBrakeReleaseDelay);
- // Read brake engage delay
- [DllImport(DLL_FILENAME, EntryPoint = "ReadBrakeEngageDelay_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadBrakeEngageDelay_M3(byte nCOMPort, byte nNodeID, ref double dBrakeEngageDelay);
- // Write brake engage delay
- [DllImport(DLL_FILENAME, EntryPoint = "WriteBrakeEngageDelay_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteBrakeEngageDelay_M3(byte nCOMPort, byte nNodeID, double dBrakeEngageDelay);
- // Read analog filter gain
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogFilterGain1_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogFilterGain1_M3(byte nCOMPort, byte nNodeID, ref ushort nAnalogFilterGain);
- // Write analog filter gain
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogFilterGain1_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogFilterGain1_M3(byte nCOMPort, byte nNodeID, ushort nAnalogFilterGain);
- // Read analog filter gain
- [DllImport(DLL_FILENAME, EntryPoint = "ReadAnalogFilterGain2_M3", CharSet = CharSet.Auto)]
- private static extern bool _ReadAnalogFilterGain2_M3(byte nCOMPort, byte nNodeID, ref ushort nAnalogFilterGain);
- // Write analog filter gain
- [DllImport(DLL_FILENAME, EntryPoint = "WriteAnalogFilterGain2_M3", CharSet = CharSet.Auto)]
- private static extern bool _WriteAnalogFilterGain2_M3(byte nCOMPort, byte nNodeID, ushort nAnalogFilterGain);
- // Write broadcast command
- [DllImport(DLL_FILENAME, EntryPoint = "WriteBroadcastCommand", CharSet = CharSet.Auto)]
- private static extern bool _WriteBroadcastCommand(byte nCOMPort, byte nNodeIDCount, [MarshalAs(UnmanagedType.LPArray, SizeConst = 32)] byte[] aNodeIDArr, byte nFunctionCode);
- // Execute multi-axes linear interpolation move
- [DllImport(DLL_FILENAME, EntryPoint = "ExecuteLinearInterpolationMove", CharSet = CharSet.Auto)]
- private static extern bool _ExecuteLinearInterpolationMove(byte nCOMPort, byte nNodeIDCount, [MarshalAs(UnmanagedType.LPArray, SizeConst = 4)] byte[] aNodeIDArr, [MarshalAs(UnmanagedType.LPArray, SizeConst = 4)] int[] aPosArr, uint nMaxLineSpeed, uint nAccelTimeInMs, bool bRelMove, bool bValidParamLimit);
- #endregion
- #region Public Methods
- private static CSCallback m_DataSendCallback;
- private static CSCallback m_DataReceivedCallback;
- public delegate void OnDataSendOrReceivedEventHandler(EventArgs e);
- public event OnDataSendOrReceivedEventHandler DataSend;
- public event OnDataSendOrReceivedEventHandler DataReceived;
- public void DataSendCallbackFunction()
- {
- if (DataSend != null)
- {
- EventArgs e = new EventArgs();
- DataSend(e);
- }
- }
- public void DataReceivedCallbackFunction()
- {
- if (DataReceived != null)
- {
- EventArgs e = new EventArgs();
- DataReceived(e);
- }
- }
- public ModbusRTU()
- {
- m_DataSendCallback = DataSendCallbackFunction;
- _OnDataSend(m_DataSendCallback);
- m_DataReceivedCallback = DataReceivedCallbackFunction;
- _OnDataReceive(m_DataReceivedCallback);
- }
- public bool IsOpen()
- {
- return _IsOpen(m_COMPort);
- }
- public bool Open(byte nCOMPort, int baudRate, bool bigEndian = true)
- {
- m_COMPort = nCOMPort;
- return _Open(m_COMPort, baudRate, bigEndian);
- }
- public bool Close()
- {
- return _Close(m_COMPort);
- }
- ~ModbusRTU()
- {
- Close();
- }
- // Set when send data, trigger Send event or not
- public void SetEndianType(bool bBigEndian)
- {
- _SetEndianType(m_COMPort, bBigEndian);
- }
- // Set when received data, trigger Send event or not
- public bool IsBigEndian()
- {
- return _IsBigEndian(m_COMPort);
- }
- // Set when received data, trigger Send event or not
- public uint GetExecuteTimeOut()
- {
- return _GetExecuteTimeOut(m_COMPort);
- }
- // Set when send data, trigger Send event or not
- public void SetExecuteTimeOut(uint nExecuteTimeOut)
- {
- _SetExecuteTimeOut(m_COMPort, nExecuteTimeOut);
- }
- // Set it will trigger send event or not when sending command
- public void SetTriggerSendEvent(bool bTriggerSendEvent)
- {
- _SetTriggerSendEvent(bTriggerSendEvent);
- }
- // Set it will trigger received event or not when receive data
- public void SetTriggerReceiveEvent(bool bTriggerReceiveEvent)
- {
- _SetTriggerReceiveEvent(bTriggerReceiveEvent);
- }
- // Clear send buffer
- public void ClearSendBuffer(byte nCOMPort)
- {
- _ClearSendBuffer(nCOMPort);
- }
- // Clear received buffer
- public void ClearReceivedBuffer(byte nCOMPort)
- {
- _ClearReceivedBuffer(nCOMPort);
- }
- // Clear send and received Buffer
- public void ClearBuffer(byte nCOMPort)
- {
- _ClearBuffer(nCOMPort);
- }
- // Get last error information, includes code and description
- public void GetLastErrorInfo(ref ErrorInfo errorInfo)
- {
- _GetLastErrorInfo(ref errorInfo);
- }
- // Get the last command that send
- public void GetLastCommandSent(ref List<byte> commandList)
- {
- IntPtr ptrCommandStu = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(StructCommand)));
- bool ret = _GetLastCommandSent(m_COMPort, ptrCommandStu);
- StructCommand commandStu = (StructCommand)Marshal.PtrToStructure((IntPtr)((UInt32)ptrCommandStu), typeof(StructCommand));
- for (int i = 0; i < commandStu.Count; i++)
- {
- commandList.Add(commandStu.Values[i]);
- }
- Marshal.FreeHGlobal(ptrCommandStu);
- }
- // Get the last command that received
- public void GetLastCommandReceived(ref List<byte> commandList)
- {
- IntPtr ptrCommandStu = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(StructCommand)));
- bool ret = _GetLastCommandReceived(m_COMPort, ptrCommandStu);
- StructCommand commandStu = (StructCommand)Marshal.PtrToStructure((IntPtr)((UInt32)ptrCommandStu), typeof(StructCommand));
- for (int i = 0; i < commandStu.Count; i++)
- {
- commandList.Add(commandStu.Values[i]);
- }
- Marshal.FreeHGlobal(ptrCommandStu);
- }
- // Read single holding register from the drive
- public bool ReadSingleHoldingRegister(byte nNodeID, int registerNo, ref int value)
- {
- return _ReadSingleHoldingRegister(m_COMPort, nNodeID, registerNo, ref value);
- }
- // Write single holding register value to the drive
- public bool WriteSingleHoldingRegister(byte nNodeID, int registerNo, int value)
- {
- return _WriteSingleHoldingRegister(m_COMPort, nNodeID, registerNo, value);
- }
- // Read multiple holding register from the drive
- public bool ReadMultiHoldingRegisters(byte nNodeID, int registerNo, int count, ref List<int> valueList)
- {
- IntPtr ptrHoldingRegisterStu = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(StructRegisterValue)));
- bool ret = _ReadMultiHoldingRegisters(m_COMPort, nNodeID, registerNo, count, ptrHoldingRegisterStu);
- StructRegisterValue holdingRegisterStu = (StructRegisterValue)Marshal.PtrToStructure((IntPtr)((UInt32)ptrHoldingRegisterStu), typeof(StructRegisterValue));
- for (int i = 0; i < holdingRegisterStu.Count; i++)
- {
- valueList.Add(holdingRegisterStu.Values[i]);
- }
- Marshal.FreeHGlobal(ptrHoldingRegisterStu);
- return ret;
- }
- // Write multiple holding register values to the drive
- public bool WriteMultiHoldingRegisters(byte nNodeID, int registerNo, int count, List<int> lstValue)
- {
- int[] valueList = lstValue.ToArray();
- bool ret = _WriteMultiHoldingRegisters(m_COMPort, nNodeID, registerNo, count, valueList);
- return ret;
- }
- // Read 16-bit int data from the drive
- public bool ReadDataInt16(byte nNodeID, int nRegisterNo, ref short nValue)
- {
- return _ReadDataInt16(m_COMPort, nNodeID, nRegisterNo, ref nValue);
- }
- // Write 16-bit int data to the drive
- public bool WriteDataInt16(byte nNodeID, int nRegisterNo, short nValue)
- {
- return _WriteDataInt16(m_COMPort, nNodeID, nRegisterNo, nValue);
- }
- // Read 16-bit unsighed int data from the drive
- public bool ReadDataUInt16(byte nNodeID, int nRegisterNo, ref ushort nValue)
- {
- return _ReadDataUInt16(m_COMPort, nNodeID, nRegisterNo, ref nValue);
- }
- // Write 16-bit unsigned int data to the drive
- public bool WriteDataUInt16(byte nNodeID, int nRegisterNo, ushort nValue)
- {
- return _WriteDataUInt16(m_COMPort, nNodeID, nRegisterNo, nValue);
- }
- // Read 32-bit int data from the drive
- public bool ReadDataInt32(byte nNodeID, int nRegisterNo, ref int nValue)
- {
- return _ReadDataInt32(m_COMPort, nNodeID, nRegisterNo, ref nValue);
- }
- // Write 32-bit int data to the drive
- public bool WriteDataInt32(byte nNodeID, int nRegisterNo, int nValue)
- {
- return _WriteDataInt32(m_COMPort, nNodeID, nRegisterNo, nValue);
- }
- // Read 32-bit unsighed int data from the drive
- public bool ReadDataUInt32(byte nNodeID, int nRegisterNo, ref uint nValue)
- {
- return _ReadDataUInt32(m_COMPort, nNodeID, nRegisterNo, ref nValue);
- }
- // Write 32-bit unsigned int data to the drive
- public bool WriteDataUInt32(byte nNodeID, int nRegisterNo, uint nValue)
- {
- return _WriteDataUInt32(m_COMPort, nNodeID, nRegisterNo, nValue);
- }
- // Execute command with opcode
- public bool ExecuteCommandWithOpcode(byte nNodeID, SCLCommandEncodingTable commandCode, int p1 = 0, int p2 = 0, int p3 = 0, int p4 = 0, int p5 = 0)
- {
- return _ExecuteCommandWithOpcode(m_COMPort, nNodeID, (int)commandCode, p1, p2, p3, p4, p5);
- }
- // Write multiple holding register values to the drive
- public bool ExecuteSCLCommand(byte nNodeID, int registerNo, byte[] command, ref string strResponse)
- {
- IntPtr strIntPtr = IntPtr.Zero;
- bool ret = _ExecuteSCLCommand(m_COMPort, nNodeID, registerNo, command, ref strIntPtr);
- strResponse = Marshal.PtrToStringAnsi(strIntPtr);
- return ret;
- }
- public bool ExecuteSCLCommand(byte nNodeID, int registerNo, string command, ref string strResponse)
- {
- byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(command);
- return ExecuteSCLCommand(nNodeID, registerNo, buf, ref strResponse);
- }
- // Set P2P profile arguments
- public bool SetP2PProfile(byte nNodeID, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _SetP2PProfile(m_COMPort, nNodeID, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Set Jog profile arguments
- public bool SetJogProfile(byte nNodeID, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _SetJogProfile(m_COMPort, nNodeID, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Set the drive enabled or disabled
- public bool DriveEnable(byte nNodeID, bool bEnable)
- {
- return _DriveEnable(m_COMPort, nNodeID, bEnable);
- }
- // Reset drive's dlarm
- public bool AlarmReset(byte nNodeID)
- {
- return _AlarmReset(m_COMPort, nNodeID);
- }
- // Launch feed to position move
- public bool FeedtoPosition(byte nNodeID, int? nPosition = null)
- {
- IntPtr ptrPosition = IntPtr.Zero;
- if (nPosition.HasValue)
- {
- ptrPosition = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(nPosition.Value, ptrPosition, true);
- }
- bool ret = _FeedtoPosition(m_COMPort, nNodeID, ptrPosition);
- Marshal.FreeHGlobal(ptrPosition);
- return ret;
- }
- // Launch feed to length move
- public bool FeedtoLength(byte nNodeID, int? nDistance = null)
- {
- IntPtr ptrPosition = IntPtr.Zero;
- if (nDistance.HasValue)
- {
- ptrPosition = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(nDistance.Value, ptrPosition, true);
- }
- bool ret = _FeedtoLength(m_COMPort, nNodeID, ptrPosition);
- Marshal.FreeHGlobal(ptrPosition);
- return ret;
- }
- // Launch absolute move
- public bool AbsMove(byte nNodeID, int nDistance, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _AbsMove(m_COMPort, nNodeID, nDistance, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Launch relative move
- public bool RelMove(byte nNodeID, int nDistance, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _RelMove(m_COMPort, nNodeID, nDistance, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Launch feed to sensor move
- public bool FeedtoSensor(byte nNodeID, byte nInputSensor, char chInputStatus)
- {
- return _FeedtoSensor(m_COMPort, nNodeID, nInputSensor, chInputStatus);
- }
- // Lanuch feed to sensor move with safety distance
- public bool FeedtoSensorwithSafetyDistance(byte nNodeID, byte nInputSensor, char chInputStatus)
- {
- return _FeedtoSensorwithSafetyDistance(m_COMPort, nNodeID, nInputSensor, chInputStatus);
- }
- // Launch feed to double sensor move with mask distance
- public bool FeedtoSensorwithMaskDistance(byte nNodeID, byte nInputSensor, char chInputStatus)
- {
- return _FeedtoSensorwithMaskDistance(m_COMPort, nNodeID, nInputSensor, chInputStatus);
- }
- // Launch Point to Point Move and set output
- public bool FeedandSetOutput(byte nNodeID, byte nOutput, char chOutputStatus)
- {
- return _FeedandSetOutput(m_COMPort, nNodeID, nOutput, chOutputStatus);
- }
- // Launch feed to double sensor move
- public bool FeedtoDoubleSensor(byte nNodeID, byte nInput1, char chInputStatus1, byte nInput2, char chInputStatus2)
- {
- return _FeedtoDoubleSensor(m_COMPort, nNodeID, nInput1, chInputStatus1, nInput2, chInputStatus2);
- }
- // Launch follow encoder move
- public bool FollowEncoder(byte nNodeID, byte nInputSensor, char chInputStatus)
- {
- return _FollowEncoder(m_COMPort, nNodeID, nInputSensor, chInputStatus);
- }
- // Commence Jogging
- public bool StartJogging(byte nNodeID)
- {
- return _StartJogging(m_COMPort, nNodeID);
- }
- // Stop Jogging
- public bool StopJogging(byte nNodeID)
- {
- return _StopJogging(m_COMPort, nNodeID);
- }
- // Set encoder function to the stepper drives with encoder feedback
- public bool SetEncoderFunction(byte nNodeID, byte nFunc)
- {
- return _SetEncoderFunction(m_COMPort, nNodeID, nFunc);
- }
- // Set encoder position
- public bool SetEncoderPosition(byte nNodeID, int nPosition)
- {
- return _SetEncoderPosition(m_COMPort, nNodeID, nPosition);
- }
- // Jog disable
- public bool JogDisable(byte nNodeID)
- {
- return _JogDisable(m_COMPort, nNodeID);
- }
- // Jog enable
- public bool JogEnable(byte nNodeID)
- {
- return _JogEnable(m_COMPort, nNodeID);
- }
- // Launch seek home move
- public bool SeekHome(byte nNodeID, byte nInputSensor, char chInputStatus)
- {
- return _SeekHome(m_COMPort, nNodeID, nInputSensor, chInputStatus);
- }
- // Set position
- public bool SetPosition(byte nNodeID, int nPosition)
- {
- return _SetPosition(m_COMPort, nNodeID, nPosition);
- }
- // Set filter input
- public bool SetFilterInput(byte nNodeID, byte nInputSensor, int nFilterTime)
- {
- return _SetFilterInput(m_COMPort, nNodeID, nInputSensor, nFilterTime);
- }
- // Analog deadband
- public bool WriteAnalogDeadband(byte nNodeID, byte nDeadband)
- {
- return _WriteAnalogDeadband(m_COMPort, nNodeID, nDeadband);
- }
- // Set output of the drive
- public bool SetOutput(byte nNodeID, byte nOutput, char nCondition)
- {
- return _SetOutput(m_COMPort, nNodeID, nOutput, nCondition);
- }
- // Wait for input
- public bool WriteWaitforInput(byte nNodeID, byte nInputSensor, char nCondition)
- {
- return _WriteWaitforInput(m_COMPort, nNodeID, nInputSensor, nCondition);
- }
- // Queue Load and Execute
- public bool QueueLoadAndExecute(byte nNodeID, byte nSegment)
- {
- return _QueueLoadAndExecute(m_COMPort, nNodeID, nSegment);
- }
- // Wait time
- public bool WriteWaitTime(byte nNodeID, ushort nTime)
- {
- return _WriteWaitTime(m_COMPort, nNodeID, nTime);
- }
- // Stop and kill current move
- public bool StopAndKill(byte nNodeID)
- {
- return _StopAndKill(m_COMPort, nNodeID);
- }
- // Stop and kill current move with normal deceleration
- public bool StopAndKillwithNormalDecel(byte nNodeID)
- {
- return _StopAndKillwithNormalDecel(m_COMPort, nNodeID);
- }
- // Set P2P profile arguments
- public bool SetP2PProfile_M3(byte nNodeID, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _SetP2PProfile_M3(m_COMPort, nNodeID, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Set Jog profile arguments
- public bool SetJogProfile_M3(byte nNodeID, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _SetJogProfile_M3(m_COMPort, nNodeID, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Set the drive enabled or disabled
- public bool DriveEnable_M3(byte nNodeID, bool bEnable)
- {
- return _DriveEnable_M3(m_COMPort, nNodeID, bEnable);
- }
- // Launch feed to position move
- public bool FeedtoPosition_M3(byte nNodeID, int? nPosition = null)
- {
- IntPtr ptrPosition = IntPtr.Zero;
- if (nPosition.HasValue)
- {
- ptrPosition = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(nPosition.Value, ptrPosition, true);
- }
- bool ret = _FeedtoPosition_M3(m_COMPort, nNodeID, ptrPosition);
- Marshal.FreeHGlobal(ptrPosition);
- return ret;
- }
- // Launch feed to length move
- public bool FeedtoLength_M3(byte nNodeID, int? nDistance = null)
- {
- IntPtr ptrPosition = IntPtr.Zero;
- if (nDistance.HasValue)
- {
- ptrPosition = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(nDistance.Value, ptrPosition, true);
- }
- bool ret = _FeedtoLength_M3(m_COMPort, nNodeID, ptrPosition);
- Marshal.FreeHGlobal(ptrPosition);
- return ret;
- }
- // Reset drive's dlarm
- public bool AlarmReset_M3(byte nNodeID)
- {
- return _AlarmReset_M3(m_COMPort, nNodeID);
- }
- // Launch absolute move
- public bool AbsMove_M3(byte nNodeID, int nDistance, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _AbsMove_M3(m_COMPort, nNodeID, nDistance, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Launch relative move
- public bool RelMove_M3(byte nNodeID, int nDistance, double? dVelocity, double? dAccel, double? dDecel)
- {
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrDecel = IntPtr.Zero;
- if (dDecel != null)
- {
- ptrDecel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dDecel.Value, ptrDecel, true);
- }
- IntPtr ptrVelocity = IntPtr.Zero;
- if (dVelocity != null)
- {
- ptrVelocity = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity.Value, ptrVelocity, true);
- }
- bool ret = _RelMove_M3(m_COMPort, nNodeID, nDistance, ptrVelocity, ptrAccel, ptrDecel);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrDecel);
- Marshal.FreeHGlobal(ptrVelocity);
- return ret;
- }
- // Set Home profile arguments
- public bool SetHomeProfile(byte nNodeID, double? dVelocity1, double? dVelocity2, double? dAccel, int? nHomingOffset = null)
- {
- IntPtr ptrVelocity1 = IntPtr.Zero;
- if (dVelocity1 != null)
- {
- ptrVelocity1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity1.Value, ptrVelocity1, true);
- }
- IntPtr ptrVelocity2 = IntPtr.Zero;
- if (dVelocity2 != null)
- {
- ptrVelocity2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity2.Value, ptrVelocity2, true);
- }
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrHomingOffset = IntPtr.Zero;
- if (nHomingOffset.HasValue)
- {
- ptrHomingOffset = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(nHomingOffset.Value, ptrHomingOffset, true);
- }
- bool ret = _SetHomeProfile(m_COMPort, nNodeID, ptrVelocity1, ptrVelocity2, ptrAccel, ptrHomingOffset);
- Marshal.FreeHGlobal(ptrVelocity1);
- Marshal.FreeHGlobal(ptrVelocity2);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrHomingOffset);
- return ret;
- }
- // Set feed home method
- public bool SetHomeMethod(byte nNodeID, sbyte nHomeMethod)
- {
- return _SetHomeMethod(m_COMPort, nNodeID, nHomeMethod);
- }
- // Launch feed home move
- public bool FeedHome(byte nNodeID, sbyte nHomeMethod, double? dVelocity1 = null, double? dVelocity2 = null, double? dAccel = null, int? nHomingOffset = null)
- {
- IntPtr ptrVelocity1 = IntPtr.Zero;
- if (dVelocity1 != null)
- {
- ptrVelocity1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity1.Value, ptrVelocity1, true);
- }
- IntPtr ptrVelocity2 = IntPtr.Zero;
- if (dVelocity2 != null)
- {
- ptrVelocity2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dVelocity2.Value, ptrVelocity2, true);
- }
- IntPtr ptrAccel = IntPtr.Zero;
- if (dAccel != null)
- {
- ptrAccel = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(dAccel.Value, ptrAccel, true);
- }
- IntPtr ptrHomingOffset = IntPtr.Zero;
- if (nHomingOffset.HasValue)
- {
- ptrHomingOffset = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)));
- Marshal.StructureToPtr(nHomingOffset.Value, ptrHomingOffset, true);
- }
- bool ret = _FeedHome(m_COMPort, nNodeID, nHomeMethod, ptrVelocity1, ptrVelocity2, ptrAccel, ptrHomingOffset);
- Marshal.FreeHGlobal(ptrVelocity1);
- Marshal.FreeHGlobal(ptrVelocity2);
- Marshal.FreeHGlobal(ptrAccel);
- Marshal.FreeHGlobal(ptrHomingOffset);
- return ret;
- }
- // Read alarm code
- public bool ReadAlarmCode(byte nNodeID, ref uint nAlarmCode)
- {
- return _ReadAlarmCode(m_COMPort, nNodeID, ref nAlarmCode);
- }
- // Read status code
- public bool ReadStatusCode(byte nNodeID, ref uint nStatusCode)
- {
- return _ReadStatusCode(m_COMPort, nNodeID, ref nStatusCode);
- }
- // Read immediate expanded inputs
- public bool ReadImmediateExpandedInputs(byte nNodeID, ref ushort nInputsStatus)
- {
- return _ReadImmediateExpandedInputs(m_COMPort, nNodeID, ref nInputsStatus);
- }
- // Read driver board inputs
- public bool ReadDriverBoardInputs(byte nNodeID, ref ushort nInputsStatus)
- {
- return _ReadDriverBoardInputs(m_COMPort, nNodeID, ref nInputsStatus);
- }
- // Read encoder position
- public bool ReadEncoderPosition(byte nNodeID, ref int nEncoderPosition)
- {
- return _ReadEncoderPosition(m_COMPort, nNodeID, ref nEncoderPosition);
- }
- // Read immediate absolute position
- public bool ReadImmediateAbsolutePosition(byte nNodeID, ref int nImmediateAbsolutePosition)
- {
- return _ReadImmediateAbsolutePosition(m_COMPort, nNodeID, ref nImmediateAbsolutePosition);
- }
- // Read immediate actual velocity
- public bool ReadImmediateActualVelocity(byte nNodeID, ref double dImmediateActualVelocity)
- {
- return _ReadImmediateActualVelocity(m_COMPort, nNodeID, ref dImmediateActualVelocity);
- }
- // Read immediate target velocity
- public bool ReadImmediateTargetVelocity(byte nNodeID, ref double dImmediateTargetVelocity)
- {
- return _ReadImmediateTargetVelocity(m_COMPort, nNodeID, ref dImmediateTargetVelocity);
- }
- // Read immediate drive temperature
- public bool ReadImmediateDriveTemperature(byte nNodeID, ref double dImmediateDriveTemperature)
- {
- return _ReadImmediateDriveTemperature(m_COMPort, nNodeID, ref dImmediateDriveTemperature);
- }
- // Read immediate bus voltage
- public bool ReadImmediateBusVoltage(byte nNodeID, ref double dImmediateBusVoltage)
- {
- return _ReadImmediateBusVoltage(m_COMPort, nNodeID, ref dImmediateBusVoltage);
- }
- // Read immediate position error
- public bool ReadImmediatePositionError(byte nNodeID, ref int nImmediatePositionError)
- {
- return _ReadImmediatePositionError(m_COMPort, nNodeID, ref nImmediatePositionError);
- }
- // Read immediate analog input value
- public bool ReadImmediateAnalogInputValue(byte nNodeID, ref short nImmediateAnalogInputValue)
- {
- return _ReadImmediateAnalogInputValue(m_COMPort, nNodeID, ref nImmediateAnalogInputValue);
- }
- // Read immediate analog input1 Value
- public bool ReadImmediateAnalogInput1Value(byte nNodeID, ref short nImmediateAnalogInputValue)
- {
- return _ReadImmediateAnalogInput1Value(m_COMPort, nNodeID, ref nImmediateAnalogInputValue);
- }
- // Read immediate analog input2 Value
- public bool ReadImmediateAnalogInput2Value(byte nNodeID, ref short nImmediateAnalogInputValue)
- {
- return _ReadImmediateAnalogInput2Value(m_COMPort, nNodeID, ref nImmediateAnalogInputValue);
- }
- // Read Q program line number
- public bool ReadQProgramLineNumber(byte nNodeID, ref ushort nQProgramLineNumber)
- {
- return _ReadQProgramLineNumber(m_COMPort, nNodeID, ref nQProgramLineNumber);
- }
- // Read immediate current command
- public bool ReadImmediateCurrentCommand(byte nNodeID, ref short nImmediateCurrentCommand)
- {
- return _ReadImmediateCurrentCommand(m_COMPort, nNodeID, ref nImmediateCurrentCommand);
- }
- // Read relative distance
- public bool ReadRelativeDistance(byte nNodeID, ref int nRelativeDistance)
- {
- return _ReadRelativeDistance(m_COMPort, nNodeID, ref nRelativeDistance);
- }
- // Read sensor position
- public bool ReadSensorPosition(byte nNodeID, ref int nSensorPosition)
- {
- return _ReadSensorPosition(m_COMPort, nNodeID, ref nSensorPosition);
- }
- // Read condition code
- public bool ReadConditionCode(byte nNodeID, ref ushort nConditionCode)
- {
- return _ReadConditionCode(m_COMPort, nNodeID, ref nConditionCode);
- }
- // Read command mode
- public bool ReadCommandMode(byte nNodeID, ref ushort nCommandMode)
- {
- return _ReadCommandMode(m_COMPort, nNodeID, ref nCommandMode);
- }
- // Read distance or position
- public bool ReadDistanceOrPosition(byte nNodeID, ref int nDistanceOrPosition)
- {
- return _ReadDistanceOrPosition(m_COMPort, nNodeID, ref nDistanceOrPosition);
- }
- // Write distance or position
- public bool WriteDistanceOrPosition(byte nNodeID, int nDistanceOrPosition)
- {
- return _WriteDistanceOrPosition(m_COMPort, nNodeID, nDistanceOrPosition);
- }
- // Read change distance
- public bool ReadChangeDistance(byte nNodeID, ref int nChangeDistance)
- {
- return _ReadChangeDistance(m_COMPort, nNodeID, ref nChangeDistance);
- }
- // Write change distance
- public bool WriteChangeDistance(byte nNodeID, int nChangeDistance)
- {
- return _WriteChangeDistance(m_COMPort, nNodeID, nChangeDistance);
- }
- // Read change velocity
- public bool ReadChangeVelocity(byte nNodeID, ref double dChangeVelocity)
- {
- return _ReadChangeVelocity(m_COMPort, nNodeID, ref dChangeVelocity);
- }
- // Write change velocity
- public bool WriteChangeVelocity(byte nNodeID, double dChangeVelocity)
- {
- return _WriteChangeVelocity(m_COMPort, nNodeID, dChangeVelocity);
- }
- // Read velocity move state
- public bool ReadVelocityMoveState(byte nNodeID, ref ushort nVelocityMoveState)
- {
- return _ReadVelocityMoveState(m_COMPort, nNodeID, ref nVelocityMoveState);
- }
- // Read P2P move state
- public bool ReadP2PMoveState(byte nNodeID, ref ushort nP2PMoveState)
- {
- return _ReadP2PMoveState(m_COMPort, nNodeID, ref nP2PMoveState);
- }
- // Read Q program segment number
- public bool ReadQProgramSegmentNumber(byte nNodeID, ref ushort nQProgramSegmentNumber)
- {
- return _ReadQProgramSegmentNumber(m_COMPort, nNodeID, ref nQProgramSegmentNumber);
- }
- // Read position offset
- public bool ReadPositionOffset(byte nNodeID, ref int nPositionOffset)
- {
- return _ReadPositionOffset(m_COMPort, nNodeID, ref nPositionOffset);
- }
- // Write position offset
- public bool WritePositionOffset(byte nNodeID, int nPositionOffset)
- {
- return _WritePositionOffset(m_COMPort, nNodeID, nPositionOffset);
- }
- // Read running current
- public bool ReadRunningCurrent(byte nNodeID, ref double dRunningCurrent)
- {
- return _ReadRunningCurrent(m_COMPort, nNodeID, ref dRunningCurrent);
- }
- // Write running current
- public bool WriteRunningCurrent(byte nNodeID, double dRunningCurrent)
- {
- return _WriteRunningCurrent(m_COMPort, nNodeID, dRunningCurrent);
- }
- // Read electronic gearing
- public bool ReadElectronicGearing(byte nNodeID, ref ushort nElectronicGearing)
- {
- return _ReadElectronicGearing(m_COMPort, nNodeID, ref nElectronicGearing);
- }
- // Write electronic gearing
- public bool WriteElectronicGearing(byte nNodeID, ushort nElectronicGearing)
- {
- return _WriteElectronicGearing(m_COMPort, nNodeID, nElectronicGearing);
- }
- // Read pulse counter
- public bool ReadPulseCounter(byte nNodeID, ref int nPulseCounter)
- {
- return _ReadPulseCounter(m_COMPort, nNodeID, ref nPulseCounter);
- }
- // Write pulse counter
- public bool WritePulseCounter(byte nNodeID, int nPulseCounter)
- {
- return _WritePulseCounter(m_COMPort, nNodeID, nPulseCounter);
- }
- // Read analog position gain
- public bool ReadAnalogPositionGain(byte nNodeID, ref ushort nAnalogPositionGain)
- {
- return _ReadAnalogPositionGain(m_COMPort, nNodeID, ref nAnalogPositionGain);
- }
- // Write analog position gain
- public bool WriteAnalogPositionGain(byte nNodeID, ushort nAnalogPositionGain)
- {
- return _WriteAnalogPositionGain(m_COMPort, nNodeID, nAnalogPositionGain);
- }
- // Read analog threshold
- public bool ReadAnalogThreshold(byte nNodeID, ref ushort nAnalogThreshold)
- {
- return _ReadAnalogThreshold(m_COMPort, nNodeID, ref nAnalogThreshold);
- }
- // Write analog threshold
- public bool WriteAnalogThreshold(byte nNodeID, ushort nAnalogThreshold)
- {
- return _WriteAnalogThreshold(m_COMPort, nNodeID, nAnalogThreshold);
- }
- // Read analogoffset
- public bool ReadAnalogOffset(byte nNodeID, ref ushort nAnalogOffset)
- {
- return _ReadAnalogOffset(m_COMPort, nNodeID, ref nAnalogOffset);
- }
- // Write analog offset
- public bool WriteAnalogOffset(byte nNodeID, ushort nAnalogOffset)
- {
- return _WriteAnalogOffset(m_COMPort, nNodeID, nAnalogOffset);
- }
- // Read accumulator
- public bool ReadAccumulator(byte nNodeID, ref int nAccumulator)
- {
- return _ReadAccumulator(m_COMPort, nNodeID, ref nAccumulator);
- }
- // Read user defined register
- public bool ReadUserDefinedRegister(byte nNodeID, char chRegister, ref int nValue)
- {
- return _ReadUserDefinedRegister(m_COMPort, nNodeID, chRegister, ref nValue);
- }
- // Write user defined register
- public bool WriteUserDefinedRegister(byte nNodeID, char chRegister, int nValue)
- {
- return _WriteUserDefinedRegister(m_COMPort, nNodeID, chRegister, nValue);
- }
- // Read brake release delay
- public bool ReadBrakeReleaseDelay(byte nNodeID, ref double dBrakeReleaseDelay)
- {
- return _ReadBrakeReleaseDelay(m_COMPort, nNodeID, ref dBrakeReleaseDelay);
- }
- // Write brake release delay
- public bool WriteBrakeReleaseDelay(byte nNodeID, double dBrakeReleaseDelay)
- {
- return _WriteBrakeReleaseDelay(m_COMPort, nNodeID, dBrakeReleaseDelay);
- }
- // Read brake engage delay
- public bool ReadBrakeEngageDelay(byte nNodeID, ref double dBrakeEngageDelay)
- {
- return _ReadBrakeEngageDelay(m_COMPort, nNodeID, ref dBrakeEngageDelay);
- }
- // Write brake engage delay
- public bool WriteBrakeEngageDelay(byte nNodeID, double dBrakeEngageDelay)
- {
- return _WriteBrakeEngageDelay(m_COMPort, nNodeID, dBrakeEngageDelay);
- }
- // Read analog filter gain
- public bool ReadAnalogFilterGain(byte nNodeID, ref ushort nAnalogFilterGain)
- {
- return _ReadAnalogFilterGain(m_COMPort, nNodeID, ref nAnalogFilterGain);
- }
- // Write analog filter gain
- public bool WriteAnalogFilterGain(byte nNodeID, ushort nAnalogFilterGain)
- {
- return _WriteAnalogFilterGain(m_COMPort, nNodeID, nAnalogFilterGain);
- }
- // Read alarm code
- public bool ReadAlarmCode_M3(byte nNodeID, ref uint nAlarmCode)
- {
- return _ReadAlarmCode_M3(m_COMPort, nNodeID, ref nAlarmCode);
- }
- // Read status code
- public bool ReadStatusCode_M3(byte nNodeID, ref uint nStatusCode)
- {
- return _ReadStatusCode_M3(m_COMPort, nNodeID, ref nStatusCode);
- }
- // Read driver board inputs
- public bool ReadDriverBoardInputs_M3(byte nNodeID, ref ushort nInputsStatus)
- {
- return _ReadDriverBoardInputs_M3(m_COMPort, nNodeID, ref nInputsStatus);
- }
- // Read driver board outputs
- public bool ReadDriverBoardOutputs_M3(byte nNodeID, ref ushort nOutputsStatus)
- {
- return _ReadDriverBoardOutputs_M3(m_COMPort, nNodeID, ref nOutputsStatus);
- }
- // Read encoder position
- public bool ReadEncoderPosition_M3(byte nNodeID, ref int nEncoderPosition)
- {
- return _ReadEncoderPosition_M3(m_COMPort, nNodeID, ref nEncoderPosition);
- }
- // Read 2nd encoder position
- public bool Read2ndEncoderPosition_M3(byte nNodeID, ref int nEncoderPosition)
- {
- return _Read2ndEncoderPosition_M3(m_COMPort, nNodeID, ref nEncoderPosition);
- }
- // Read immediate absolute position
- public bool ReadImmediateAbsolutePosition_M3(byte nNodeID, ref int nImmediateAbsolutePosition)
- {
- return _ReadImmediateAbsolutePosition_M3(m_COMPort, nNodeID, ref nImmediateAbsolutePosition);
- }
- // Read immediate actual velocity
- public bool ReadImmediateActualVelocity_M3(byte nNodeID, ref double dImmediateActualVelocity)
- {
- return _ReadImmediateActualVelocity_M3(m_COMPort, nNodeID, ref dImmediateActualVelocity);
- }
- // Read immediate target velocity
- public bool ReadImmediateTargetVelocity_M3(byte nNodeID, ref double dImmediateTargetVelocity)
- {
- return _ReadImmediateTargetVelocity_M3(m_COMPort, nNodeID, ref dImmediateTargetVelocity);
- }
- // Read immediate drive temperature
- public bool ReadImmediateDriveTemperature_M3(byte nNodeID, ref double dImmediateDriveTemperature)
- {
- return _ReadImmediateDriveTemperature_M3(m_COMPort, nNodeID, ref dImmediateDriveTemperature);
- }
- // Read immediate bus voltage
- public bool ReadImmediateBusVoltage_M3(byte nNodeID, ref double dImmediateBusVoltage)
- {
- return _ReadImmediateBusVoltage_M3(m_COMPort, nNodeID, ref dImmediateBusVoltage);
- }
- // Read immediate position error
- public bool ReadImmediatePositionError_M3(byte nNodeID, ref int nImmediatePositionError)
- {
- return _ReadImmediatePositionError_M3(m_COMPort, nNodeID, ref nImmediatePositionError);
- }
- // Read immediate analog input1 Value
- public bool ReadImmediateAnalogInput1Value_M3(byte nNodeID, ref short nImmediateAnalogInputValue)
- {
- return _ReadImmediateAnalogInput1Value_M3(m_COMPort, nNodeID, ref nImmediateAnalogInputValue);
- }
- // Read immediate analog input2 Value
- public bool ReadImmediateAnalogInput2Value_M3(byte nNodeID, ref short nImmediateAnalogInputValue)
- {
- return _ReadImmediateAnalogInput2Value_M3(m_COMPort, nNodeID, ref nImmediateAnalogInputValue);
- }
- // Read immediate analog Output1 Value
- public bool ReadImmediateAnalogOutput1Value_M3(byte nNodeID, ref short nImmediateAnalogOutputValue)
- {
- return _ReadImmediateAnalogOutput1Value_M3(m_COMPort, nNodeID, ref nImmediateAnalogOutputValue);
- }
- // Write immediate analog Output1 Value
- public bool WriteImmediateAnalogOutput1Value_M3(byte nNodeID, short nImmediateAnalogOutputValue)
- {
- return _WriteImmediateAnalogOutput1Value_M3(m_COMPort, nNodeID, nImmediateAnalogOutputValue);
- }
- // Read immediate analog Output2 Value
- public bool ReadImmediateAnalogOutput2Value_M3(byte nNodeID, ref short nImmediateAnalogOutputValue)
- {
- return _ReadImmediateAnalogOutput2Value_M3(m_COMPort, nNodeID, ref nImmediateAnalogOutputValue);
- }
- // Read immediate analog Output2 Value
- public bool WriteImmediateAnalogOutput2Value_M3(byte nNodeID, short nImmediateAnalogOutputValue)
- {
- return _WriteImmediateAnalogOutput2Value_M3(m_COMPort, nNodeID, nImmediateAnalogOutputValue);
- }
- // Read Q program line number
- public bool ReadQProgramLineNumber_M3(byte nNodeID, ref ushort nQProgramLineNumber)
- {
- return _ReadQProgramLineNumber_M3(m_COMPort, nNodeID, ref nQProgramLineNumber);
- }
- // Read immediate current command
- public bool ReadImmediateCurrentCommand_M3(byte nNodeID, ref short nImmediateCurrentCommand)
- {
- return _ReadImmediateCurrentCommand_M3(m_COMPort, nNodeID, ref nImmediateCurrentCommand);
- }
- // Read relative distance
- public bool ReadRelativeDistance_M3(byte nNodeID, ref int nRelativeDistance)
- {
- return _ReadRelativeDistance_M3(m_COMPort, nNodeID, ref nRelativeDistance);
- }
- // Read sensor position
- public bool ReadSensorPosition_M3(byte nNodeID, ref int nSensorPosition)
- {
- return _ReadSensorPosition_M3(m_COMPort, nNodeID, ref nSensorPosition);
- }
- // Read condition code
- public bool ReadConditionCode_M3(byte nNodeID, ref ushort nConditionCode)
- {
- return _ReadConditionCode_M3(m_COMPort, nNodeID, ref nConditionCode);
- }
- // Read command mode
- public bool ReadCommandMode_M3(byte nNodeID, ref ushort nCommandMode)
- {
- return _ReadCommandMode_M3(m_COMPort, nNodeID, ref nCommandMode);
- }
- // Read distance or position
- public bool ReadDistanceOrPosition_M3(byte nNodeID, ref int nDistanceOrPosition)
- {
- return _ReadDistanceOrPosition_M3(m_COMPort, nNodeID, ref nDistanceOrPosition);
- }
- // Write distance or position
- public bool WriteDistanceOrPosition_M3(byte nNodeID, int nDistanceOrPosition)
- {
- return _WriteDistanceOrPosition_M3(m_COMPort, nNodeID, nDistanceOrPosition);
- }
- // Read change distance
- public bool ReadChangeDistance_M3(byte nNodeID, ref int nChangeDistance)
- {
- return _ReadChangeDistance_M3(m_COMPort, nNodeID, ref nChangeDistance);
- }
- // Write change distance
- public bool WriteChangeDistance_M3(byte nNodeID, int nChangeDistance)
- {
- return _WriteChangeDistance_M3(m_COMPort, nNodeID, nChangeDistance);
- }
- // Read change velocity
- public bool ReadChangeVelocity_M3(byte nNodeID, ref double dChangeVelocity)
- {
- return _ReadChangeVelocity_M3(m_COMPort, nNodeID, ref dChangeVelocity);
- }
- // Write change velocity
- public bool WriteChangeVelocity_M3(byte nNodeID, double dChangeVelocity)
- {
- return _WriteChangeVelocity_M3(m_COMPort, nNodeID, dChangeVelocity);
- }
- // Read velocity move state
- public bool ReadVelocityMoveState_M3(byte nNodeID, ref ushort nVelocityMoveState)
- {
- return _ReadVelocityMoveState_M3(m_COMPort, nNodeID, ref nVelocityMoveState);
- }
- // Read P2P move state
- public bool ReadP2PMoveState_M3(byte nNodeID, ref ushort nP2PMoveState)
- {
- return _ReadP2PMoveState_M3(m_COMPort, nNodeID, ref nP2PMoveState);
- }
- // Read Q program segment number
- public bool ReadQProgramSegmentNumber_M3(byte nNodeID, ref ushort nQProgramSegmentNumber)
- {
- return _ReadQProgramSegmentNumber_M3(m_COMPort, nNodeID, ref nQProgramSegmentNumber);
- }
- // Read Command current
- public bool ReadCommandCurrent_M3(byte nNodeID, ref double dCommandCurrent)
- {
- return _ReadCommandCurrent_M3(m_COMPort, nNodeID, ref dCommandCurrent);
- }
- // Write Command current
- public bool WriteCommandCurrent_M3(byte nNodeID, double dCommandCurrent)
- {
- return _WriteCommandCurrent_M3(m_COMPort, nNodeID, dCommandCurrent);
- }
- // Read Max current
- public bool ReadMaximumCurrent_M3(byte nNodeID, ref double dMaximumCurrent)
- {
- return _ReadMaximumCurrent_M3(m_COMPort, nNodeID, ref dMaximumCurrent);
- }
- // Write Max current
- public bool WriteMaximumCurrent_M3(byte nNodeID, double dMaximumCurrent)
- {
- return _WriteMaximumCurrent_M3(m_COMPort, nNodeID, dMaximumCurrent);
- }
- // Read electronic gearing
- public bool ReadElectronicGearing_M3(byte nNodeID, ref uint nElectronicGearing)
- {
- return _ReadElectronicGearing_M3(m_COMPort, nNodeID, ref nElectronicGearing);
- }
- // Write electronic gearing
- public bool WriteElectronicGearing_M3(byte nNodeID, uint nElectronicGearing)
- {
- return _WriteElectronicGearing_M3(m_COMPort, nNodeID, nElectronicGearing);
- }
- // Read pulse counter
- public bool ReadPulseCounter_M3(byte nNodeID, ref int nPulseCounter)
- {
- return _ReadPulseCounter_M3(m_COMPort, nNodeID, ref nPulseCounter);
- }
- // Write pulse counter
- public bool WritePulseCounter_M3(byte nNodeID, int nPulseCounter)
- {
- return _WritePulseCounter_M3(m_COMPort, nNodeID, nPulseCounter);
- }
- // Read analog position gain
- public bool ReadAnalogPositionGain_M3(byte nNodeID, ref int nAnalogPositionGain)
- {
- return _ReadAnalogPositionGain_M3(m_COMPort, nNodeID, ref nAnalogPositionGain);
- }
- // Write analog position gain
- public bool WriteAnalogPositionGain_M3(byte nNodeID, int nAnalogPositionGain)
- {
- return _WriteAnalogPositionGain_M3(m_COMPort, nNodeID, nAnalogPositionGain);
- }
- // Read analog position gain
- public bool ReadAnalogVelocityGain_M3(byte nNodeID, ref double nAnalogVelocityGain)
- {
- return _ReadAnalogVelocityGain_M3(m_COMPort, nNodeID, ref nAnalogVelocityGain);
- }
- // Write analog position gain
- public bool WriteAnalogVelocityGain_M3(byte nNodeID, double nAnalogVelocityGain)
- {
- return _WriteAnalogVelocityGain_M3(m_COMPort, nNodeID, nAnalogVelocityGain);
- }
- // Read analog position gain
- public bool ReadAnalogTorqueGain_M3(byte nNodeID, ref double nAnalogTorqueGain)
- {
- return _ReadAnalogTorqueGain_M3(m_COMPort, nNodeID, ref nAnalogTorqueGain);
- }
- // Write analog position gain
- public bool WriteAnalogTorqueGain_M3(byte nNodeID, double nAnalogTorqueGain)
- {
- return _WriteAnalogTorqueGain_M3(m_COMPort, nNodeID, nAnalogTorqueGain);
- }
- // Read analog threshold
- public bool ReadAnalogThreshold1_M3(byte nNodeID, ref int nAnalogThreshold)
- {
- return _ReadAnalogThreshold1_M3(m_COMPort, nNodeID, ref nAnalogThreshold);
- }
- // Write analog threshold
- public bool WriteAnalogThreshold1_M3(byte nNodeID, int nAnalogThreshold)
- {
- return _WriteAnalogThreshold1_M3(m_COMPort, nNodeID, nAnalogThreshold);
- }
- // Read analog threshold
- public bool ReadAnalogThreshold2_M3(byte nNodeID, ref int nAnalogThreshold)
- {
- return _ReadAnalogThreshold2_M3(m_COMPort, nNodeID, ref nAnalogThreshold);
- }
- // Write analog threshold
- public bool WriteAnalogThreshold2_M3(byte nNodeID, int nAnalogThreshold)
- {
- return _WriteAnalogThreshold2_M3(m_COMPort, nNodeID, nAnalogThreshold);
- }
- // Read analogoffset
- public bool ReadAnalogOffset1_M3(byte nNodeID, ref int nAnalogOffset)
- {
- return _ReadAnalogOffset1_M3(m_COMPort, nNodeID, ref nAnalogOffset);
- }
- // Write analog offset
- public bool WriteAnalogOffset1_M3(byte nNodeID, int nAnalogOffset)
- {
- return _WriteAnalogOffset1_M3(m_COMPort, nNodeID, nAnalogOffset);
- }
- // Read analogoffset
- public bool ReadAnalogOffset2_M3(byte nNodeID, ref int nAnalogOffset)
- {
- return _ReadAnalogOffset2_M3(m_COMPort, nNodeID, ref nAnalogOffset);
- }
- // Write analog offset
- public bool WriteAnalogOffset2_M3(byte nNodeID, int nAnalogOffset)
- {
- return _WriteAnalogOffset2_M3(m_COMPort, nNodeID, nAnalogOffset);
- }
- // Read accumulator
- public bool ReadAccumulator_M3(byte nNodeID, ref int nAccumulator)
- {
- return _ReadAccumulator_M3(m_COMPort, nNodeID, ref nAccumulator);
- }
- // Read user defined register
- public bool ReadUserDefinedRegister_M3(byte nNodeID, char chRegister, ref int nValue)
- {
- return _ReadUserDefinedRegister_M3(m_COMPort, nNodeID, chRegister, ref nValue);
- }
- // Write user defined register
- public bool WriteUserDefinedRegister_M3(byte nNodeID, char chRegister, int nValue)
- {
- return _WriteUserDefinedRegister_M3(m_COMPort, nNodeID, chRegister, nValue);
- }
- // Read brake release delay
- public bool ReadBrakeReleaseDelay_M3(byte nNodeID, ref double dBrakeReleaseDelay)
- {
- return _ReadBrakeReleaseDelay_M3(m_COMPort, nNodeID, ref dBrakeReleaseDelay);
- }
- // Write brake release delay
- public bool WriteBrakeReleaseDelay_M3(byte nNodeID, double dBrakeReleaseDelay)
- {
- return _WriteBrakeReleaseDelay_M3(m_COMPort, nNodeID, dBrakeReleaseDelay);
- }
- // Read brake engage delay
- public bool ReadBrakeEngageDelay_M3(byte nNodeID, ref double dBrakeEngageDelay)
- {
- return _ReadBrakeEngageDelay_M3(m_COMPort, nNodeID, ref dBrakeEngageDelay);
- }
- // Write brake engage delay
- public bool WriteBrakeEngageDelay_M3(byte nNodeID, double dBrakeEngageDelay)
- {
- return _WriteBrakeEngageDelay_M3(m_COMPort, nNodeID, dBrakeEngageDelay);
- }
- // Read analog filter gain
- public bool ReadAnalogFilterGain1_M3(byte nNodeID, ref ushort nAnalogFilterGain)
- {
- return _ReadAnalogFilterGain1_M3(m_COMPort, nNodeID, ref nAnalogFilterGain);
- }
- // Write analog filter gain
- public bool WriteAnalogFilterGain1_M3(byte nNodeID, ushort nAnalogFilterGain)
- {
- return _WriteAnalogFilterGain1_M3(m_COMPort, nNodeID, nAnalogFilterGain);
- }
- // Read analog filter gain
- public bool ReadAnalogFilterGain2_M3(byte nNodeID, ref ushort nAnalogFilterGain)
- {
- return _ReadAnalogFilterGain2_M3(m_COMPort, nNodeID, ref nAnalogFilterGain);
- }
- // Write analog filter gain
- public bool WriteAnalogFilterGain2_M3(byte nNodeID, ushort nAnalogFilterGain)
- {
- return _WriteAnalogFilterGain2_M3(m_COMPort, nNodeID, nAnalogFilterGain);
- }
- // Write broadcast command
- public bool WriteBroadcastCommand(byte nNodeIDCount, byte[] aNodeIDArr, byte nFunctionCode)
- {
- bool ret = _WriteBroadcastCommand(m_COMPort, nNodeIDCount, aNodeIDArr, nFunctionCode);
- return ret;
- }
- // Execute multi-axes linear interpolation move
- public bool ExecuteLinearInterpolationMove(byte nNodeIDCount, byte[] aNodeIDArr, int[] aPosArr, uint nMaxLineSpeed, uint nAccelTimeInMs, bool bRelMove = true, bool bValidParamLimit = true)
- {
- bool ret = _ExecuteLinearInterpolationMove(m_COMPort, nNodeIDCount, aNodeIDArr, aPosArr, nMaxLineSpeed, nAccelTimeInMs, bRelMove, bValidParamLimit);
- return ret;
- }
- #endregion
- }
- }
|