|Name||Modified||Size||Downloads / Week|
|Totals: 2 Items||3.3 MB||13|
T-O-R-T-O-I-S-E-S-V-N A-C-C-E-S-S ********************************* For anonymous readonly, use the following URL: http://svn.code.sf.net/p/canusb/code/trunk -OR PROJECT DEVELOPERS- Use this link and log in with your Sourceforge username / password. Project admins / developers will have read/write access. All others will have read only access https://svn.code.sf.net/p/canusb/code/trunk * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * INTRODUCTION NOTES: CANUSB Library in C# with example program. 19/10/2014 OPEN the following solution in VisualStudio ./ExampleProgram/ExampleProgram.sln Question: What drivers do you need for this application to work with my CANUSB device? Answer: Only the 'FTDI USB Drivers (version ?.?.?) are need If not already installed they will be requested when when you first plug your CANUSB adaptor in Question: Where do I get these drivers from? Answer: If you use the latest CANUSB adaptor (identified by having a +# next to the CE mark) they will be automatically installed via windows update. If you have the old CANUSB adaptor (identified by having a # next to the CE mark) then... I have included the latest FTDI drivers with this project. Find them and installation instructions in ./FTDIdrivers/ ---OR-- You can use the drivers avaliable on the http://www.can232.com/ website. Navigate to Downloads->CANUSB Download Download the files under the link 'FTDI USB drivers (version ?.?.?)' If you are already using you CANUSB adaptor these drivers may already be installed Question: Do I need to install the 'CANUSB DLL driver for Windows X', provided from the canusb website too? Answer: No. This DLL is not used. The whole point of this project is to avoid having to install these drivers. Many of the functions are provided by this DLL are implemented by this library in C#. Question: What is included in this package? Answer: The latest FTDI USB driver is supplied here (only needed for 'old' adaptors) ./FTDI USB Driver The solution ./ExampleProgram/ExampleProgram.sln Contains two projects: The first project ./ExampleProgram/ExampleProgram.prj Is a simple Windows GUI that uses the CANUSB Library (FTDICANUSB) The second project ./FTDICANUSB/FTDICANUSB.prj Provides your application a library to access the CANUSB hardware. It talks directly to the FTDI USB Driver. Question: Who calls what? Answer: Your Application (in this case 'ExampleProgram') ^ | V FTDICANUSB (CANUSB C# Library) ^ | V FTDI USB Driver (From www.ftdi.com, with VIP PID modified) ^ | V Hardware (CANUSB adaptor) Background information: The CANUSB adaptor requires a simple FTDI USB Driver. It will be requested when you connect your CANUSB adaptor for the first time. When you write your application, it is impractical to talk directly to this FTDI USB Driver because it implements an ASCII based message protocol. For details of this protocol see "Available CANUSB ASCII Command" in ./FTDICANUSB/Documents/canusb_manual.pdf What is provided by the manufacturer is a DLL that acts as a translator between your application and the FTDI USB driver. When your application calls the Open() function of the DLL, The DLL sends the relevant messages to the FTDI USB driver and waits for a response. When received the DLL returns a PASS/FAIL to the Open() function call. Simple: You call the DLL functions - the DLL generates the ASCII messages, sends it and parses the response. Motivation behind this project The DLLs provided by the manufacturer are not 'managed code' (http://en.wikipedia.org/wiki/Managed_code) They were not designed for modern languages (C#/VB/Mono) that use managed code. If you wish to call 'unmanaged code' from 'managed code', you need to use a 'C# wrapper' to access the DLL. This wrapper uses 'PInvoke' (like peek/poke) to 'martial' calls from managed to unmanaged code. It sounds complicated, and it is. IT IS ALSO TOTALLY UNNESSASSERY. Why not have the DLL as managed code?? Why not simply reference the library in your project and just call its functions?? This project does just that. Advantages are: Is Open Source Can be compiled as 32/64 bit Can be linked with your project and distributed with your application. AVOID separate DLL install steps that fill the system directory and Program Files with unnecessary files No problems with permissions when updating / installing your application Your application and CANUSB C# Library are linked together - installed as one and updated as one, AVOID 'old DLLs' hanging around waiting to cause problems with your new application release. Add a reference in your VisualStudio project and just start calling functions - AVOID this 'PInvoke' / unmanaged code wrapper madness Works with one of the cheapest CAN hardware devices out there.. http://www.canusb.com/ CANUSB C# Library can also be compiled with Mono instead of VS2010 I hated working with DLLs.. callbacks from an unmanaged code that bloats the system directory.. that needs permissions to install.. cant be recompiled and so on.. If you are working with C#, then this is the right way to do it.. Some keywords: CAN USB adaptor C# library 64bit CANUSB Managed code .NET library with no DLL nonsense LAWICEL canusb.com!