| 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 |
|
The API link groups below contain additional links to expanded definitions for each API call important: Each expanded definition contains links to function-call prototypes which contain even more detailed information. Please be sure to follow the prototype link that is the closest to your language, ie; C# developers look at C++ prototypes. |
| 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 |
|
=========================== == Configuration ==================== =========================== EX_SetCOMport ( byte bCOMport ) Sets COM port. This is zero based - for COM1=0, COM2=1, etc. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetCOMport ( byte* bCOMport ) Gets COM port. This is zero based - for example COM1=0, COM2=1, etc. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetRate ( double Rate ) Sets data rate Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetRate ( double* Rate ) Gets current data rate Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetPolledModeChan ( BYTE bMainChan, BYTE bSubChan ) Sets current main and sub-channel to be used while in polled mode. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetPolledModeChan ( BYTE* pbMainChan, BYTE* pbSubChan ) Gets current main and sub-channel that would be used while in polled mode. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetSingleChanScanChanCode ( BYTE bChanCode ) Sets current main and sub-channel to be used in single-channel scanning. IMPORTANT: see Channel Setup (single ) for proper usage. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetSingleChanScanChanCode (BYTE* pbChanCode ) Gets current main and sub-channel to be used in single-channel scanning. IMPORTANT: see Channel Setup (single ) for proper usage. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetMultiChanScanChanCodes ( BYTE bChan0, BYTE bChan1, BYTE bChan2, BYTE bChan3, BYTE bChan4, BYTE bChan5, BOOLEAN fUpdateIni ) Sets current scan channels (and sub-channels if any) to be used for multi-channel scanning. IMPORTANT: see Channel Setup for proper usage. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetMultiChanScanChanCodes ( BYTE* bChan0, BYTE* bChan1, BYTE* bChan2, BYTE* bChan3, BYTE* bChan4, BYTE* bChan5, BYTE* bTotalChans ) Gets current scan channels (and sub-channels if any) to be used for multi-channel scanning. IMPORTANT: see Channel Setup for proper usage. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetScanType ( BYTE bScanType ) Sets scan type - 0=SingleChannel 1=Normal 2=NormalWithCalibration (normal is "multi-channel"). Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetScanType ( BYTE* bScanType ) Gets current scan type - 0=SingleChannel 1=Normal 2=NormalWithCalibration (normal is "multi-channel") Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetDataLogOptions ( UINT uiDataLogMethod, UINT uiLogFileMaxSize, UINT uiMisc ) Sets data logging options. uiDataLogMethod is a controlled by various bit settings, referred to as flag bits. See Data Log BITS for a detailed explanation of each BIT. uiLogFileMaxSize can be used to control the "approximate" size of the data log file. If that parameter is set to zero, the DLL will continue to write data to the log file regardless of the size it becomes. If the option for writing data to a disk log file isn't used (the default is for it to be the only form of data logging) the second parameter will be ignored. The third option is a placeholder for the possibitlity of a third parameter to be added in the future. If the disk file log option is chosen, the DLL will create a log file using the format, "ScanLog_x.txt", where, "x" is a number that is either zero if there are no other log files already created, or a number larger than the largest number of an existing log file. We've given the log file the ".txt" extension so it can be easily opened in most editors, and it has a format which is also easily imported into most spreadsheets for analysis. NOTE: If this function is never called, the DLL will use it's default setting of writing the data ONLY to a disk file which it will create and will continue to write to the disk file until the RUN is stopped. The DLL will not write data to RAM memory for the application to retrieve unless this function is called with that option specified. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetDataLogOptions(UINT* uiDataLogMethod, UINT* uiLogFileMaxSize, UINT* uiMisc) Gets data logging options that are currently set. See EX_SetDataLogOptions(....) for more information. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetToMinScanInterval(void) Sets device to the minimum scan interval - data will be returned as quickly as possible with current configuration. Prototypes: C/C++, VisualBASIC, LabView EX_SetToUserScanInterval(double* dblUserRequestedInterval) Attempts to set the device to your requested interval (returns false if it can't) - you should call EX_GetScanIntervalMinMax( ) to get limits first. Prototypes: C/C++, VisualBASIC, LabView EX_GetCurrentScanInterval(double* dblCurrentInterval) Gets the current scan interval. This lets you know how often data will be ready for you to read - based on rate, channel count, remote averaging, etc. Prototypes: C/C++, VisualBASIC, LabView EX_GetScanIntervalMinMax(double* dblMinInterval, double* dblMaxIntervall) Gets the min/max scan interval. You should do this after setting all other configuration parameters. You are then free to use any interval that falls within the min/max range using a call to EX_SetToUserScanInterval mentioned above. If you want the shortest interval, it's easiest to not make this call, but instead call directly to EX_SetToMinScanInterval after setting all other configuration parameters. Prototypes: C/C++, VisualBASIC, LabView =================================================================== =========================== == Show, Load, Save, Configuration ============ =========================== EX_ShowDevSetupInfo_MsgBox(void) Shows current configuration used for running (COMport, data rate, etc.) using Windows style message box. You can use the related function call,  "EX_ShowDevSetupInfo_WriteToFile()" to write the informatoin to a disk file as described below. Prototypes: C/C++, VisualBASIC, LabView EX_ShowDevSetupInfo_WriteToFile(void) Writes current configuration used for running (COMport, data rate, etc.) to text file, "DevInfo.txt" in current directory. This is especially useful if you would like to view this information but your application (for whatever reason) may have a problem interracting with the Windows style message box like which would be used in the related call,  "EX_ShowDevSetupInfo_MsgBox()" Prototypes: C/C++, VisualBASIC, LabView EX_SetDevToDefaultSetup(void) Sets configuration to default, parameters. If uncertain how to configure, use this first and then use other functions to set individual configuration parameters. Prototypes: C/C++, VisualBASIC, LabView EX_SetDevToIniSetup(void) Sets configuration to default parameters and then resets them to the values set in "M201_SP.INI" which should be in your Windows directory. Prototypes: C/C++, VisualBASIC, LabView EX_WriteCurrentSetupToIniFile(void) Writes current configuration to "M201_SP.INI" in your Windows directory. Prototypes: C/C++, VisualBASIC, LabView =================================================================== ========================= == Misc Config ================== ========================= EX_SetGain( ) EX_SetGain(byte bGain) Sets gain value. Changes take effect next signon. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetGain(byte* bGain) Gets gain value. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetRemoteAverage(byte bAvg) Sets remote average. Changes take effect next signon. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetRemoteAverage(byte* bAvg) Gets remote average. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetPolarity(byte bPolarity) Sets polarity. Changes take effect next signon. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetPolarity(byte* bPolarity) Gets polarity. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetFilter(USHORT usFilter) Sets filter value. Changes take effect next signon. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView ======================================== EX_GetFilter(USHORT* usFilter) Gets filter value. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetLengthOfRunMs ( UINT uiMilliseconds ) Sets length of run using milliseconds. If parameter is zero or if this function is never called, run will continue until stopped by calling, EX_Stop(), EX_Reset(), or other similar action.. Prototypes: C/C++, VisualBASIC, LabView EX_SetLengthOfRunSec ( UINT uiSeconds ) Sets length of run using seconds. This is best for long runs. If parameter is zero or if this function is never called, run will continue until stopped by calling, EX_Stop(), EX_Reset(), or other similar action.. Prototypes: C/C++, VisualBASIC, LabView =================================================================== EX_SetRunEndBeepOptions(BOOLEAN fUseBeep, UINT uiBeepFreqMs, UINT uiBeepDurationMs, UINT uiBeepIntervalSec, UINT uiBeepTimeoutSec) Sets various parameters to create a BEEP sound through your PCs speaker when the RUN is completed. Prototypes: C/C++, VisualBASIC, LabView EX_StopRunEndBeep(void) Turns off the BEEP at the end of a run -- if you set it up using the EX_SetRunEndBeepOptions(...), function. Prototypes: C/C++, VisualBASIC, LabView =================================================================== =========================== == Initialization ==================== =========================== EX_InitDev ( void ) Initializes - signs on and configures device. If no configuration parameters have been specified prior to this call, default parameters built into the DLL will be used. See special notes included with language prototypes at the links below. Prototypes: C/C++, VisualBASIC, LabView =================================================================== =========================== == Calibration ===================== ===========================
EX_OffsetCalibration( ) Performs an offset calibration. You must call EX_SetPolledModeChan with the main and the sub-channel before making this call. Always make this call before making a call to EX_FullScaleCalibration. The M201 will force the channel to read zero volts. Zero offsets are possible up to 1/2 of full scale. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView EX_FullScaleCalibration( ) Performs a full-scale calibration. You must call EX_SetPolledModeChan with the main and the sub-channel before making this call. Always make this call after making a call to EX_OffsetCalibration. The M201 will force the channel to read 5 volts. The M201 can increase the gain by 15% or decrease the gain by 5% from the nominal value. Remember that the actual input voltage should not exceed +/- 5 volts. Also if your offset calibration voltage was not zero volts, you will shift the available calibration range. The offset calibration should be done before the NOTE: If the gain is not 1, the desired full scale voltage should be applied to the input channel (or sub-channel) that was set by a prior call to EX_SetPolledModeChan(). The nominal full-scale voltages are x1=5; x2=2.5; x4=1.24; x8=.0625; x16=.03125; x32=.015625; x64=.0078125; x129=.00390625 Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView EX_SystemCalibration( ) Performs both offset, and full-scale calibration. This does the channel selection and both calibrations and then reselects the original channel. Settling times are accounted for. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView =================================================================== =========================== == Runtime Data Handling ================ ===========================
EX_GetScanDataDbl( double* pdblDataBuff, UINT uiNumScansToReturn, UINT* puiNumScansReturned, UINT* puiNumScansInBuff, BOOLEAN* pfStillScanning) Retrieves the scan data, already converted into a voltage format. The first parameter must point to a buffer of "double" data type large enough to hold all the data points for as many "scans" as is requested by the second parameter. One scan is comprised of one set of all the channels (and sub-channels if any) that were setup using a call to one of the following two functions: EX_SetSingleChanScanChanCode (...) EX_SetMultiChanScanChanCodes (...) or retrieved by a call to one of the following two functions: EX_GetSingleChanScanChanCode (...) EX_GetMultiChanScanChanCodes (...) See the "FAQ" documentaion for explanation of what one "SCAN" consists of.: What is a SCAN If you set this parameter a greater value than what is available, only the available number of scans will be returned and that number will be reflected in the fourth parameter. The DLL uses the fourth parameter to let you know how many scans it put into your buffer. The fifth and final parameter is used to let you know if the RUN is still active. For an unknown reason (power outage for example) the RUN may have stopped, and checking this parameter is one of the ways for you to find out. Please refer to ChanSetup for information about setting up the channels (and sub-channels if any). IMPORTANT: When using any of the "self-calibration" type scans, each "packet" of SCAN DATA is followed by first the "Offset voltage" and then the "Full-Scale voltage". Prototypes: C/C++, VisualBASIC, LabView EX_GetScanDataInt( INT* piDataBuff, UINT uiNumScansToReturn, UINT* puiNumScansReturned, UINT* puiNumScansInBuff, BOOLEAN* pfStillScanning) Retrieves the scan data, in "signed integer" type format. Please look for information about how to convert the "unsigned integer" value into a voltage. The first parameter must point to a buffer of "signed integer" data type large enough to hold as many "scans" as is requested by the second parameter.One scan is comprised of one set of all the channels (and sub-channels if any) that were setup using a call to: EX_SetSingleChanScanChanCode (...) EX_SetMultiChanScanChanCodes (...) or retrieved by a call to one of the follwoing two functions: EX_GetSingleChanScanChanCode (...) EX_GetMultiChanScanChanCodes (...) See the "FAQ" documentaion for explanation of what one "SCAN" consists of.: What is a SCAN If you set this parameter to a greater value than what is available, only the available number of scans will be returned and that number will be reflected in the fourth parameter. The DLL uses the fourth parameter to let you know how many scans it put into your buffer. The fifth and final parameter is used to let you know if the RUN is still active. For an unknown reason (power outage for example) the RUN may have stopped, and checking this parameter is one of the ways for you to find out. Please refer to ChanSetup for information about setting up the channels (and sub-channels if any). IMPORTANT: When using any of the "self-calibration" type scans, each "packet" of SCAN DATA is followed by first the "signed integer" value representing the "Offset voltage" and then the "signed integer" value representing the "Full-Scale voltage". Prototypes: C/C++, VisualBASIC, LabView =================================================================== =========================== == Digital I/O Handling ================= =========================== EX_SendDigout(byte bDigIn) Sends digital output byte. The digital output can only be issued while in polled mode. Digital output is a value from 0 to 255. Prototypes: C/C++, VisualBASIC, LabView EX_GetDigin(byte* pbDigIn) Gets digital input byte. The digital input can be read anytime after initialization. Digital input is a value from 0 to 255. The host should wait for the response to a data request command before sending another command. Data requests with extensive averaging can take minutes to complete. Prototypes: C/C++, VisualBASIC, LabView =================================================================== =========================== == Scan Run/Stop/Check ================ =========================== EX_Run( ) Initializes and starts scan based on current configuration. A complete system calibration ( offset and full-scale ) is performed at the start of each run. See Configuration Setup Options to view or change configuration. Prototypes: C/C++, VisualBASIC, LabView EX_Stop( ) Stops scanning. Device then becomes idle - referred to as "Polled Mode" Prototypes: C/C++, VisualBASIC, LabView EX_CheckRun( ) Just checks to see if currently running. Prototypes: C/C++, VisualBASIC, LabView =================================================================== =========================== == Polled mode data read ================ =========================== EX_GetOneConversion( double* dblMilliVolts ) POLLED MODE - Retrieves the scan data as millivolts, in floating point type format. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView =========================== == Misc Functions =================== =========================== EX_Standby( BYTE bStandby ) Puts device into standby mode to assist in battery conservation. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView EX_Sleep( BYTE bSleep ) Puts device into sleep mode for good battery conservation. Follow prototype link for more info. Prototypes: C/C++, VisualBASIC, LabView EX_Reset( ) Resets everything to default values stored within the DLL. This is always a good starting point if you think you have inadvertently misconfigured anything. When this function is called, there is no resetting of the hardware as may be assumed, since the state of the hardware or even the proper serial port could quite likely be in an unknown state. After a call to this function be sure to take the required steps to properly configure for the RUN, based on your needs. A good place to start is to go back to the top of this document for information on how to do that. |
|
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:
If instead of the "Quick-Start" method described
HERE, the approach to interract more programmatically
is used by starting with a call to
EX_InitDev the M201 will be 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
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 6-5-07 Tim Van Dusen |