Table of Contents
Read this FIRST

Quick start

Some Questions and Answers


C/C++ code examples

VisualBasic Code Examples

LabView Code Examples

MatLab Code Examples ( requires 64-bit DLL )

MatLab Code Examples 32-bit
  ( * new 10-17-16 * )



C++ Prototyping

VisualBasic Prototyping

LabView Prototyping


download the following archives

Get just the DLL
( mentioned elsewhere in the above links )
- updated 3-10-06 -


Get just the 64-bit DLL (and header file)
requires 64-bit app - made with MatLab in mind
but will work with any 64-bit built app

- updated 3-24-15 -


Get just the .INI file
( mentioned elsewhere in the above links )


Get just the INI creation software
( mentioned elsewhere in the above links )
- updated 3-8-06 -






























































About Configuration Settings
- some things you need to know -

The special .INI file that is included with this distribution allows for setup of the device configuration without having to do it programmably and may be useful for someone who is creating software for distribution that will always use the same configuration aside from something like setting of the COM port. The .INI file is never used unless it is loaded with the function call  EX_SetDevToIniSetup ( ).
  IMPORTANT: below is a list of the only changes that can safely be made manually to the .INI file if you intend to make use of it with your software
  by using the above mentioned function call. Other changes need to be made indirectly using the ini configuration tool.
comPortsingleChanScanMainChansingleChanScanSubChan channelsubChanbiPolar gainLogScans
  You should  never  set the following manually in the .ini file:
BAUDremoteAvgtScan RateScanIntervalwordCnt filterSubChannels
There are function calls that allow you to create a new .ini file based on your current device configuration as well as calls to display the contents of the .ini file using a windows message box. You can see the configuration related function calls   HERE.  It's important to remember that the .ini file is only a convenience and is not required or even looked at by the DLL unless you make the function call mentioned above that loads it. The DLL always loads with a   default  configuration and there are function calls available to change each and every one of the configuration parameters.

The scan interval setting is one of the entries that appears within the .INI file, and one that should never be changed manually within that file. If the default isn't good for you, then use the special   "IniTool.exe"  utility (downloaded from our website) or the DLL function calls designed for that purpose. It's recommended that you become familar with the definition of and usage of the scan interval by reading the Q/A topic   HERE.   After reading the information at the previous link, you may understand that a range of possible settings for the scan interval cannot be determined until other parameters such as number of scan channels, filter settings, internal averaging, are known. The DLL always loads with default configuration parameters as described   HERE.  Those settings will work together without conflict. Having a default configuration serves a generic function of allowing a developer to quickly test the function of the Model-201 with a simple function call -   EX_Run(). It is likely that a developer will want something other than default settings except for testing purposes.

A complete set of function calls into the DLL is provided to allow each of the configuration parameters to be both set and also checked. These function calls can be reviewed   HERE,   with even more settings HERE.  It's important to note that the final setting should always be made to the scan interval since the range at which it can be set is influenced by other configuration parameters as discussed further up.































































The easist way to get started
Quick start

Follow the link to documentation that explains how to get started, and lists all available function calls.
There is also a "question and answer" section and links to function call prototypes





























































Source code examples
you can copy and paste directly from the html (at each link below) into your application
C/C++   example #1

Demonstrates using "EX_Run()" and "EX_Stop()" to start scanning and logging to disk file using all default settings.
Also shows how to setup pointers (in header file) for calling DLL functions and the way to use those pointers.

C/C++   example #2

Demonstrates using EX_SetCOMport for setting correct COM port prior to starting the run. Also demonstrates using "EX_Run()" and "EX_Stop()".
Also shows how to setup pointers (in header file) for calling DLL functions and the way to use those pointers.

C/C++   example #3

Demonstrates using M201_SP.INI for startup configuration as well as the use of "EX_Run()" and "EX_Stop()".
Also shows how to setup pointers (in header file) for calling DLL functions and the way to use those pointers.

C/C++   example #4

Demonstrates non-scan mode usage. The DLL automatically attempts to initialize the hardware the first time any of the calls shown below are made.

In the sample code I've also shown the function, "EX_GetOneConversion()" which allows reading a single voltage at any time. Take note of the setting of the desired "Polled Mode" channel prior to reading the voltage. I've also shown changing the channel and handling the Digital I/O.





























































Source code examples
you can copy and paste directly from the html into your application
VisualBasic   example #1

Demonstrates using "EX_Run()" and "EX_Stop()" to start scanning and logging to disk file using all default settings.
Also shows how to prototype function calls into the DLL.

VisualBasic   example #2

Demonstrates a lot of functionality available for configuring device, polled and scanning mode, digital I/O, and more.
Also shows how to prototype function calls into the DLL.





























































Source code examples
LabView   example #1

Demonstrates using  "EX_Run()"  and  "EX_Stop()"  to start scanning and logging to disk file using all default settings.

Demonstrates using  "EX_SetPolledModeChan()"  to set a polled mode channel and  EX_GetOneConversion()  to get the voltage on that channel.

Also shows how to prototype function calls into the DLL.

LabView   example #2
This example is not well documented at this time
The link above goes directoy to a file folder where you can download the example code
Read the documentation within the VIs to understand the processes.

Demonstrates a lot of functionality available for configuring device for a multi-channel scan. Although the focus of a lot of the functionality of this new interface revolves around the use of the M201_SP.INI file to make configuration handling simpler, these examples show a way to start with a special initialization function and then call various configuration related function calls within the DLL to custom tailor the way the device is configured.

One example provided here shows the process making use of the .INI file to start a multi-channel scan, and the other shows the same process without the use of the .INI. Note that the .INI file is provided as a convenience and is not required as is demonstrated within the example provided here that makes no use of that file.





























































Matlab DLL access examples

Matlab entries

Here's the starting point for Matlab developers for
interfacing Lawson Labs, Inc. data acquisition systems  Model 201



M201_SP_64bit.dll and M201_SP_64bit.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.



==============================
Load the DLL and set the port:
==============================

1.) >>loadlibrary('M201_SP_64bit', 'M201_SP_64bit')

note: the following is 0 based. If your windows COM port is 5, make this 4
2.) >>result=calllib('M201_SP_64bit', 'EX_SetCOMport', 4)

===========================
To get a single conversion:
===========================

note: set main chan 6 (zero based) and sub-chan (only valid if multiplexer used) to 0

1.) >>result=calllib('M201_SP_64bit', 'EX_SetPolledModeChan', 6, 0)

note: create a variable of type double
3.) >>volts = 0

note: make it a pointer that can be passed in function call
4.) >>volts_pntr=librpointer('doublePtr', volts)

5.) >>result=calllib('M201_SP_64bit', 'EX_GetOneConversion', volts_pntr)

note: read the data from the variable pointer
6.) >>get(volts_pntr)

=====================================
To get scan data for a single channel:
=====================================
1.) >>result=calllib('M201_SP_64bit', 'EX_SetScanType', 0)

note: the following code is hex 60 (see it as main chan 6, sub chan 0)
2.) >>result=calllib('M201_SP_64bit', 'EX_SetSingleChanScanChanCode', 96)

3.) >>result=calllib('M201_SP_64bit', 'EX_Run')

wait for a while as data is written to log file (ScanLog_xxx.txt) in same folder as DLL

4.) >>result=calllib('M201_SP_64bit', 'EX_Stop')

results of scan will be in ScanLog_xxx.txt in same folder as DLL. The "xxx" will be a numeric value of the instance of the scan - for example the name for the first scan would be ScanLog_0.txt, the second would be ScanLog_1.txt

when finished, call
5.) >>unloadlibrary('M201_SP_64bit')


Get the 64-bit  DLL  and header file.


click any image to see larger view
Load DLL and get one conversion


Load DLL and start scan for continued data to data file


Results of scan (channel 6, full-scale) in ScanLog_x.txt





























































Developer's API and Documentation





Contact us for sales or technical assistance
lawsnlab@lawsonlabs.com

© Lawson Labs Inc. All rights reserved