-  
Model 201 Serial Data Acquisition System

 -
 -
C++ function call prototypes by category
Prototypes for Win98/ME/2k/XP   --




 Run / Stop

BOOLEAN  EX_Run ( void );
A call to this function will start the Model 201 running using either default parameters and logging to disk file   "ScanLog_0.txt", or a previously saved configuration. It will continue run and write data to the file until it receives a call to   EX_Stop().  or the application exits.

A complete system calibration  ( offset and full-scale )   is performed at the start of each run

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_Stop ( void );
A call to this function will stop the M201 running and close any data logging files it may have had opened.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_CheckRun ( void );
This function returns TRUE if currently running (scanning), otherwise it returns FALSE.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get/Set COM Port

BOOLEAN   EX_GetCOMport ( BYTE* pbCOM_Num );
Call this function to get the ZERO BASED COM Port number. Be aware that a value of 0 set by the DLL indicates COM1, 1 means COM2, etc.

Arguments

1st parameter:
Point to an 8-bit value that DLL will set to indicate the COM Port number that is currently to be used. Please note:    0=COM1, 1=COM2, etc.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetCOMport ( BYTE bCOM_Num );
Call this function to set the ZERO BASED COM Port number. Be aware that passing the parameter as 0 means COM1, 1 means COM2, etc.

Arguments

1st parameter:
8-bit. value. (0=COM1, 1=COM2, etc.)

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get/Set Gain

BOOLEAN   EX_GetGain ( BYTE* pbGain );
Call this function to get current gain setting.

Arguments

1st parameter:
Point to an 8-bit value that DLL will set to indicate the current gain value.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetGain ( BYTE bGain );
Call this function to change current gain setting. Gains of 1,2 ... 128 can be selected. Effective resolution is reduced at gains above x4 or x8.

Arguments

1st parameter:
8-bit. value the DLL will set the gain to.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get/Set Remote Averaging

BOOLEAN   EX_GetRemoteAverage ( USHORT* pusAvg );
Call this function to get remote average value. The number of conversions averaged must be a power of 2, ie., 1, 2, 4, 8, 16, etc. The maximum number of conversions to average is 32,768. The A/D data rate divided by the averaging factor gives the number of samples transmitted per second. Note that with high averaging values, data arrives slowly. At 10 Hz with 32768 averaging, each data point takes 54.6 minutes.

Arguments

1st parameter:
Point to an 8-bit value that DLL will set to indicate the current remote average setting.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetRemoteAverage ( USHORT usAvg );
Call this function to set value to be used for remote averaging. The number of conversions averaged must be a power of 2, ie., 1, 2, 4, 8, 16, etc. The maximum number of conversions to average is 32,768. The A/D data rate divided by the averaging factor gives the number of samples transmitted per second. Note that with high averaging values, data arrives slowly. At 10 Hz with 32768 averaging, each data point takes 54.6 minutes.

Arguments

1st parameter:
8-bit. value the DLL will set the remote average to.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get/Set Polarity

BOOLEAN   EX_GetPolarity ( BYTE* pbPolarity );
Call this function to get polarity setting. The input range is represented as +/- 5 volts (bipolar) or 0-5 volts (uniPolar). Nominal resolution improves in the unipolar mode for positive signals, but some of that improvement is lost to fixed amplitude noise sources.

Arguments

1st parameter:
Point to an 8-bit value that DLL will set to indicate the current polarity setting. Here are what the Polarity (bPolarity) settings equate to:
            0 = unipolar    1 = bipolar

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetPolarity ( BYTE bPolarity );
Call this function to set polarity value. The input range can be selected as +/- 5 volts (bipolar) or 0-5 volts (uniPolar). Nominal resolution improves in the unipolar mode for positive signals, but some of that improvement is lost to fixed amplitude noise sources.

Arguments

1st parameter:
8-bit. value the DLL will use for polarity (bPolarity) setting. Here are what the Polarity settings equate to:
            0 = unipolar    1 = bipolar

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get/Set Filter

BOOLEAN   EX_GetFilter ( BYTE* pbFilter );
Call this function to set filter value. The Model 201 has a programmable single-pole filter in the signal path before the A/D converter. There are 3 choices for the filter cutoff frequency: 400, 40, or 4 Hz. The lower filter cutoff frequencies remove lower frequency noise, but require longer settling times after channel changes.

Arguments

1st parameter:
Point to an 8-bit value that DLL will set to indicate the current filter setting. Here are what the filter (pbFilter) settings equate to:
            0 = 4 Hz    1 = 40 Hz    2 = 400 Hz

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetFilter ( BYTE bFilter );
Call this function to set filter value. The Model 201 has a programmable single-pole filter in the signal path before the A/D converter. There are 3 choices for the filter cutoff frequency: 400, 40, or 4 Hz. The lower filter cutoff frequencies remove lower frequency noise, but require longer settling times after channel changes

Arguments

1st parameter:
An 8-bit value that DLL will use for the current filter setting. Here are what the filter (bFilter) settings equate to:
            0 = 4 Hz    1 = 40 Hz    2 = 400 Hz

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Standby / Sleep

BOOLEAN   EX_Standby ( BYTE bStandby );
Call this function to put the device into standby mode. The standby command puts the A/D converter into low-power mode. Any other command will take it out of standby mode

Arguments

1st parameter:
An 8-bit value that DLL will use to either put the device in (bStandby = 1) or out of (bStandby = 1) standby mode. Note that although this is the only command that will put the device into standby mode, any other command issued while it is already in standby mode will wake it up and the command will be performed, afterwhich time the device will remain as it is left by the new command. There is really no reason to call this function with bStandby = 0, since any other function call that provides device interraction will take it out of standby mode.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_Sleep ( BYTE bSleep );
Call this function to put the device to sleep (bSleep = 1) or wake it up (bSleep = 1). This functionality can be used for extreme batter conservation. In sleep mode the A/D and input section is shut completely off to minimize power consumption. The control section checks periodically for serial activity from the host. When activity is detected, the Model 201 turns itself on and waits for start-up information. Note that for lowest power consumption that the analog input voltages should be disabled. There is really no reason to call this function with bSleep = 0, since any other function call that provides device interraction will automatically wake it up.

Arguments

1st parameter:
An 8-bit value that DLL will use to either put the device into sleep mode or wake it up. Note that although this is the only command that will put the device to sleep, any other command issued while it is already asleep will wake it up and the command will be performed, afterwhich time the device will remain awake.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Calibration

BOOLEAN   EX_OffsetCalibration ( );
Call this function to perform an offset calibration. After the offset calibration the converter should read very close to 0 volts when read in "Polled" mode on channel 7. This offset calibration removes errors caused by the input signal conditioning circuitry as well as offset errors in the A/D converter itself.

Please note that if you are currently running (scanning) the scan will be terminated. Therefore if you are scanning, it is preferred that you gracefully end the scan with a call to a function such as,   EX_Stop   prior to doing this or any of the other calibration related functions.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_FullScaleCalibration ( );
Call this function to perform a full-scale calibration. After the full-scale calibration the converter should read very close to +5 volts when read in "Polled" mode on channel 6. The full-scale calibration also removes signal conditioning errors.

Please note that if you are currently running (scanning) the scan will be terminated. Therefore if you are scanning, it is preferred that you gracefully end the scan with a call to a function such as,   EX_Stop   prior to doing this or any of the other calibration related functions.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SystemCalibration ( );
Call this function to perform a complete system calibration, which includes an offset and full-scale calibration. The System calibration performs the same sequence automatically as the two function calls discussed above. It does the channel selection and both calibrations and then reselects the original channel. Settling times are accounted for.

Please note that if you are currently running (scanning) the scan will be terminated. Therefore if you are scanning, it is preferred that you gracefully end the scan with a call to a function such as,   EX_Stop   prior to doing this or any of the other calibration related functions.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get/Set Filter

BOOLEAN   EX_GetFilter ( USHORT* pusFilter );
Call this function to get current filter setting.

Arguments

1st parameter:
Point to a 16-bit value that DLL will set to indicate the current filter setting.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetFilter ( USHORT usFilter );
Call this function to set filter value.

Arguments

1st parameter:
16-bit. value the DLL will use for filter setting.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get/Set Rate

BOOLEAN   EX_GetRate ( double* pdblRATE );
Call this function to get the rate that will be used when the RUN is started, or is being used if already running.

Arguments

1st parameter:
Pointer to a floating point double value which the DLL will load with the current known rate.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetRate ( double dblRATE );
Call this function to set the rate that will be used when the RUN is started. The actual rate set by this call won't take effect until the RUN is begun.

Arguments

1st parameter:
A floating point double value which the DLL will use to set the rate to be used in the next run.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Get/Set Polled Mode Channel

BOOLEAN   EX_GetPolledModeChan ( BYTE* pbMainChan, BYTE* pbSubChan );
Call this function to get Polled Mode main and sub channel. Analog input chan 0 to 5. Channel 6 is +5 volts reference for full scale calibration, Chan 7 is 0 volts and used for offset calibration

Arguments

1st parameter:
Point to an 8-bit value that DLL will set to indicate the Polled Mode main channel

2nd parameter:
Point to an 8-bit value that DLL will set to indicate the Polled Mode sub channel.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetPolledModeChan ( BYTE bMainChan, BYTE bSubChan );
Call this function to set Polled Mode main and sub channel. Analog input chan 0 to 5. Channel 6 is +5 volts reference for full scale calibration, Chan 7 is 0 volts and used for offset calibration

Arguments

1st parameter:
Point to an 8-bit value that DLL will set the Polled Mode main channel to.

2nd parameter:
Point to an 8-bit value that DLL will set the Polled Mode sub channel to.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Get one polled mode conversion

BOOLEAN   EX_GetOneConversion ( double* dblMilliVolts );
Call this function to get a conversion in Polled Mode. If you are currently running (scanning), be sure to call   EX_Stop   prior to doing this. Failure to do so will result in loss of scan data, and improper closing of any log files which might currently be opened. If not currently signed on, the DLL will attempt to perform a signon before reading the analog input. If it cannot signon or read, it will return FALSE.

Arguments

1st parameter:
Point to floating point variable that DLL will set equal to the current conversion as millivolts.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed












 Send/Read Digital I/O

BOOLEAN   EX_SendDigout ( BYTE bDigOut );
Call this function to send a digital output value. If not currently signed on, the DLL will attempt to perform a signon before writing the digital output. If it cannot signon or write, it will return FALSE.

It should be noted that if a call to this function fails, it could just mean that there is a previous digital output pending, so be sure to check the return value from the function call to determine if you need attempt to resend the digital output data. While scanning, digital outputs have to wait for an opportune time in which they can be sent. Typically, during a scan which is  not  of the "digital input" type  ( see here ), digital outputs are sent rapidly anytime the usual scan data is pending. However, if a digital input type scan is in progress, then digital outputs have to wait until pending digital input data is read. As of 2-6-07, there has been a  new function  added to the DLL which allows the setting of a priority either favoring the digital inputs or digital outputs during a digital input type scan.

Arguments

1st parameter:
An 8-bit value set to the digital output value you wish to send.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_GetDigin ( BYTE* pbDigIn );
Call this function to read the digital input value. If not currently signed on, the DLL will attempt to perform a signon before reading the digital input. If it cannot signon or read, it will return FALSE.

Arguments

1st parameter:
Pointer to an 8-bit data type which the DLL will set to the current digital input value.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed




 -
BOOLEAN   SetDigOutPriorityOption ( BYTE bSet );
Use a call to this function to set the priority of the digital output during a digital input type scan - see  EX_GetDiginWScan(). This function can be called anytime either prior to or during a digital input style scan.

By default, digital inputs have priority. Whenever a digital input is read, if there is a digital output pending, the digital output is sent and then another request for a digital input is sent. If bSet is set to 1, then the digital outputs will have priority over the digital inputs - digital input requests will be made only after each scan is read, allowing digital outputs to be sent both immediately after a digital input is read, and the entire time between when the last digital input is read and new scan data is completely ready to be read..

Arguments

1st parameter:
An 8-bit data type used to set the digital output priority level.
      bSet = 1: digital outputs have priority
      bSet = 0: digital inputs have priority

Return type:
8-bit. 1 (true) = success,    0 (false) = failed








 -


 Setup for digital input while scanning

BOOLEAN   EX_SetDiginScan ( BYTE fDoDiginScan );
Call this function to configure scan process to read and store digital input while scanning. Since the digital input can only be read "between" readings of scan data, special handling of the digital input is required while scanning - thus, the polled mode EX_GetDigin() function will not work while scanning.

Once enabled with this request, the DLL's scan thread will read and store the digital input with each read of the scan data. You will need to call  EX_GetDiginWScan()  to retrieve the digital input. This can be called anytime after signon as well as anytime while scanning to either enable or disable the feature.

See also  SetDigOutPriorityOption().

Arguments

1st parameter:
An 8-bit value set to enable the reading of the digital input by the DLL's scan data-handling thread.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





 -
BOOLEAN   EX_GetDiginWScan ( BYTE* pbDigIn );
Call this function to read the digital input value while scanning.
See  EX_SetDiginScan()  above, for more information.

Arguments

1st parameter:
Pointer to an 8-bit data type which the DLL will set to the current digital input value.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Get/Set SCAN Channel Codes

BOOLEAN   EX_GetMultiChanScanChanCodes ( BYTE* pbChan0, BYTE* pbChan1,
                    BYTE* pbChan2, BYTE* pbChan3, BYTE* pbChan4, BYTE* pbChan5, BYTE* pbTotalChans );

Call this function to get the the channel codes. See  "QuickRef.htm"   for information about the channel codes.

Arguments

1st, 2nd, 3rd, 4th, 5th, 6th parameters:
Pointers to 8-bit data types to be set to channel code by the DLL.

7th parameter:
Points to 8-bit data types to be set to total number of channels that are set.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetMultiChanScanChanCodes ( BYTE* bChan0, BYTE bChan1,
                            BYTE bChan2, BYTE bChan3, BYTE bChan4, BYTE bChan5, BYTE bTotalChans );

Call this function to set the the channel codes to be used by the DLL during multi-channel scanning. See  "QuickRef.htm"   for information about the channel codes.

Arguments

1st, 2nd, 3rd, 4th, 5th, 6th parameters:
8-bit data types that represent channel codes to be used by the DLL.

7th parameter:
8-bit data type set to total number of channels that are to be set.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_GetSingleChanScanChanCode ( BYTE* pbChanCode );
Call this function to get the current channel code that is being used while running in single-channel scan mode. This value will represent both the main and sub channel being used. See  "QuickRef.htm"   for information about the channel codes.

Arguments

1st parameter:
Pointers to 8-bit data type to be set to channel code by the DLL.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetSingleChanScanChanCode ( BYTE bChanCode );
Call this function to set the current channel code that is to be used while running in single-channel scan mode. This value will represent both the main and sub channel to be used. See  "QuickRef.htm"   for information about the channel codes.

Arguments

1st parameter:
8-bit data types that represent channel code to be used by the DLL.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Get/Set SCAN Type

BOOLEAN   EX_GetScanType ( BYTE* bScanType );
Call this function to get the current scan type to be used by the DLL when a RUN is started or currently being used by the DLL if already running.


Arguments

1st parameter:
Pointer to an 8-bit data type that the DLL will set with the current scan type being used by the DLL
Below are the valid values that the numeric value returned represents:
       0=SingleChannel,    1=Normal  ( normal is "multi-channel" ),
        2=NormalWithCalibration  ( this is "multi-channel" plus calibration)

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetScanType ( BYTE bScanType );
Call this function to set the scan type to be used by the DLL while running.


Arguments

1st parameter:
8-bit data types that represent scan type to be used by the DLL Below are the valid values that the numeric value is to represent:
       0=SingleChannel,    1=Normal  ( normal is "multi-channel" ),
        2=NormalWithCalibration  ( this is "multi-channel" plus calibration)

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Set Length of RUN

BOOLEAN   EX_SetLengthOfRunMs ( UINT uiMilliseconds );
Call this function to set length of run using milliseconds. If parameter is zero, run will continue until stopped by calling, EX_Stop(), EX_Reset(), or other similar action.

Use this function for short runs, and   EX_SetLengthOfRunSec()   for longer runs

Arguments

1st parameter:
A 32-bit Data type that represents, in milliseconds how long you want the RUN to last. After the amount of time has expired the run will stop. This is used for finer granularity than is possible with the comparable function, "EX_SetLengthOfRunSec(UINT uiSeconds)" shown below.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetLengthOfRunSec ( UINT uiSeconds );
Call this function to set length of run seconds. If parameter is zero, run will continue until stopped by calling, EX_Stop(), EX_Reset(), or other similar action.

Use this function for long runs, and   EX_SetLengthOfRunMs()   for short runs

Arguments

1st parameter:
A 32-bit Data type that represents, in seconds how long you want the RUN to last. After the amount of time has expired the run will stop. This is used for coarser granularity than is possible with the comparable function, "EX_SetLengthOfRunMs(UINT uiMilliseconds)" shown above.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Get/Set Data Logging options
 to be used while running

BOOLEAN   EX_GetDataLogOptions ( UINT* uiDataLogMethod, UINT* uiLogFileMaxSize, UINT* uiMisc );
Call this function to get data logging options that are currently set. See EX_SetDataLogOptions(....) below for more information.

Arguments

1st parameters:
Pointer to 32-bit data type to be set by the DLL to contain 32 possible bit-flags used to indicate data logging method that is to be used while running. The main methods are to, "Log to File" and/or "Log to RAM memory" with vairous options that pertain to each. See See  "Data Log Option - BIT settings"   in QuickRef.htm  for information about the flag bit settings.

2nd parameter:
32-bit data type that the DLL will set to the maximum data loging file size that it will use if the disk file data logging option is used. If the option to log to disk isn't enabled then the DLL will set the variable pointed to, to zero.

3rd parameter:
Pointers to 32-bit data type which is reserved for future use.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetDataLogOptions ( UINT uiDataLogMethod, UINT uiLogFileMaxSize, UINT uiMisc);
Sets data logging options. uiDataLogMethod is a controlled by various bit settings known to most as "flags". See  "Data Log Option - BIT settings"   in QuickRef.htm   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 main methods are to, "Log to File" and/or "Log to RAM memory" with vairous options that pertain to each.

If the option is used to log to RAM memory, it's up to the caller to manage the data to prevent buffer wrap as explained at the following link  "Reasons for data buffer wrap"   in, QuickRef.htm

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.

Arguments

1st parameters:
32-bit data type to be set by the DLL to contain 32 possible bit-flags used to indicate data logging method that is to be used while running.

2nd parameter:
32-bit data type that the DLL will set to the maximum data logging file size that it will use if the disk file data logging option is used. If the option to log to disk isn't enabled by the correct flag bit setting of the 1st parameter, the DLL will ignore this value.

3rd parameter:
Pointers to 32-bit data type which is reserved for future use.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Read from Data Buffer
 to be used while running

BOOLEAN   EX_GetScanDataDbl ( double* pdblDataBuff, UINT uiNumScansToReturn,
                            UINT* puiNumScansReturned, UINT* puiNumScansInBuff, BOOLEAN* pfStillScanning );

Call this function to retrieve the acquired data, already converted into a voltage format.

Whenever you are  RUNNING  data acquisition is being performed and the data is either being writting to a file on your disk drive, or into RAM memory. You can select either of the two options prior to starting the RUN by calling   EX_SetDataLogOptions(..)
 prior to starting the RUN. If you've chosen the option to  log the data to RAM memory  then it is up to you to call this function to retrieve the data from the DLL's RAM memory buffer prior to starting the RUN to prevent  buffer overflow.  

Arguments

1st parameters:
Must point to a buffer of  double  data type large enough to hold as many  scans  as is requested by the second parameter.

2nd parameter:
The  second parameter  contains a value to represent how many  scans  you'd like returned. You can determine the number of  scans  currently in the buffer by calling this function with this 2nd parameter set to zero and then use the value returned in the 4th parameter in a follow-up call to this function. Please be aware that one scan is comprised of one set of all the channels that were setup using a call to one of the following functions:
           EX_SetSingleChanScanChanCode(..)
           EX_SetMultiChanScanChanCodes(..)
or retrieved using a call to one of the following functions:
           EX_GetSingleChanScanChanCode(..)
           EX_SetMultiChanScanChanCodes(..)
See the  FAQ documentation  for explanation of what one  SCAN  consists of. 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.

3rd parameter:
The DLL uses this parameter to let you know how many scans it has put into into the buffer you pointed to with the first parameter. If you by chance requested too many scans by your second parameter, the DLL will only return the number of scans that are currently available so this parameter is a way to "double check" whether or not what you requested was actually returned.

We recommend against using this parameter as a means of always getting the most available scans by setting the 2nd parameter very high and then just using this value to find out how much was returned. The problem with doing that is that you would also have to create a data buffer on the application side to receive the total amount of scans that you requested in the event that that many actually existed, creating a waste of memory allocation/deallocation which is poor programming practice.

4th parameter:
The DLL uses this parameter to let you know how many scans are currently in it's RAM memory buffer. One way to empty the DLL's RAM memory buffer is to call this function requesting zero scans and then use the value returned in this parameter to properly size your data buffer to receive the data and then make a second call into this function to retrieve the actual data.

IMPORTANT:   Always remember that a  SCAN  is typically comprised of many voltages according to the amount of channels that you are scanning. Only when in  single-channel scan mode  or normal scan mode - with only one channel selected - will the number of voltages with a size of double be equal to the number of scans you request. Any other time your data buffer must be sized to equal,
       uiNumScansToReturn x NumChannels
and if doing a "calibraion" type scan, it must include an additional space for two voltages with each scan returned, so then the total calculation would be:
       uiNumScansToReturn x (NumChannels + 2)
It can be very easy to make the mistake of making your buffer the same size as the  uiNumScansToReturn  variable. Since the DLL has no way to check the size of your buffer, an undersized buffer is almost certain to cause a system crash!

5th parameter:
The DLL uses this parameter 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.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_GetScanDataInt ( int* pdblDataBuff, UINT uiNumScansToReturn,
                            UINT* puiNumScansReturned, UINT* puiNumScansInBuff, BOOLEAN* pfStillScanning );

Call this function to retrieve the acquired data, not yet converted into a voltage format.

Whenever you are  RUNNING  data acquisition is being performed and the data is either being writting to a file on your disk drive, or into RAM memory. You can select either of the two options prior to starting the RUN by calling   EX_SetDataLogOptions(..)
 prior to starting the RUN. If you've chosen the option to  log the data to RAM memory  then it is up to you to call this function to retrieve the data from the DLL's RAM memory buffer prior to starting the RUN to prevent  buffer overflow.  

Arguments

1st parameters:
Must point to a buffer of  32-bit integer  data type large enough to hold as many  scans  as is requested by the second parameter.

2nd parameter:
The  second parameter  contains a value to represent how many  scans  you'd like returned. You can determine the number of  scans  currently in the buffer by calling this function with this 2nd parameter set to zero and then use the value returned in the 4th parameter in a follow-up call to this function. Please be aware that one scan is comprised of one set of all the channels that were setup using a call to one of the following functions:
           EX_SetSingleChanScanChanCode(..)
           EX_SetMultiChanScanChanCodes(..)
or retrieved using a call to one of the following functions:
           EX_GetSingleChanScanChanCode(..)
           EX_SetMultiChanScanChanCodes(..)
See the  FAQ documentation  for explanation of what one  SCAN  consists of. 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.

3rd parameter:
The DLL uses this parameter to let you know how many scans it has put into into the buffer you pointed to with the first parameter. If you by chance requested too many scans by your second parameter, the DLL will only return the number of scans that are currently available so this parameter is a way to "double check" whether or not what you requested was actually returned.

We recommend against using this parameter as a means of always getting the most available scans by setting the 2nd parameter very high and then just using this value to find out how much was returned. The problem with doing that is that you would also have to create a data buffer on the application side to receive the total amount of scans that you requested in the event that that many actually existed, creating a waste of memory allocation/deallocation which is poor programming practice.

4th parameter:
The DLL uses this parameter to let you know how many scans are currently in it's RAM memory buffer. One way to empty the DLL's RAM memory buffer is to call this function requesting zero scans and then use the value returned in this parameter to properly size your data buffer to receive the data and then make a second call into this function to retrieve the actual data.

IMPORTANT:   Always remember that a  SCAN  is typically comprised of many voltages according to the amount of channels that you are scanning. Only when in  single-channel scan mode  or normal scan mode - with only one channel selected - will the number of voltages with a size of double be equal to the number of scans you request. Any other time your data buffer must be sized to equal,
       uiNumScansToReturn x NumChannels
and if doing a "calibraion" type scan, it must include an additional space for two voltages with each scan returned, so then the total calculation would be:
       uiNumScansToReturn x (NumChannels + 2)
It can be very easy to make the mistake of making your buffer the same size as the  uiNumScansToReturn  variable. Since the DLL has no way to check the size of your buffer, an undersized buffer is almost certain to cause a system crash!

5th parameter:
The DLL uses this parameter 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.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Set option for BEEP ( using PC speaker )
 for   "end-of-run"   notification

BOOLEAN   EX_SetRunEndBeepOptions ( BOOLEAN fUseBeep, UINT uiBeepFreqMs,
                                        UINT uiBeepDurationMs, UINT uiBeepIntervalSec, UINT uiBeepTimeoutSec );

Call this function to setup the use of the PC speaker to BEEP at various frequencies and inervals for notification after the RUN has ended.

The default built into the DLL is for NO BEEP. If you never call this function the BEEP will never be enabled. If you call this function and set the first parameter to 1, the BEEP will be enabled and will be either controlled by the values of the other parameters, or the values built into the DLL if a particular parameter is set to zero. If you call this function once, RUN, and then stop, and then RUN again, the previous settings will remain in effect. You would then need to call this function with the first parameter set to zero to disable the BEEP functionality.

Due to a possible lack of understanding of how the frequencies may be used, there are default frequencies built into the DLL to be used for each of the frequency parameters which you set to zero before making the call.
  parameter   value   what it means
uiBeepFreqMs 440Hz. this is the "tone" - mid-range, and easy on the ears
uiBeepDurationMs 50ms. this is how long (duration) the tone will last
uiBeepIntervalSec 2sec. this is the length of silence between tones
uiBeepTimeoutSec 10sec. after this amount of time there will be no more beep tones

REMEMBER: you can change none, one, or more of the values by setting it's parameter to a non-zero value. Any parameter which you leave at zero will be replaced by the default value configured into the DLL.

Arguments

1st parameter:
An 8-bit data type (true / false) which should be either set to 1 if you want to enable the BEEP or 0 if you do not want the BEEP enabled.

2nd parameter:
A 32-bit Data type that represents the BEEP duration. This is how long the tone set in the 1st parameter above will last before the silence interval.

3rd parameter:
A 32-bit Data type that represents the amount of time that there will be silence between the BEEP tones.

4th parameter:
A 32-bit Data type that represents how long the BEEPing will continue.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_StopRunEndBeep ( void );
Call this function to stop the BEEP if it was enabled in a call to the EX_SetRunEndBeepOptions(...) function.

A call to this function will stop the BEEP immediately and is useful if you setup the BEEP to continue for a long period of time either intentionally or accidentally and would now like for the BEEP to stop. If you are going to be away from the PC, you may want to set the BEEPing to continue for a long time and then just turn it off when you return to the PC.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Setting/Saving Setup  ( configuration )  information

BOOLEAN   EX_ShowDevSetupInfo_MsgBox ( void );
Call this function to show 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.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_ShowDevSetupInfo_WriteToFile ( void );
Call this function to write 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 interraction with the Windows style message box like which would be used in the related call, "EX_ShowDevSetupInfo_MsgBox()"

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetDevToDefaultSetup ( void );
Call this function to set device to default parameters.

If uncertain how to configure, or how the device is currently configured, use this first and then use other functions to set individual configuration parameters.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetDevToIniSetup ( void );
Call this function to set configuration to default parameters and then resets them to the values set in "M201_SP.INI" which should be in your Windows directory.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_WriteCurrentSetupToIniFile ( void );
Call this function to write current configuration to "M201_SP.INI" in your Windows directory.

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed











 Get/Set Scan Interval

BOOLEAN   EX_GetCurrentScanInterval ( double* pdblCurrentScanInterval );
Call this function to get the scan interval that will be used when the RUN is started, or is being used if already running.

Please read the   "FAQ"   at the following link:   Scan Interval Q/A,

Arguments

1st parameter:
A pointer to a floating point double value which the DLL will set to the current scan interval which is based on the other configuration parameters that courrently exist..

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_GetScanIntervalMinMax ( double* dblMinInterval, double* dblMaxInterval );
Call this function to get the minimum and maximum scan interval that can be used when the RUN is started, or is being used if already running.

Please read the   "FAQ"   at the following link:   Scan Interval Q/A,

Arguments

1st parameter:
A pointer to a floating point double value which the DLL will set to minimum scan interval based on the other configuration parameters that courrently exist..

2nd parameter:
A pointer to a floating point double value which the DLL will set to maximum scan interval based on the other configuration parameters that courrently exist..

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetToMinScanInterval ( void );
This function is provided as a quick and simple way to set to the minimum scan interval. When the device is set to the minimum interval, the data will be returned as quickly as possibble.

Please read the   "FAQ"   at the following link:   Scan Interval Q/A,

Arguments

Return type:
8-bit. 1 (true) = success,    0 (false) = failed





BOOLEAN   EX_SetToUserScanInterval ( double* dblUserScanInterval );
Call this function to set the scan interval to whatever you want as long as it's within the range of "min" and "max" as returned by a call to   EX_GetScanIntervalMinMax()

Please read the   "FAQ"   at the following link:   Scan Interval Q/A,

Arguments

1st parameter:
A pointer to a floating point double value which represents the scan interval that the caller would like to use. The DLL will set the device to scan at this interval as long as it falls within the specified range as discussed above. If the requested interval falls outside the allowed range, the DLL will set the interval to the minimum interval and return the value in the varible pointed to by this parameter.

Return type:
8-bit. 1 (true) = success,    0 (false) = failed














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

on the web
www.lawsonlabs.com

© Lawson Labs Inc. All rights reserved
Last modified 2-6-06 Tim Van Dusen