Re: [micro-manager-general] ThorLabs APT 64 bit driver
Status: Beta
Brought to you by:
nicost
|
From: Egor Z. <ego...@ma...> - 2016-11-17 08:14:35
|
Hi Derin, > Thanks for the explanation re. APT.dll vs the APT software. No worries! > > I have a KDC101 so I can try to run your code when I have a free moment, and let you know what I get. > I thought about this a bit more, the HW_TYPE is derived from the first two digits of the controller's serial number. I had a look in the manual, and the type for the KDC101 controller seems to be 27 See https://www.thorlabs.com/drawings/113f92893b497f55-6CC6FDEC-5056-0103-79F2A517BB271B85/KDC101-KDC101ManualforAPT.pdf So, if we add this value in the ThorlabsAPTStage device adapter, it may just work with the KDC101. Need to add to ThorlabsAPTStage.cpp //not defined in APTAPI.h #define HWTYPE_KDC101 27 const char* g_ThorlabsDeviceNameKDC101 = "KDC101"; const char* g_ThorlabsDeviceDescKDC101 = "please fill this"; Then in InitializeModuleData: //KDC101 hola = GetNumHWUnitsEx(HWTYPE_KDC101, &plNumUnits); //if (plNumUnits >= 1) AddAvailableDeviceName(g_ThorlabsDeviceNameKDC101, g_ThorlabsDeviceDescKDC101); if (plNumUnits >= 1) RegisterDevice(g_ThorlabsDeviceNameTDC001, MM::StageDevice, g_ThorlabsDeviceDescKDC101); and in CreateDevice else if (strcmp(deviceName, g_ThorlabsDeviceNameKDC101) == 0) { hwType = HWTYPE_KDC101; } That's everything I think! Detecting devices and initialising them should be easier with my library and the type "HWTYPE_ANY" but for now, this will have to do. > > It would be cool to have a single adapter that supported all K-Cube devices. > Absolutely! Cheers, Egor > > Thanks, > Derin > > > > > On Nov 16, 2016, at 7:39 PM, Egor Zindy <ego...@ma...> wrote: > > > > Hello Derin, > > > > just to clear some confusion, > > > >> Unfortunately, the APT software is now legacy software and Thorlabs wants > >> everyone to switch to [Kinesis] APT. > > > > As I understand, there are two separate things Thorlabs calls APT: > > * The APT System Software, which you are right, is the legacy software > > platform based on ActiveX (now superseded by Kinesis) and > > * The APT Controllers Host-Controller Communications Protocol > > > > The APT DLL is an implementation of the latter, using a low-level > > library (D2XX) to directly send commands to the USB controllers, > > without the need for ActiveX or Kinesis. > > > > By the sound of it, what we're missing is the "type" value for the new > > KDC001 controllers which isn't defined in APTAPI.h. > > > > I made some progress towards rewriting the DLL using the > > cross-platform and open-source libftdi1 library. See > > https://github.com/zindy/libapt > > > > If you do manage to compile and run the test app, this will give us > > the APT Type value I need to recognise the KDC001 controller in the > > ThorlabsAPT device adapter. > > > > For example, if I run test_main with two TDC001 controllers attached, > > here is the output. It's quite messy (debug mode) but it will output > > the APT Model Number and APT Type for any Thorlabs APT controller > > plugged in via USB. > > > > Initialized libftdi 1.2 (major: 1, minor: 2, micro: 0, snapshot ver: unknown) > > Checking device: 0 > > Manufacturer: 'Thorlabs', Description: 'APT DC Motor Controller', > > Serial No: '83841000' > > Checking device: 1 > > Manufacturer: 'Thorlabs', Description: 'APT DC Motor Controller', > > Serial No: '83840847' > > Number of Thorlabs devices found: 2 > > > > Dev 0: 83841000 > > InitHWDevice txbuf (6 bytes): > > 0000 05 00 00 00 50 01 ....P. > > InitHWDevice rxbuf (90 bytes): > > 0000 06 00 54 00 81 50 c0 7a f2 04 54 44 43 30 30 31 ..T..P.z..TDC001 > > 0010 00 00 10 00 08 00 02 00 54 44 43 30 30 31 20 44 ........TDC001 D > > 0020 43 20 53 65 72 76 6f 20 44 72 69 76 65 00 00 00 C Servo Drive... > > 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > > 0040 00 00 00 00 00 00 00 00 31 30 33 38 31 39 41 75 ........103819Au > > 0050 67 00 08 00 02 00 00 00 01 00 g......... > > APT SerialNumber=83841000 > > APT Model Number='TDC001' > > APT Type=31 > > APT HardwareType=16 > > APT FirmwareVersion='2.0.8' > > APT Notes='TDC001 DC Servo Drive' > > APT HardwareVersion=2 > > APT ModState=0 > > APT Number of Channels=1 > > MOT_Identify txbuf (6 bytes): > > 0000 23 02 00 00 50 01 #...P. > > MOT_EnableHWChannel txbuf (6 bytes): > > 0000 10 02 01 01 50 01 ....P. > > MOT_MoveHome txbuf (6 bytes): > > 0000 43 04 01 00 50 01 C...P. > > MOT_MoveRelativeEx txbuf (12 bytes): > > 0000 48 04 06 00 d0 01 01 00 00 00 00 00 H........... > > MOT_MoveRelativeEx rxbuf (6 bytes): > > 0000 64 04 0e 00 81 50 d....P > > MOT_GetPosition txbuf (6 bytes): > > 0000 11 04 01 00 50 01 ....P. > > MOT_GetPosition rxbuf (12 bytes): > > 0000 12 04 06 00 81 50 01 00 00 00 00 00 .....P...... > > Position=0.00 > > > > Dev 1: 83840847 > > InitHWDevice txbuf (6 bytes): > > 0000 05 00 00 00 50 01 ....P. > > InitHWDevice rxbuf (90 bytes): > > 0000 06 00 54 00 81 50 c0 7a f2 04 54 44 43 30 30 31 ..T..P.z..TDC001 > > 0010 00 00 10 00 08 00 02 00 54 44 43 30 30 31 20 44 ........TDC001 D > > 0020 43 20 53 65 72 76 6f 20 44 72 69 76 65 00 00 00 C Servo Drive... > > 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > > 0040 00 00 00 00 00 00 00 00 31 30 33 38 31 39 41 75 ........103819Au > > 0050 67 00 06 00 02 00 00 00 01 00 g......... > > APT SerialNumber=83840847 > > APT Model Number='TDC001' > > APT Type=31 > > APT HardwareType=16 > > APT FirmwareVersion='2.0.8' > > APT Notes='TDC001 DC Servo Drive' > > APT HardwareVersion=2 > > APT ModState=0 > > APT Number of Channels=1 > > MOT_Identify txbuf (6 bytes): > > 0000 23 02 00 00 50 01 #...P. > > MOT_EnableHWChannel txbuf (6 bytes): > > 0000 10 02 01 01 50 01 ....P. > > MOT_MoveHome txbuf (6 bytes): > > 0000 43 04 01 00 50 01 C...P. > > MOT_MoveRelativeEx txbuf (12 bytes): > > 0000 48 04 06 00 d0 01 01 00 00 00 00 00 H........... > > MOT_MoveRelativeEx rxbuf (6 bytes): > > 0000 64 04 0e 00 81 50 d....P > > MOT_GetPosition txbuf (6 bytes): > > 0000 11 04 01 00 50 01 ....P. > > MOT_GetPosition rxbuf (12 bytes): > > 0000 12 04 06 00 81 50 01 00 00 00 00 00 .....P...... > > Position=0.00 > > > > Cleaning-up... > > > > Cheers, > > Egor > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > > micro-manager-general mailing list > > mic...@li... > > https://lists.sourceforge.net/lists/listinfo/micro-manager-general > > > ------------------------------------------------------------------------------ > _______________________________________________ > micro-manager-general mailing list > mic...@li... > https://lists.sourceforge.net/lists/listinfo/micro-manager-general |