See end of document  
for Excel interface


===============
Getting Started     ( modified 3-5-14 )
===============
1. If this is a first-time installation, a device driver and other support files will need to be installed, and a batch file, "RunFirst.bat" needs to be run. To select the correct installation for your version of Windows, go to our website, download the correct install.zip file for your version and follow the instructions inside.

After installing the correct device driver, execute RunFirst.bat to copy and register various DLLs and OCX files that aren't currently on your computer and/or registered - required by the application. To properly execute the file it must be executed with administrative rights if that option is available otherwise it may seem to register but it may not function as it should. To get the option to "Run As Administrator" right-click RunFirst.bat with the mouse and the option should be in the menu that appears if it is an option in your version of Windows.

2. Prior to running  M302_Excel.exe,  open  LL_USB.cfg  in a text editor such as Notepad or Wordpad and replace the device ID with the device ID number of your Model 302. The rate and channel that will be used during signon can also be changed in the LL_USB.cfg file. The rate and channel can also be changed after communication is established with the Model 302. Remove "Debug" entry in that file if there is one.

3. Once the application is launched, click the initialize  button to begin. If initialization fails, first check in the message box that the correct ID number is being used. Then double check the USB cable and the external power supply. See the installation instructions for troubleshooting the software installation. Once initialized, many of the buttons on the main panel become active in the mode of operation we call "polled mode". There are some things that are only possible in polled mode, including: changing the internal data rate, performing a system calibration or requesting individual conversions. The change to scan mode  button can be pressed at any time after initialization to present the scanning mode options.

4. Not all options described below are available to both the 301 and 302. The application will determine at the time it loads, based on the device ID within the configuration file, which buttons and other options to make available to the user. For example, if the application determines that it is loading for a model 301, then the analog output options described below, will not be available - the button and entry boxes will not appear on the application panel.


============
Polled Mode
============
GetConv
  Get a single conversion result.
Change channel
  For 301, the valid channels are 0,1,6,7.
For 302, the valid channels are 0,1,2,3,4,5,6,7.
Digital output
  Enter any number from 0-255. Once a number is entered the button to  send  becomes active.
Digital input
  This box shows the most recent digital input word. It is updated whenever the  Get Conv  button is pressed.
SysCal
  Performs a full-scale and offset calibrations.
DevRate
  The rate can be changed any time while in Polled Mode.
DevID
  This drop down menu will be populated with multiple device ID's if more than one Model 302 is connected and listed in the  LL_USB.cfg  file. Select any ID number to make that the active Model 302 board.
Dbg options
  This is an "override" for the setting of the debug option within the LL_USB.INI  file. When the button is pressed, a box is presented that allows setting of the debug option. Debug should rarely be set to a value greater than 2 when in scanning mode. The amount of debug information being written during scanning can swamp your system at higher data rates. When debug is set to on, a debug file is written to a new folder in the application's folder called "M30x_DBG. The filename designates the instance of the application, along with a number indicating the number of debug files that have been created by the current instance.
AnalogOut
  Any one of three analog output channels can be set to any voltage between 0 and 5 volts. Select a DAC using the drop-down box, enter a voltage, and then press the  AnalogOut  button to send it.
Enter Key
  Placing the cursor in this box enables single-letter typed commands. The underlined letter on each button is the letter that will activate that button, for example, M will cause a change to scanning mode.
Mode button
  This button toggles the mode between polled and scanning.
Misc
  The  handle  box shows the numeric code known as a  "Window Handle"  that is assigned to the application by the operating system. This is the number that also appears in the filename of the debug file if debugging is enabled. The 301 or 302 checkbox will be checked based on the device ID that was entered in the configuration file. The 3 buttons pertaining to the configuration load/save/reload can be used anytime during polled mode. After either loading or reloading a configuration file, the  Initialize  button should be pressed for the changes to take effect.


===============
Scanning mode
===============
In scanning mode the Model 302 is started, and will send data continuosly until stopped. Digital I/O and analog outputs are available during scanning and do not disrupt data acquisition. The scanning rate is a function of the data rate, the scan type and the number of channels selected. For single-channel scanning, the scanning rate is the same as the data rate. For multi-channel scanning, divide the data rate by 5 times the number of channels being scanned to get the scanning rate.

Multi-Chan Scan
  When checked, more than one channel will be scanned.
DiginScan
  If checked, a digital input will be returned with each data point, instead of once per scan. The digital input word is displayed in the DigitalInput box as well as being written to the log file if the ScanLogFile box is checked.
CalScan
  When checked, an offset reading is included in each scan and subtracted from each data point. This technique provides active zero-drift correction. It requires multi-channel scanning.
NumChans
  Enter the number of channels to scan here, up to 4 for the Model 301, ot 8 for the Model 302. An extra channel is added transparently for a cal scan.
Avg
  A running average can be applied to smooth your data. If set to 4, each reading will be a running average of the last 4 conversions on that channel. Increasing the running average does not change the scanning rate.
ScanLogFile
  If checked, the scan data will be written to a file in a folder named M30x_Log where the "x" represents either a 1 or a 2.
Scan#
  Displays the number of scans that have been collected since the start of scanning.
ScanBuff
  Shows the number of scans currently within the DLL's buffer. If there are many processes taking CPU time, this number may grow when the application is starved for processing time. It can also grow if the Debug level is set too high.
ScanBoost
  Sets the thread priority of the application to a higher level. This can be used if the scan buffer begins to over-fill or scan halted errors occur due to data overrunning the Model 30x's own buffer.
ShowGraph
  The current scan can be shown in graphic form. The currently selected channel will be graphed. Scan channels as well as seconds-per-screen, autoCentering, and zoom/unzoom, can be controlled from the graphics screen. Pressing the  close  button returns to the main screen without stopping the scan.
MiscNotes
  Clicking in the lower left hand corner of the main application screen while scanning will bring the scan voltage display screen to the front. Alt-Tab can also be used to do the same thing, as well as clicking the mouse on the edge of the data screen.


=================
Interfacing Excel
 added 12-11-14
=================

* You must have Microsoft Excel on your system

  Once you are familar with basic operation, select "UseExcel" checkbox which will open Excel press "Start Scan" and data will go into Excel.

Stop the scan before looking at your data. Do not manually manipulate Excel while data is comming in. OR, you can click the box Lock Excel to block the writing of data. Then you can do what you want in Excel, but unless you unclick that box, the data buffer will overflow eventually. That manual control is really just for testing.

The "LockExcel" box disables the Stop scan button. Uncheck it before you stop a scan.

In use, you will need to control the flags for sharing the Excel memory that are operated from within Excel. One flag is to block the writing of scan data (cell B1), and one flag is to suspend VBA operation (cell A1). The second flag may prove not to be needed.

Write a VBA macro that can write a zero or a one into cell B1. 1 will block the scan data. 0 allows scan data to fill into the spreadsheet. Any time VBA needs to act, it writes a 1 first. Whenever data is wanted, it writes a zero and waits for data. When suspended, anything at all can be done in Excel until cell B1 is set to 0. The application has a substantial buffer for the scan data, but if suspend remains in effect for too long during scanning, the buffer will overflow. If that happens, stop the scan to recover.

The other flag is set to 1 by our application while scan data is being written and to zero when not. It can be tested by VBA to insure that there is no memory conflict. We will need to refine these rules if this flag proves necessary.

Unchecking the UseExcel box closes Excel.

We can make changes and add features.