Using Thorlabs DPC5500 with Matlab

2 views (last 30 days)
Fernando Souto
Fernando Souto on 13 Jun 2014
Answered: Vinod on 4 Jul 2014
Has anyone been able to interface the Thorlabs DPC5500 polarization controller with Matlab? The system uses VISA-TCPIP drivers, but after connecting the device, i cannot read any data out of the device. I used the NI I/O Trace application to look at the communications and it seems the viOpenDefaultRM session address is wrong. Is there a way of telling matlab to use specific session addresses? I suspect part of the problem is that matlab is using a generic type visa instrument, and there are no Thorlab instruments. Does anyone know of a good tutorial on how to create a new visa instrument in matlab? any information will be of great help.

Answers (3)

Vinod
Vinod on 4 Jul 2014
I think you need to look at the manual for the thorlabs device and see if the commands you are sending to get the instrument to respond are correct. I usually start with the *IDN? query and see if that works.

Vinod
Vinod on 14 Jun 2014
Can you point me to the driver you are using? Also if you haven't already, take a look at the documentation on using drivers in MATLAB .

Fernando Souto
Fernando Souto on 16 Jun 2014
Hi Vinod, I am using the latest NI VISA drivers (version 5.4) and the 2014 Instrument control toolbox. The output i get from the instrhwinfo is:
if true
% code
instrhwinfo
MATLABVersion: '8.3 (R2014a)'
SupportedInterfaces: {'gpib' 'serial' 'tcpip' 'udp' 'visa' 'Bluetooth' 'i2c' 'spi'}
SupportedDrivers: {'matlab' 'ivi' 'vxipnp'}
ToolboxName: 'Instrument Control Toolbox'
ToolboxVersion: '3.5 (R2014a)'
instrhwinfo('visa')
InstalledAdaptors: {'ni'}
JarFileVersion: 'Version 3.5'
vt=visa('ni','TCPIP::172.16.6.98::2402::SOCKET')
VISA-Generic Object Using NI Adaptor : TCPIP0::172.16.6.98::2402::SOCKET
Communication Address
Resource Address: TCPIP0::172.16.6.98::2402::SOCKET
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
instrhwinfo(vt)
AdaptorDllName: 'C:\Program Files\MATLAB\R2014a\toolbox\instrument\instrumentadaptors\w...'
AdaptorDllVersion: 'Version 3.5'
AdaptorName: 'NI'
VendorDllName: 'visa32.dll'
VendorDriverDescription: 'National Instruments VISA Driver'
VendorDriverVersion: 5.4100
end
using the tmtool, i can see the connection is created when i use fopen, and if i try to use the send data command ("hello world") it seems to be successful, but when i try to read the data back, i only receive a "?" instead of the data sent. I can use the NI MAX I/O Trace interface, i can see the commands sent by matlab
if true
% code
viWrite (TCPIP0::172.16.6.98::240... (0x00000001), "hello world.", 12, 12)
Process ID: 0x00001AE4 Thread ID: 0x00002AC0
Start Time: 08:47:05.294 Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)
Buffer Contents
00000000: 68 65 6C 6C 6F 20 77 6F 72 6C 64 0A hello world.
viRead (TCPIP0::172.16.6.98::240... (0x00000001), "?.?.", 512, 4)
Process ID: 0x00001AE4 Thread ID: 0x00002AC0
Start Time: 08:47:09.033 Call Duration 00:00:00.012
Status: 0 (VI_SUCCESS)
Buffer Contents
00000000: 3F 0A 3F 0A ?.?.
end
thank you very much for time and help! Fernando

Categories

Find more on Instrument Control Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!