WARNING:
JavaScript is turned OFF. None of the links on this concept map will
work until it is reactivated.
If you need help turning JavaScript On, click here.
This Concept Map, created with IHMC CmapTools, has information related to: How to program USBIO24R, USB IO 24 R from Elexol from Elexol Command Set, Which are needed ? files for using the .lib methods How to program the unit, THE CONSTRUCTOR ----------------------- __fastcall USBIO24R::USBIO24R(TComponent* Owner) { isOpen = false; // initially device is not open ftHandle = NULL; } ???? int __fastcall USBIO24R::Open() { int devNum = 0; // returns FT_OK if device is successfully opened // or FT_DEVICE_NOT_OPENED if not successful if (isOpen) return FT_OK; // device is already open ftStatus = FT_Open(devNum,&ftHandle); // ftHandle assigned here if (!FT_SUCCESS(ftStatus)) return FT_DEVICE_NOT_OPENED; Data.BaudRate = FT_INDEX_BAUD_115200; Data.DataBits = FT_INDEX_DATA_BITS_8; Data.StopBits = FT_INDEX_STOP_BITS_1; Data.Parity = FT_INDEX_PARITY_NONE; Data.FlowControl = FT_INDEX_FLOW_NONE; Data.RtsHi = true; Data.DtrHi = true; Data.Xon = 0x11; Data.Xoff = 0x13; Data.EventChar = 0; Data.ErrorChar = 0; Data.EventCharEnabled = false; Data.ErrorCharEnabled = false; Data.CtsHi = false; Data.DsrHi = false; Data.DcdHi = false; Data.RingHi = false; Data.RxTimeout = FT_DEFAULT_RX_TIMEOUT; Data.TxTimeout = FT_DEFAULT_TX_TIMEOUT; Data.EventMask = 0; if (SetPort()!=FT_OK) { FT_Close(ftHandle); return FT_DEVICE_NOT_OPENED; } ftStatus = FT_GetModemStatus(ftHandle,&Status); if (!FT_SUCCESS(ftStatus)) { FT_Close(ftHandle); return FT_DEVICE_NOT_OPENED; } if (Status & 0x00000010) Data.CtsHi = true; else Data.CtsHi = false; if (Status & 0x00000020) Data.DsrHi = true; else Data.DsrHi = false; isOpen = true; // signals a successful opening return FT_OK;, class USBIO24R ???? Your code files, Purchase Invoice from Elexol Datasheet, Opening a device Writing to the device Reading from the device C++ Builder Which are needed ?, Programming a motor and position reader off an old printer, using the USB IO24R from Elexol. ???? USB IO 24 R from Elexol, Purchase Invoice from Elexol Command Set, Your code files C++ Opening a device Writing to the device Reading from the device, Uses the FTDI FTD2xx.lib file of routines. Using C++ all you need to do is include the file in the project and include both the FTD2xx.h and Config.h files in the uMain.cpp file #include <vcl.h> #pragma hdrstop #include "uMain.h" #include "FTD2xx.h" #include "config.h" ???? To configure the connection use the following code ... void __fastcall TfrmMain::btnConfigureClick(TObject *Sender) { myDevice->ConfigurePort(); }, Last working class test files. Writing and reading to the device, involves opening, w/r, then closing the device. Works well. ???? THE CLASS DECLARATION ------------------------------ //-------------------------------------- class USBIO24R ------------ class USBIO24R { private: bool isOpen; // true when device is opened char buffer[5]; ULONG BytesWritten; FT_HANDLE ftHandle; FT_STATUS ftStatus; ULONG Status; TFtConfigData Data; int __fastcall SetPort(); int __fastcall Open(); // open the device // Dec 3 2011 moved here void __fastcall Close(); // close the device // Dec 3 2011 moved here public: __fastcall USBIO24R(TComponent* Owner); // default constructor bool __fastcall IsDeviceOpen() {return isOpen;}; ULONG __fastcall WriteToPort(char *buf,int length); // eg !A0 or A8 int __fastcall ReadFromPort(char port); // eg a or b or c void __fastcall ConfigurePort(); // open a window and configure the port };, Uses the FTDI FTD2xx.lib file of routines. Using C++ all you need to do is include the file in the project and include both the FTD2xx.h and Config.h files in the uMain.cpp file #include <vcl.h> #pragma hdrstop #include "uMain.h" #include "FTD2xx.h" #include "config.h" ???? In the uMain.h file, declare a pointer to the object private: // User declarations USBIO24R *myDevice;, THE CONSTRUCTOR ----------------------- __fastcall USBIO24R::USBIO24R(TComponent* Owner) { isOpen = false; // initially device is not open ftHandle = NULL; } ???? void __fastcall USBIO24R::Close() { if (ftHandle) { // ftHandle is NULL until successful openening FT_Close(ftHandle); } isOpen = false; }, Last working class test files. Writing and reading to the device, involves opening, w/r, then closing the device. Works well. Dec 3 2011 Your code files, How to program the unit USB IO 24 R from Elexol, class for a USBIO24R object class and configure form Example code to test the USB device, Last working class test files. Writing and reading to the device, involves opening, w/r, then closing the device. Works well. ???? THE CONSTRUCTOR ----------------------- __fastcall USBIO24R::USBIO24R(TComponent* Owner) { isOpen = false; // initially device is not open ftHandle = NULL; }, Uses the FTDI FTD2xx.lib file of routines. Using C++ all you need to do is include the file in the project and include both the FTD2xx.h and Config.h files in the uMain.cpp file #include <vcl.h> #pragma hdrstop #include "uMain.h" #include "FTD2xx.h" #include "config.h" ???? Opening a device Writing to the device Reading from the device, FTD2xx.lib Make sure you have the correct version. If you get strange linker error messages, you may have the wrong library file., FTD2xx.lib from FTDI Which are needed ?
FTD2XX.LIB
FTD2XX.dll
Command Set
CONFIG.CPP
CONFIG.h
Config.cpp
classUSBIO24R_Tester_v1
Main
Main
USBIO24R_Datasheet
D2XXAPP.BPR
classUSBIO24R_Tester_v1.bpr
111121-USB IO 24 Purchase Elexol
111121-Exexol USBIO24R