Home
CNC USB Controller API User manual 2010-09-20
Contents
1. function CmdSpindle out num integer direction SPINDLE speed double ERROR function CmdSpindleNow out num integer direction SPINDLE speed double ERROR Function parameters Name Type Description Return value ERROR ERROR code num out int Command identifier direction SPINDLE Spindle direction output Speed double Spindle speed not implemented 22 1 5 14 CmdCoolant CmdCoolantNow Function will set flood and mist coolant Output pins will turn on off Command with Now suffix will not be buffered and will execute immediately Function declarations function CmdCool function CmdCool ERROR CmdCoolant out int num ERROR CmdCoolantNow out int num ant out num integer fl integer antNow out num Function parameters Name Type Description O Return value ERROR calling convention attributes are not displayed COOLANT f1 ood COOLANT mist COOLANT flood COOLANT mist ood mist COOLANT ERROR flood mist COOLANT ERROR ERROR code Command identifier Flood output Mist output 23 1 5 15 CmdNothing Function will do nothing Function declarations calling convention attributes are not displayed ERROR CmdNothing out int num function CmdNothing out num integer Function parameters Name Type Description Return value ERROR ERROR code num out in
2. 1 5 4 SetDeviceParams Function will set machine parameters You must call this before any other controller command functions Function declarations calling convention attributes are not displayed ERROR SetDeviceParams byte microstepping int axislStepsPerMM int axis2StepsPerMM int axis3StepsPerMM int axis4StepsPerMM int axisLimitSwitch doubl axislBacklash double axis2Backlash double axis3Backlash double axis4Backlash double axislAccel double axis2Accel double axis3Accel double axis4Accel double axislInitSpeed double axis2InitSpeed double axis3InitSpeed double axis4InitSpeed function SetDeviceParams axislStepsPerMM axis2StepsPerMM axis3StepsPerMM axis4StepsPerMM integer axisLimitSwitch integer axislBacklash axis2Backlash axis3Backlash axis4Backlash double axislAccel axis2Accel axis3Accel axis4Accel double axislInitSpeed axis2InitSpeed axis3InitSpeed axis4InitSpeed double ERROR Function parameters Name Type j Descipin Cd Return value ERROR ERROR code axisStepsPerMM int Number of steps per millimeter axisLimitSwitch int Bit encoded limit switch existence axisBacklash double Backlash in millimeters axisAccel double Acceleration in mm 2 sec 25 is default axisInitSpeed double Speed in mm sec 14 1 5 2 Cmdlnfo Function will force controller to send us new state information Function declarations
3. calling convention attributes are not displayed ERROR CmdInfo out int num function CmdInfo out num integer Function parameters Name Type Description Return value ERROR ERROR code num out int Command identifier 1 5 3 CmdWrite Function will force controller to internally store position and settings Function declarations calling convention attributes are not displayed E i ERROR CmdInfo out int num function CmdInfo out num integer Function parameters Name Typpe jDescipio O Return value ERROR ERROR code num out int Command identifier 15 1 5 4 CmdMoveAxes Function will move axes to specified absolute position Function declarations calling convention attributes are not displayed ERROR CmdMoveAxes out int num double posA double posB double posC doubl double speed bool startAccel bool endAccel function CmdMoveAxes out num integer posA posB posC posD double Speed double startAccel endAccel BOOL ERROR Function parameters Name Type Return value ERROR ERROR code ut R num o int Command identifier posA posB posC posD double Target position in millimeters Speed double Speed in millimeters per second startAccel bool True if we want to accelerate at start endAccel bool True if we want to decelerate at end 16 1 5 5 CmdMoveAxesDelta Function will move axes
4. serialNumber function GetHidDeviceInfo vid pid integer out vendorName productName serialNumber WideString Function parameters Name Type Description Return value ERROR ERROR code 1 3 6 GetHidDevicelnfoByName Function will return device vendor product name and serial number Function declarations calling convention attributes are not displayed ERROR GetHidDeviceInfoByName MarshalAs UnmanagedType string device MarshalAs UnmanagedType out string vendorName MarshalAs UnmanagedType out string productName MarshalAs UnmanagedType out string serialNumber function GetHidDeviceInfoByName device WideString out vendorName productName serialNumber WideString Function parameters Name Type jDescipion 1 Return value ERROR ERROR code 1 4 Controller functions 1 4 4 Connect Function will initialize HID subsystem and connect API to controller Function declarations calling convention attributes are not displayed E O ERROR Connect function Connect ERROR Function parameters Name Type Description Return value ERROR ERROR code 1 4 2 Disconnect Function will disconnect API from controller and close HID subsystem Function declarations calling convention attributes are not displayed E i Ox ERROR Disconnect function Disconnect ERROR
5. subsystem Function declarations calling convention attributes are not displayed E idFinalize ERROR HidFinalize function HidFinalize Function parameters Name Type Description 1 Return value ERROR ERROR code 1 3 3 CheckHidlnitialized Function will check if HID subsystem is initialized Function declarations calling convention attributes are not displayed return MarshalAs UnmanagedType Bool bool CheckHidInitialized function CheckHidInitialized BOOL Function parameters Name Type jDescipion Return value bool True if HID is initialized 1 3 4 GetHidDeviceList Function will return list of all HID devices Function declarations calling convention attributes are not displayed ERROR GetHidDeviceList MarshalAs UnmanagedType BStr out string deviceList function GetHidDeviceList out deviceList WideString Function parameters Name Type Description Return value ERROR ERROR code deviceList out string List of all HID devices 1 3 5 GetHidDevicelnfo Function will return device vendor product name and serial number Function declarations calling convention attributes are not displayed ERROR GetHidDeviceInfo int vid int pid MarshalAs UnmanagedType BStr out string vendorName MarshalAs UnmanagedType BStr out string productName MarshalAs UnmanagedType BStr out string
6. CNC USB Controller API User manual 2010 09 20 Table of Contents 1 APIMRO SONCE sist chee ilk cack eee A ze en one 4 11 INTO THREE 4 1 2 General fUNCIONA S sie A ZM cda quat 5 db GADOULG n cie detenti e mata pauta nadie Uva dete 5 1 37 WAND funtion en D T SALES Ra Ga 6 LIT MAAN ZG oe Sects cece acer em etc oa dotata e ce rad RE ee utr eod paa od ttam ac Sx BER SENE 6 132 HEN IZ iori eit iege toc oti Oe Et eumd eve s 6 1 33 GheckHidInitialize o MN T TI 7 PSA il A en etes d aaah haat aes ace sciat Ia orent ants 7 1 3 5 Get dDevicelhfo eh oto t ed dete 8 1 3 6 GetHidDevicelnfoByNalrie cnra tur tepore erui enc oce enel vr pes eoo ee cioe Du 8 1 4 gt Gontrollerfunetions s a an tosta en ep ate ed edel pce reset Malan Annes ciel 9 T T COMAL serat cde De A oe iN de obeh tiene eine da 9 142 JDISGOREIIGGL oie et en uS eb E RICO D T ROSE oder e ATI 9 1 4 3 JTSGOBDOCIOGQ uui ee RR P RR IDE a a ge Ru ah AA lie dans 9 144 CAD Ora ad 10 1 4 5 GetDevicelnfoE Xa ox e or eat e te a e oe t ten de eo an dl th 11 1 4 6 Regi terotatuslallback x s ius 1 ER Eon eg d eo uin eoe tras 12 TAT RegisterDatacallbacikes sion e a sea opc eni E eeoa Toer 12 148 OE OE na Pe rct xA EA d dos ID Od e dt A 13 1 5 Controller command functions 14 19 1 SeeD eV e alae ooo eene or Mee aet tet oct oe ae ius tuve oet Ne ME 14 SE AA BENS ea he heads este hi ho neath ol de ly a este beu daa 15 ToS OMAMNO ss on a eie ed tete etatis eiu
7. Command identifier 1 5 11 CmdResume CmdResumeNow Function will resume paused controller Command with Now suffix will not be buffered and will execute immediately Function declarations calling convention attributes are not displayed E i ERROR CmdResume out int num function CmdResume out num integer Function parameters Name Type Description OO Return value ERROR ERROR code num out int Command identifier 20 1 5 12 CmdOut CmdOutNow Function will turn output pins on or off Command with Now suffix will not be buffered and will execute immediately Function declarations calling convention attributes are not displayed ERROR CmdOut out int num byte output ERROR CmdOutNow out int num byte output function CmdOut out num integer output byte ERROR function CmdOutNow out num integer output byte ERROR Function parameters Name Type jDescipio OO Return value ERROR ERROR code num out int Command identifier output byte Value of output pins 21 1 5 13 CmdSpindle CmdSpindleNow Function will set spindle Output pins will turn on off Command with Now suffix will not be buffered and will execute immediately Function declarations calling convention attributes are not displayed ERROR CmdSpindle out int num SPINDLE direction double speed ERROR CmdSpindleNow out int num SPINDLE direction double speed
8. Function parameters Name Type Description Return value ERROR ERROR code 1 4 3 IsConnected Function will check if API is connected to controller Function declarations calling convention attributes are not displayed return MarshalAs UnmanagedType Bool bool IsConnected function IsConnected BOOL Function parameters Name Type Description Return value bool True if controller is ready 1 4 4 GetDevicelnfo Function will return vendor and product name of controller Function declarations calling convention attributes are not displayed ERROR GetDeviceInfo MarshalAs UnmanagedType BStr out string vendorName MarshalAs UnmanagedType BStr out string productName MarshalAs UnmanagedType Bool out bool diy function GetDevicelnfo out vendorName productName WideString out diy BOOL ERROR Function parameters Name Type jDescipion Return value ERROR ERROR code vendorName out string www planet cnc com productName out string CNC USB Controller True if controller id DIY version DIY version is limited to 25 moves 10 1 4 5 GetDevicelnfoEx Function will return vendor and product name of controller Function declarations calling convention attributes are not displayed ERROR GetDeviceInfoEx MarshalAs UnmanagedType BStr out string vendorName MarshalAs UnmanagedType BStr out string
9. aCallback TDataCallback ERROR Function parameters Name Type Description Return value ERROR ERROR code dataCallback DataCallback Callback for receiving controller events 12 1 4 8 GetState Function will return last state received from controller Function declarations calling convention attributes are not displayed ERROR GetState out CNC CODE code out byte bufferFree out int numExecuting out byte keysLimit out byte keysJog out int posA out int posB out int posC out int posD out byte output function GetState out code CNC CODE out bufferFree byte out numExecuting integer out keysLimit keysJog byte out posA posB posC posD integer out output byte ERROR Function parameters Name Z j Tye Descipion O Return value ERROR ERROR code code out CNC CODI Status code bufferFree O byte amount of free buffer ut numExecuting out int number of executing command t byte state of limit and jog keys keysLimit keysJog O u posA posB posC posD out int position of axis in steps out byte state of controller output output 13 1 5 Controller command functions Commands with names starting with Cmd are actual commands send to controller All command functions returns number num which uniquely identifies command On DataCallback callback you can identify which command is currently executing
10. as dta mese 29 1 API Reference 1 1 Introduction All functions are exported using stdcall calling convention Following attributes are used for all described functions const string CNCUSB DLL cncusb dll DllImport CNCUSB DLL SetLastError false ExactSpelling true CharSet CharSet Unicode CallingConvention CallingConvention StdCall public static extern const CNCUSB DLL cncusb dll function stdcall external cncusb dll Be careful when using boolean in Delphi Delphi types Boolean BOOL and LongBool are NOT the same You must always use BOOL with this API Also use WideString instead of string 1 2 General functions 1 2 4 About Function will return information about this API calling convention attributes are not displayed Function declarations ERROR About MarshalAs UnmanagedType BStr out string msg function About out msg WideString Function parameters Name Typ Description y O Return value ERROR ERROR code msg out string Information about this API 1 3 HID functions 1 3 1 Hidlnitialize Function will initialize HID subsystem Function declarations calling convention attributes are not displayed E idInitialize ERROR HidInitialize function HidInitialize Function parameters Name Type jDescipion Return value ERROR ERROR code 1 3 2 HidFinalize Function will close HID
11. byte bufferFree int numExecuting byte keysLimit byte keysJog int posA int posB int posC int posD byte output type TDataCallback procedure code CNC CODE bufferFree byte numExecuting integer keysLimit keysJog byte posA posB posC posD integer output byte stdcall Function parameters Name Type Description code CNC CODE status code bufferFree amount of free buffer numExecuting int number of executing command keysLimit byte state of limit keys keysJog state of jog keys posA position of axis in steps posB i position of axis in steps posC int position of axis in steps posD i position of axis in steps output state of controller output 27 1 6 5 CNC CODE Type byte Name Value Description o y O OK 1 general info everything is OK Pos 2 general info everything is OK Stop 3 Machine cleared buffer and stopped Error 8 error command is ignored 1 6 6 PLANE Type byte Name Value Description 000 1 6 7 SPINDLE Type byte Name Value Description O 1 6 8 COOLANT Type byte Name Value Description 0 0 O Off 1 coolant is off On 2 coolant is on 28 2 Examples 2 1 CNCUSBControllerAPI demo CNCUSBControllerAPI demo is example application written in CF 29
12. i essei fco 15 1 594 EMANAN Si tone tae mbi od eo ei retro volj kiksi 16 1 5 5 CmaMoveAxesbDella nee A NE eie cec rac eben sols ae erba epe 17 Do0 CMAPROS M CER 18 IESU NE Cu Bid ee e do NE NO 18 1 5 8 CAE SON ult erra ascia seco hele eta tenis ie dar heat a leh ed 19 PI SII OD sence meon tute mouth eaa ania s eit ice 19 1 5 10 CmdPause GmdPatseloOW nee uera eee E BRE eee duds 20 1 5 11 CmdResume CmdResumeNow Rm nnne nnn nenne nennen 20 1 5 12 CmdOut CmdOutNow a ctr Ex Ee a nti ees 21 1 5 13 CmdSpindle CmdSpindleNow ee 22 1 5 14 CmdCoolant CmdCoolantNow ene 23 1 5 15 CMdNOINIG e oa ERE a Na ao oi A te Sla pedi aaa ees 24 1 6 Codes constants callbacks ur ere AE ia 25 T1 bsl o AA A messen ER a LL ahaa dei 25 1 6 2 Status codes ete cte o ee see dak Lt ee ee oec ee veo eve es ove seb eo ooi 25 1 6 3 StatusGallback o dE o Re ERAS 26 1 64 7 DataGallback ERU Ies 27 TO ENE CODE Sora ena e t b Mettre wee i e AE ee bbs E Ie U optet tees 28 1160 PLANE weve ses a a BUDE cote ae tel A IE 28 16 SRINDEE oa te dnt E te oe e Dee iste oe S 28 1 0 8 GOOLAN TD iiit ioc cette ds oe ro en e co ete exeo c E on cx nat ain Ee Doc Ee ex cane suce vede ol 28 2 RO DCUM m dES 29 ZN ZADO NIN Tm cet ea a eee gs odes cos oe cheat de o a Me RE 29 22 HiD nforrmoation cece keke ee td ove deponi ius 29 2 3 Working with CORtroller uuo veneti tt e coe oe ae rea Ies Gedeon
13. mdDwell out num integer seconds double ERROR Function parameters Name Type Description Return value ERROR ERROR code num out int Command identifier seconds double Delay duration in seconds 18 1 5 8 CmdEStop Function will stop execution clear outputs and clear all buffer On DIY controllers it will alse reset move counter Function declarations calling convention attributes are not displayed ERROR CmdEStop out int num function CmdEStop out num integer ERROR Function parameters Name Type Description Return value ERROR ERROR code num out int Command identifier 1 5 9 CmdStop Function will stop execution and clear all buffer Function declarations calling convention attributes are not displayed E i ERROR CmdStop out int num function CmdStop out num integer ERROR Function parameters Name Type JjDescipio Return value ERROR ERROR code num out int Command identifier 19 1 5 10 CmdPause CmdPauseNow Function will pause the controller Command with Now suffix will not be buffered and will execute immediately Function declarations calling convention attributes are not displayed E i ERROR CmdPause out int num function CmdPause out num integer ERROR Function parameters Name Type Description Return value ERROR ERROR code num out int
14. productName MarshalAs UnmanagedType Bool out bool diy out int serialNumber out byte ver year out byte ver month out byte ver day function GetDevicelnfoEx out vendorName productName WideString out diy BOOL out serialNumber integer out ver year ver month ver day byte Function parameters Name Type Description Return value ERROR code vendorName string www planet cnc com productName string CNC USB Controller True if controller id DIY version DIY version is limited to 25 moves rialNumber int roll rial number 11 1 4 6 RegisterStatusCallback Function will register status callback Status callback will trigger when USB state is changed Function declarations calling convention attributes are not displayed ERROR RegisterStatusCallback StatusCallback statusCallback function RegisterStatusCallback statusCallback TStatusCallback ERROR Function parameters Name Type Description Return val ERROR code statusCall StatusCallback Callback for receiving HID status events 1 4 7 RegisterDataCallback Function will register data callback Data callback will trigger when API receives data from controller Function declarations calling convention attributes are not displayed ERROR RegisterDataCallback DataCallback dataCallback function RegisterDataCallback dat
15. t Command identifier 24 1 6 Codes constants callbacks 1 6 1 Error codes Type int Name jVaue Description SUCCI 0x00000000 command completed successfully 0x00000001 command failed 0x00000002 command is not implemented 0x00000003 HID is initialized 0x00000004 controll is not found 0x00000005 controll is not ready 0x00000006 1 is not connected END FAILI 0x00000007 send failed 0x00000008 license is invalid R RAWDATA 0x00000009 raw data is invalid EVICE PARAMS 0x0000000A device parameters are not correct 1 6 2 Status codes Type int Name Value jDescipon 0 nothing happened ler has just connected to USI DISCONNE 1 controller has just disconnected from US controller is unplugged it will be disconnected error in data transmission 25 1 6 3 StatusCallback Callback for changes in UBS state Function declarations public delegate void StatusCallback STATUS status type TStatusCallback procedure status STATUS stdcall Function parameters Name Type Description 1 1 1 status STATUS STATUS code 26 1 6 4 DataCallback Callback for changes in controller state Function declarations public delegate void DataCallback CNC CODE code
16. to specified relative position calling convention attributes are not displayed Function declarations ERROR CmdMoveAxesDelta out int num double posDeltaA double posDeltaB double posDeltaC double posDeltaD double speed bool startAccel endAccel bool integer double ERROR function CmdMoveAxesDelta out num posDeltaA posDeltaB posDeltaC posDeltaD l BOOL startAccel endAccel double speed Function parameters Name Type ER ERROR code Return value Command identifier Delta position in millimeters ltaA posDelt r second ltaC BSD GER Speed in millimeters pe rue if we want to accelerate at start m speed rate at end rue if we want to decel startAccel endAccel 17 1 5 6 CmdPos Function will set position of axes without axes movement Function declarations calling convention attributes are not displayed ERROR CmdPos out int num double posA double posB double posC double posD function CmdPos out num integer posA posB posC posD double ERROR Function parameters Name Type jDescipio Return value ERROR ERROR code num out int Command identifier posA posB posC posD double Position in millimeters 1 5 7 CmdDwell Function will delay controller Function declarations calling convention attributes are not displayed ERROR CmdDwell out int num double seconds function C
Download Pdf Manuals
Related Search
Related Contents
Bosch UPA-2450-50 power supply unit Advanced Elements AE1001 Network Card User Manual (FR) Philips LivingColors Mini Kenwood LZ-612IR User's Manual Samsung Färglaserskrivare multifunktion 3-i-1 CLX-3305 Une institutionnalisation des arts du cirque en EPS 取扱説明書 HC100 Good User Guide 5018D-MTLN4F Copyright © All rights reserved.
Failed to retrieve file