Matlab DLL access examples

Matlab entries

Here's the starting point for Matlab developers for
interfacing Lawson Labs, Inc. data acquisition systems  Model 301 and Model 302
More information at our website.




LL_USB2k_64.dll and LL_USB2k_64.h Must be in path. The easiest may be to have in your
    user/Documents/MATLAB
folder and then use addpath to add it to your path.

This DLL archive contains both the DLL and a header file containing the prototypes of DLL entry points (function calls)

Get the DLL
More information about the function calls.



code examples below            


Load the DLL :
 
1.) Trial>> loadlibrary ('LL_USB2k_64', 'LL_USB2k_64')



Set up variables for connecting to device:


1.) Trial>> numdevices=uint8([1])

numdevices =

    1

2.) Trial>> devList = uint16([5206,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])

devList =

  Columns 1 through 18

   5206      0      0      0      0      0      0      0      0      0      0      0      0      0      0      0      0      0

  Columns 19 through 32

      0      0      0      0      0      0      0      0      0      0      0      0      0      0

3.) Trial>> rates = double([100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])

rates =

  Columns 1 through 21

   100     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0

  Columns 22 through 32

     0     0     0     0     0     0     0     0     0     0     0


Connect to device using EX_ConnectAllDevices (...):

 
1.) Trial>> [y,numdevices, devList, rates] = calllib('LL_USB2k_64', 'EX_ConnectAllDevices', numdevices, devList, rates)

y =

     1


numdevices =

    1


devList =

  Columns 1 through 18

   5206      0      0      0      0      0      0      0      0      0      0      0      0      0      0      0      0      0

  Columns 19 through 32

      0      0      0      0      0      0      0      0      0      0      0      0      0      0


rates =

  Columns 1 through 21

   100     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0

  Columns 22 through 32

     0     0     0     0     0     0     0     0     0     0     0


Set the polled mode channel and get one conversion:

 
1.) Trial>> polledModeChan=6

polledModeChan =

     6

Trial>> myDev = 5206

myDev =

        5206

Trial>> y = calllib('LL_USB2k_64', 'EX_SetPolledModeChan', myDev, polledModeChan)

y =

     1

Trial>> voltage=double([0])

voltage =

     0

Trial>> [y,voltage] = calllib('LL_USB2k_64', 'EX_GetOneConversion', myDev, voltage)

y =

     1


voltage =

   5.0000e+03

Trial>>



click any image to see larger view
Load DLL and Set up variables for connecting to device


Connect to DLL and read results


Create more variables and get voltage