Here's the starting point for Matlab developers for
interfacing Lawson Labs, Inc. data acquisition systems
More information about the Model201 at
M201_SP.dll Must be in path. The easiest may be to have it in your
folder and then use addpath to add it to your path.
archive contains both the DLL and a header file.
Examples of how to use M201_SP.dll with Matlab
Here is a link to the
loaded by the DLL when
uInt8 EX_InitDev (void);
is called prior to sending or recieving.
You should set up the DLL using the
listing of function calls along with their parameters and what they do
Note that the prototypes are the same for Matlab as for Labview which is what the information at the link
mentions them being for.
An example of changing a parameter is, after making a call to EX_InitDev, a call to EX_SetCOMport can be made to set
the COM port, as well as many other calls to tailor the functioning of the DLL to your needs. Below is how that call looks:
COM_port = 2
retCode = EX_SetCOMport(COM_port);
It will set the COM_port to COM3. Note that this call uses zero-based port numbers.
Below is an example of Matlab code (and Matlab's responses) to load the DLL and make some calls into the DLL to get a
conversion in Polled mode, using a "Trial" copy of Matlab
Load the DLL
1.) Trial>> loadlibrary ('M201_SP', 'M201_SP')
2.) Trial>> retCode=0
3.) Trial>> retCode = calllib('M201_SP', 'EX_InitDev')
Set the polled mode channel and get one conversion
4.) Trial>> bMainChan=1
5.) Trial>> bSubChan = 0
6.) Trial>> retCode = calllib('M201_SP', 'EX_SetPolledModeChan', bMainChan, bSubChan)
7.) Trial>> bSubChan = 0
8.) Trial>> milliVolts=double()
9.) Trial>> [retCode,voltage] = calllib('M201_SP', 'EX_GetOneConversion', milliVolts)
The entire API can be seen
Further reference to coding in Matlab can be seen in our
64-bit DLL examples. To make use of the examples there, replace all references to M201_SP_64bit with M201_SP