Frequently Asked Questions - answers to questions concerning: |
polled or scan mode, what is BOOLEAN, scan interval, data rate, what happens during a RUN, etc. |
API Reference |
Configuring - Initializing - Operating |
Configuration setting - you will need to configure first | |
There is a utility which can be used to configure the M201, so that you don't need to worry about the complexities of changing the configuration. You can also change the configuration programmatically. | |
|
Initialization and Calibration | |
The initialization process involves establishing communication with the M201 and setting all the programmable variables to the values stored in the configuration. The last step in initialization is normally a self-calibration. | |
|
Run | |
These functions are provided for simplified scanning mode operation. They combine the initialization and calibration above with a command to begin scanning. | |
|
Digital I/O | |
Digital I/O is available anytime after initialization. | |
|
Do not scroll page beyond this point | |
Information further down this page is linked to from above and possibly even other web pages. Scrolling to it may make it appear to be out of context. |
Basic Configuration The function calls below are used to change the configuration under program control. To change a fixed configuration see IniTool.exe |
see also: misc. config, use default config, all config options |
Misc Configuration Functions below are used for misc device configuration. |
see also: basic config, use default config, all config options |
click links to find out more - including prototypes |
============================================= MISC CONFIGURATION - affects both polled and scan mode ---- ============================================= BOOLEAN EX_SetGain (BYTE bGain) BOOLEAN EX_GetGain (BYTE* pbGain) BOOLEAN EX_SetRemoteAverage (BYTE bAvg) BOOLEAN EX_GetRemoteAverage (BYTE* pbAvg) BOOLEAN EX_SetPolarity (BYTE bPolarity) BOOLEAN EX_GetPolarity (BYTE* pbPolarity) BOOLEAN EX_SetFilter (USHORT pusFilter) BOOLEAN EX_GetFilter (USHORT* pusFilter) ========================= SCAN MODE MISC OPTIONS ---- ========================= BOOLEAN EX_SetLengthOfRunMs (UINT uiMilliseconds) BOOLEAN EX_SetLengthOfRunSec (UINT uiSeconds) BOOLEAN EX_SetRunEndBeepOptions (BOOLEAN _fUseBeep, UINT uiBeepFreqMs, UINT uiBeepDurationMs, UINT uiBeepIntervalSec, UINT uiBeepTimeoutSec) BOOLEAN EX_StopRunEndBeep (void) |
The following is a way to get back to a safe starting point with device set to default configuration. |
Initialize The function call below is used to establish communication with the device and to set all the programmable variables to the values stored in the configuration. |
to configure, use one or more of the following: basic config, misc. config, use default config, all config options |
click link shown below to find out more - including prototype |
Calibration The function calls below are used for calibration |
click links shown below to find out more - including prototype |
Scanning The function calls below are used for scanning |
click links shown below to find out more - including prototype |
Digital I/O Two function calls to write/read digital I/O |
click links shown below to find out more - including prototype |
Calibration Three function calls for calibration |
click links shown below to find out more - including prototypes |
A complete system calibration is performed with each signon. A new signon occurs whenever a new run is started. |
Use for reading the data into your application |
Channel Setup for Multi-Channel Scanning |
|
Channel Setup for Single-Channel Scanning |
|
Default configuration |
|
Data Log Option - BIT settings |
DEFINITION | Flag Bit | What it means |
USE_SCAN_DATA_LOG_FILE | 0x1 | Write data to disk log file |
USE_SCAN_DATA_ARRAY | 0x2 | Write data to memory to be read by application. |
SCAN_STOP_ON_DATA_ARRAY_WRAP | 0x4 | Stop run if memory data buffer wraps (also known as "buffer overflow"
or "buffer overrun") See reasons for wrap just below. |
SCAN_LIMIT_LOG_FILE_SIZE | 0x8 | Limit size of disk file. Size of disk file is based on another parameter used in function call. |
FOR EXAMPLE | ||
To test and set flags using C style language: UINT uiFlags = uiFlagsToTestAndSet; if(uiFlags & 0x1) printf("USE_SCAN_DATA_LOG_FILE flag is set"); if(uiFlags & 0x2) printf("USE_SCAN_DATA_ARRAY flag is set"); |
||
/* clear all but last flag */ uiFlags = uiFlags & 0x1; uiFlagsToTestAndSet = uiFlags; |
||
/* clear all but "SCAN_STOP_ON_DATA_ARRAY_WRAP" flag */ uiFlags = uiFlags & 0x4; uiFlagsToTestAndSet = uiFlags; |
||
/* set all four of the flags shown */ uiFlags = 0xF; |
||
Reasons for data buffer wrap |
Scan Termination |
Signon - what it means |
Frequently Asked Questions this will be added to as required |
Q: What is the difference between POLLED and SCAN mode? |
A:
After initialization, the M201 is in polled mode until a start scan command is issued.
In polled mode, the M201 will respond to any command including digital I/O, channel change, get conversion, etc. Digital I/O commands can still be used after a scan is started, with some limitaions. When scanning, a pre-defined data sequence is sent continuously until a stop scan command is sent. |
Q: What's the easiest way to start running? |
A:
Use the
configuration utility provided
at the preceding link to configure the M201, then call EX_Run (). The M201 will
start scanning and continue to scan until stopped with a call to EX_Stop (). The data will be
written to a log file, memory, or both depending on the settings chosen using the IniTool configuration utility.
|
Q: What is meant by "BOOLEAN" |
A:
This data type is confusing to some - especially to non-C++ programmers.
The BOOLEAN data type represents TRUE or FALSE but is ONLY an 8-bit data type which is the same as a BYTE, Byte, unsigned char, uInt8, and other such names associated with 8-bits of data. Unlike the "bool", "Bool", "BOOL", "Boolean", (note the case) or other such names used to represent "TRUE" or "FALSE", this data type requires only 8-bits rather than the 16 or 32 of some of the other types. When prototyping the function calls, you can use any naming condusive to your programming language to represent the 8-bit return type. For example, in this documentation there is reference using a C++ language prototype to the function call: BOOLEAN EX_Run(void) Although C++ programmers can use the same prototype as shown here, VisualBASIC programmers should prototype like this: Declare Function EX_Run Lib "M201_SP.dll" () As Byte LabView programmers would have something like: uInt8 EX_Run(void); C programmers would have something like: unsigned char EX_Run(void); |
Q: What is meant by " Scan Interval" |
A:
The M201 has the ability to scan at a specified interval within a particular range as described below.
The minimum scan interval is dependent on various configuration parameters such as the internal data rate, number of channels (and sub-channels if any) being scanned, filtering, in-device averaging, etc. The maximum scan interval is the maximum amount of time that can expire between each time that the M201 performs a scan, and is limited only by limitations on the size of the M201 onboard counters. The M201 is only able to count within a certain limit in order to create a delay between scans which is the reason for a maximum scan interval. It's unlikely that the maximum scan interval would not be sufficient for most needs. You can set the scan interval to any value that falls between the "minimum and maximum" scan interval returned by a call to, EX_GetScanIntervalMinMax(...). |
Q: What is meant by "Data Rate" | A: The internal data rate can be set to any value between 10Hz and 1000Hz. The internal data rate determines the frequency response. The cutoff frequency is 1/4 of the data rate. |
Q: What is meant by  "RUN?" | A: The "RUN" function combines initialization, calibration, and a start scan command. It may be the easiest way to use the M201 in scanning mode, especially, combined with the initool.exe for setting the configuration. |
Q: Where will the data go during a scan? | A: The data will be sent to a disk file, "ScanLog_x.txt" with the "x" being a numeric value which is incremented with each new RUN. Each time the run begins, the numeric value will be one greater than that of the greatest value of any existing file in the working directory. It is up to you to remove any log files you are no longer interested in. Failure to do so could result in many such files accumulating within the application directory. The writing of that log file is the default functionlaity, but the handling of the scanned data can be manipulated in a number of ways. There are function calls which can be used to write the data to a memory buffer, which the application can access in order to, for example, graph the data in real-time. Functionality is provided to use a combination of both the disk file and memory buffer or just one or the other. |
Q: What is meant by "one SCAN worth of data" |
A:
One SCAN is one reading for each selected channel.
In scanning mode, all seleced channels are read, in sequence, at the start of a scan. The M201 then waits until the scan interval has elapsed to begin the next scan. In single-channel scanning, one scan is simply one data point. When a "self calibration" scan is performed, the full scale and offset calibration values are also returned along with the SCAN data so for a 96 channel scan, there would be 98 voltages returned. See the multi-channel selection guide for information concerning proper channel selection for doing a multi-channel scan, and single-channel selection guide for information concerning proper channel selection for performing a single-channel type of scan. See the following documentation for channel selection related prototyping information: EX_GetMultiChanScanChanCodes(...) EX_SetMultiChanScanChanCodes(...) EX_GetSingleChanScanChanCode(...) EX_SetSingleChanScanChanCode(...) |
Q: I've somehow configured things in such a way that I can no longer run. Can I  get back to
a default configuration so I can try again? |
A:
Sometimes you may find that you've configured things in such a way that you can no longer run and are not sure
what you've done, or how to fix it. If you've saved a previous configuration that was working correctly and saved
it to the "M201_SP.INI" file, then it's just a matter of reloading the configuration with a call to,         EX_SetDevToIniSetup ( ). If you haven't yet run, or suspect that the .ini configuration file may have invalid values, all that is required is that you make a call to         EX_Reset ( ) followed by whatever you need to reconfigure everything to fit your needs. In other words, after calling EX_Reset ( ), just follow the instructions starting at the top of this html document or go to the beginning of the frequently asked questions HERE. When you finally configure everything the way you want, you can save it for easy reloading next time with a call to:         EX_WriteCurrentSetupToIniFile ( ) anytime before you exit, and then next time you load your application make a call to:         EX_SetDevToIniSetup ( ) An alternative to trying to configure everything using the function calls provided and discussed in this documentation, is to use the IniTool.exe configuration utility provided at our website . The "IniTool.exe" tool will allow you to easily setup a configuration that can be saved to the M201_SP.INI file and then loaded as previously explained. The utility has the ability to make an entirely new M201_SP.INI file even if one does not currently exist, or change any one of the parameters within that file. |
Converting "signed integer" ( 32-bit ) data to voltage |
|
Sample of M201_SP.INI configuration file |
;======================================== ;======================================== ;THIS FILE MUST BE PLACED IN WINDOWS DIRECTORY ;This file is used by file, "M201_SP.DLL" but ; may also be used by any application file. ;The DLL uses the contents of this file only if ; and after a call has been made to the DLL ; function EX_SetDevToIniSetup(). ;If you use it for your own application avoid ; removing any of the following entries since ; doing so may create erroneous behaviour of ; the the DLL. Feel free to add some of your ; own entries or modify the values of the ones ; shown below to fit your needs. ;======================================== ;======================================== [MAIN] TXQUEUESIZE=16 RXQUEUESIZE=32000 ;serial buffer sizes. Best to leave these ;as they are. (TX=16 RX=32000) BAUD=0 ;0 = 9600 ;1 = 4800 ;2 = 2400 ;3 = 1200 ;4 = 600 ;5 = 300 comPort=0 ;0 = COM1 ;1 = COM2 ;2 = COM3 ;3 = COM4 ;add 1 to value entered to get COM port number remoteAvg=1 ;remote averaging, in powers of 2 ;valid entries limited to: 1, 2, 4, 8, 16, 32, 64, or 128 tScan=1 ;type of scan 0 = single channel, 1 = normal, 2 = normal with calibration singleChanScanMainChan=0 ;main channel to use when in single-channel scan mode singleChanScanSubChan=0 ;sub channel to use when in single-channel scan mode Rate=60 ;internal data rate ScanInterval=0 ;Interval between scans. ;A value of zero will cause scanInterval to be set ; to minimum value by the DLL next time a scan is run. channel=0 ;Polled mode main channel (0,1,2,3,4,5) subChan=0 ;Polled mode subChannel wordCnt=3 ;3 for 24 bit resolution, 2 for 16 bits biPolar=1 ;1= bipolar or 0= unipolar filter=2 ; =0 for 4 Hz filter ; =1 for 40 Hz filter ; =2 for 400 Hz filter, recommended for faster operation gain=1 ;gain factor (power of 2) ;valid entries limited to: 1, 2, 4, 8, 16, 32, 64, or 128 LogScans=1 ;1 = Log scan data to disk only ;2 = Log scan data to memory only ;3 = Log scan data to memory and disk ;NOTE: the log file can become awkwardly large depending on scan rate & duration. [SubChannels] ; Sub-Channels to scan are defined for each A/D channel. ; The sub channel values are 8-bit codes, also known as "external control codes". ; The upper nibble names the starting subchannel and the lower nibble names ; the ending subchannel. An entry of 16 causes the channel to be skipped. ; For example, to scan sub-channels 2 through 4 first you set the low ; channel 2 by multiplying it by 16 which causes it to shift over and ; become the upper nibble of the channel code. Next you add on the high ; channel 4 which sets it into the low nibble. The result of that process ; would then be 24 HEX (note the "2 and 4"), 36 DECIMAL (hard to tell which ; channels are set when shown in decimal format), or in binary "0010 0100" ; (note the "2" bit set in the upper nibble and "4" bit set in low nibble). ; The process is the same for any channel combination - first you multiply ; the low channel by 16 and then add the high to it. 0 = 21 ;equals 15 HEX so scan sub channels 1-5 1 = 55 ;equals 37 HEX so scan sub channels 3-7 2 = 34 ;equals 22 HEX so scan sub channels 2-2 (ONLY 2 in other words) 3 = 16 ;equals 10 HEX code indicating this channel is inactive 4 = 16 ;equals 10 HEX code indicating this channel is inactive 5 = 16 ;equals 10 HEX code indicating this channel is inactive [MISC] IsEMF=1 ; The channel labeling for the M201 is for programmers, and is 0 based ; The labeling for the EMF16 is for users, so the first channel is #1 ; set to 0 for 0-based labeling.
lawsnlab@lawsonlabs.com on the web www.lawsonlabs.com © Lawson Labs Inc. All rights reserved Last modified 3-23-06 Tim Van Dusen |