Table of Contents
Read this FIRST

Quick start

Some Questions and Answers

note: code archives may not contain most recent DLL

C# code example

C/C++ code examples

VisualBasic Code Examples

LabView Code Examples


C++ Prototyping

VisualBasic Prototyping

LabView Prototyping


download the following archives

Get just  most recent  DLL
( mentioned elsewhere in the above links )
- updated 8-11-08 -
important note:  Mangled Name Fix   on this date


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-28-07 -






























































Version 8,11,2008,0
1.) Fixed problem with name-mangling of some function calls:
      _EX_GetScanIntervalMinMax@8
      _EX_SetToMaxScanInterval@0
      _EX_SetToMinScanInterval@0
      _EX_SetToUserScanInterval@4
The fixed names are as follow:
      EX_GetScanIntervalMinMax
      EX_SetToMaxScanInterval
      EX_SetToMinScanInterval
      EX_SetToUserScanInterval

The mangling of these function names was noticed, and fixed on this date. Please be sure that if you have any older applications, using the mangled names, that you replace them with the non-mangled versions if using this version DLL or later.

2.) Added external function call:
      DLL_SendPacket(UINT uiCmd, UINT uiArg); This was added in order to give the ability to send an external control code while scanning. Below is the information to do that, showing VB prototype and code:

     Declare Function DLL_SendPacket Lib "M201_SP.dll" _
	       (ByVal bToken As Byte, ByVal bArg As Byte) As Byte
     Note Byte as return value in VB

     CONTROL CODE COMMAND   Token = Hex 1 followed by arg

     bArg:
     The lowest 4 bits control optically coupled output bits A, B, C, & D 
     on the 25-pin DB connector. The next 3 bits select the A/D analog input 
     channel (0 through 7). The most significant bit is ignored.

     EXAMPLE:
     To set channel 6
     dim bRetVal, bToken, bArg, as byte
     bToken = 1: bArg = 96  '96 = binary 110 0000 = channel 6
     bRetVal = DLL_SendPacket(bToken, bArg)
back to top




























































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 channelsubChanbiPolargainLogScans
  You should  never  set the following manually in the .ini file:
BAUDremoteAvgtScan RateScanIntervalwordCntfilterSubChannels
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
linked to below


New on 4-14-2010
LabView   example using EMF16
right-click link above to download archive
( choose "save target as" to download )
--  updated 11-5-10  --

Demonstrates using LabView with the  EMF16.

See a screenshot  HERE

The example in this archive makes use of the following VIs:
    mainScan.vi  (the main VI)
    Load_ini.vi
    SetLengthOfRunSec.vi
    ExRunScan.vi
    ReadScanDataDbl.vi
    ExStopScan.vi
The archive includes the IniTool.exe utility to create and configure a .ini configuration file to set things such as rate, channels, COM port, etc. The mainScan.vi is used to access all the other VI's. There are also a couple of calls into the DLL within the mainScan.vi using the advanced "Call Library Function".

The SetLengthOfRunSec.vi allows you to set the number of seconds that you want the scan to run. After the set time has elapsed the scan stops automatically. The INI configuration utility includes the ability to set the DLL to log the data to a disk file, memory (which the VI reads), or both disk file and memory. An example log file output is included within the archive.


Prior To 4-14-2010
LabView   example #1
( start with this one )

LVSamp.zip  ( large download - 1.9meg )  contains  _main_.vi  - the main sample VI for use with LabView, all documentation, and the special  IniTool.exe  used to create the configuration file for use with the sample VI. Be sure to read  READ_1st_LV.htm  ( within the archive )  prior to loading the VI, for information concerning a configuration file that must be made  PRIOR TO  loading the VI.

The sample VI demonstrates everything required to connect to the M201, change channels, read a single voltage in polled mode, and read continuous data in scanning mode. The documentation in  LVSampStart.htm  contains a pictorial guide to running the VI, and the other HTML documentation included in the archive contains complete information on using the  IniTool.exe  configuration tool and the DLL API available for the developer to access all the functions of the M201.

LabView   example #2

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 #3

This example is not well documented at this time

The link above goes directly to a file folder where you can download the example code Read the documentation within the VIs to understand the processes.































































Link to -->  Developer's API and Documentation


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

© Lawson Labs Inc. All rights reserved