Scientific Solutions ® Inc.

LabPac ® for DOS

Product Description

Key Features

Applications

Compatible Languages

Functional Description

Programming Examples

Command Summary

System Requirements

Optimize your research and industrial applications in a PC using Scientific Solutions family of data acquisition and control products with LabPac - a sophisticated memory resident driver. Simple functions handle event counting, precision timing, analog input, analog output, digital input and digital output. LabPac installs as a BIOS-level, software interrupt allowing any language that runs under DOS access to its various functions.

LabPac for DOS CD-ROM


Product Description

Optimize your research and industrial applications in a PC using Scientific Solutions family of data acquisition and control products with LabPac, a sophisticated memory resident driver. LabPac installs as a BIOS-level, software interrupt allowing any language that runs under DOS access to its 64 functions. Simple functions handle event counting, precision timing, analog input, analog output, digital input, and digital output. Repetitive functions, such as multiple sampling of analog inputs, can be done using hardware interrupts, external triggers, pacer clocks, or timed intervals. The routines are designed to utilize the full power of Scientific Solutions products. Data files can be created in either ASCII format for compatibility with major analysis, data base and spreadsheet software, or binary format for compact storage. LIM EMS 4.0 support allows use of expanded memory to collect extensive numbers of samples. LabPac can be used with Scientific Solutions ROUTE 488 software for a complete environment.



Key Features


Applications


Compatible Languages


Functional Description

LabPac is a memory resident, BIOS level device driver. When called from an application program, its function is to provide streamlined BIOS routines which facilitate the data acquisition and process control features on the MC DAS series, Lab Master DMA, Lab Master AD, Lab Tender, Base Board, and DADIO. Applications access LabPac functions directly through software interrupt INT66H. All DOS languages are supported either directly or through interface modules.

A traditional approach to using data acquisition products is through the use of menus. Using a question/answer or multiple choice format eliminates the need for programming skills. Data collection scenarios are constructed with optional canned graphics, statistics, and data storage routines. LabPac is not meant to replace menu driven software, much of which provides a high level of functionality for collecting data with ease of use. There are, however, applications where flexibility, power and speed are critical. In these applications, LabPac provides optimized I/O functions that can be integrated into a structure with precision timing.

Another approach to drivers is to use a library of subroutines. In a library environment the entire body of driver code is included in the application, increasing program size and decreasing the available workspace for data and code. In addition some languages cannot access libraries. The most powerful method for supporting all DOS languages is through the use of BIOS level interrupts. In LabPac applications only one short interface module is required to access all 64 functions. A command parameter within the Call determines which function is executed.

Initialization

LabPac installs easily at the DOS prompt.

C>LABPAC <RET>

The command can be included in the autoexec.bat file for automatic installation. Once installed, LabPac will be actively available to any application program running under DOS until the computer is turned off or reset.

The analog I/O, digital I/O, and timer/counter features of LabPac are modular in design. Each feature is initialized separately and has distinct subroutines to monitor parameters. If an application only requires analog input with timed intervals between conversions, then only the analog and timer/counter features will be initialized. This saves valuable time in program execution because unused features are not being serviced.

Single Samples

The simplest level of action is to sample one input channel or send data to an output channel. LabPac provides this level for all supported hardware. Additionally, digital routines will set/clear output lines without disturbing the other lines in an 8-bit port. Functions are available that monitor the state of analog inputs, digital inputs, and timer/counters.

Multiple Channels/Multiple Samples

Analog I/O and digital I/O can be processed in sets of channels. LabPac functions can be configured to manipulate the channel sets at pre-determined intervals under control of the timer/counters. One type of routine uses one 16-bit timer to initiate processing of the set of channels. A second type of routine is part of an interrupt service routine keyed to intervals between hardware interrupts. With the interrupt routines, multiple I/O features can be processed concurrently in time. Multiple channels for analog input and digital I/O can also be processed using routines geared to use hardware triggers. DMA features allow fast background sampling of analog input. All multiple process routines can use up to 64K Byte memory buffers.

The Rest of the Story

Several utility functions arc provided in LabPac. A set of seven functions are designed to provide file I/O for ASCII or binary data files. These files are in formats accepted by all major data analysis/database programs. Functions are provided to perform binary/BCD or BCD/binary conversions and support the LIM EMS 4.0 memory standard. Functions are also provided to suspend a selected process or to return the current status of a process.


Programming Examples

Applications can be developed in any language under DOS. These sample programs in BASIC, C, and Turbo Pascal illustrate data collection from four analog input channels at 1000 samples/second. Each program begins by establishing variables/arrays, initializing analog and timer features (RESET, AIINIT, TIINIT), and opening a data file (CREATE). Every language supported by LabPac has a file (LABHEAD) which predefines key constant or variable labels. Any label used in these examples, which is not explicitly defined, is in this file. Timer/counter 2 is started (TIST) with a divisor of 1000 on an internal one megahertz source providing a 1KHz output. After setup, analog channel zero is monitored ,(AISC) until the input makes a positive going zero crossing. The timed interval function (AIMAX) samples the channels indicated in the array CHANS and stores the data in INDATA. The data is transferred (WRITE) to an ASCII file for later analysis.

Turbo Pascalprogram getdata;
{$i header.btb}
const   NCHANS=4;
        NSWEEPS=1000;
var     filestr: string[255];
        r: PARAMS;
        indata: array[1..NCHANS,l..NSWEEPS]of integer;
        gain,chans: array[l..NCHANS]of integer;
        handle, i: integer;
begin
        r.ax:=RESET;
        intr(labpac,r);
        for i:=1 to NCHANS do
        begin
                gain[i]:= 0;
                chans[i]:=i;
        end;
        r.ax:=AIINIT;r.bx:=$714;r.cx:=NCHANS;
        r.dx:=O;r.si:=Ofs(gain);r.ds:=Seg(gain);
        intr(labpac,r);
        r.ax:=TIINIT;r.bx:=$718;
        intr(labpac,r);
        r.ax:CREATE;filestr:='datl.prn';
        r.bx:=1+Ofs(filestr);r.ds:=Seg(filestr);
        intr(labpac,r);
        handle:=r.ax;
        r.ax:=TIST;r.bx:=2;r.cx:=11; r.dx:=1000;
        intr(labpac,r);
        r.ax:=AISC;r.bx:=0;r.cx:=0;r.dx:=l
        intr(labpac,r);
        r.ax:=AIMAX;r.bx:=2;r.cx:=4;r.dx:=1000;
        r.di:=Ofs(indata);r.es:=Seg(indata);
        r.si: =Ofs(chans);r.ds:=Seg(chans);
        intr(labpac,r);
        r.ax:=WRITE;r.bx:=handle;
        intr(labpac,r);
        r.ax:=LCLOSE;
        intr(labpac,r);
end.


Interpreted BASIC
5 MASTER%=1
10 CHAIN MERGE "LABHEAD.BAS",ALL
500 CALL LABPAC(RESULT,LRESET)
510 NCHANS=4: DMA=0: NSAMPS=1000
520 FILE$="DAT1.PRN":HANDLE=0
530 DIM GAIN(3),CHANS(3),INDATA(3,999)
540 FOR I=0 TO 3:CHANS(I)=I:GAIN(I)=0: NEXT
550 CALL LABPAC(ATOD,NCHANS,DMA,GAIN(0),RESULT, AIINIT)
560 CALL LABPAC(LTIMER,RESULT,TIINIT)
570 CALL LABPAC(FILE$,HANDLE,LCREATE)
580 TCHN=2:TSRC=ll:TPER=1000
590 CALL LABPAC(TCHN,TSRC,TPER,RESULT,TIST)
600 ACHN=0:START=0:FINISH=1
610 CALL LABPAC(ACHN,START,FINISH,RESULT,AISC)
620 CALL LABPAC(TCHN,NCHANS,NSAMPS,CHANS(0),INDAT(0,0),RESULT,AIMAX)
630 CALL LABPAC(HANDLE,NCHANS,NSAMPS,CHANS(0),INDAT(0,0),RESULT,LWRITE)
650 CALL LABPAC(HANDLE,RESULT,LCLOSE)
660 END

C#
include<labhead.h>
int     gain[4]={0},
        chans[4]={0,1,2,3},
        indata[1000][4];
main()
{
int     handle;
        labpac(RESET);
        labpac(AIINIT,0x7l4,4,0,gain);
        labpac(TIINIT,0x7l8);
        handle=labpac(CREATE,"dat1.prn");
        labpac(TIST,2,11,1000);
        labpac(AISC,0,0,1);
        labpac(AIMAX,2,4,1000,chans,indata);
        labpac(WRITE,handle,4,1000,chans,indata);
        labpac(CLOSE,handle);
}

Command Summary

Analog Input
AIGAIN  Change gain level on a channel
AIRAW   Sample one channel
AISC    Wait for threshhold on one channel
AIDMA   Store samples in buffer (DMA transfer)
DMASTAT Status of AIDMA routine
AISWST  Background sampling to buffer
AISTAT  Status of background sampling
AISWAB  Stop background sampling
AIHDW   Externally triggered samples into buffer
AIMAX   Timed sampling stored in buffer


Digital Output
DORAW   Send a sample to one 8-bit channel
DOSET   Set a masked value on one channel
DOCLR   Clear a masked value on one channel
SCRAW   Set/Clear a masked value on a channel
DOSWST  Send values from buffer in background
DOSTAT  Status of background routine
DOSWAB  Stop sending background samples
DOMAX   Timed outputs from a buffer
DOHDW   Strobed outputs on one channel


Utility
ACCESS  Place an EMS buffer into window
ALLOC   Allocate a buffer in EMS memory
FREE    Return EMS memory to free memory
BCD     Convert binary number to BCD format
BIN     Convert BCD number to binary format
CLOSE   Close files opened by LabPac
CREATE  Open a file for saving data
INTCLR  Enable hardware interrupt lines
INTSET  Disable hardware interrupt lines
OPEN    Open a file containing data
READ    Transfer a file to a memory buffer
WRITE   Transfer a memory buffer to a file


Timing/Counting
GETTIME         Get time-of-day from timers 1 & 2
SETTIME         Put time-of-day on timers 1 & 2
SETALARM        Enable the Alarms in counters 1 or 2
TIHDW           Program any mode into a timer/counter
TIST            Start a timer/counter channel
TIAB            Stop a timer/counter channel
TIRAW           Read the value on one timer/counter
TISTAT          Wait for a value on a timer/counter
TILH            Start a waveform output channel


Digital Input
DIRAW   Sample one 8-bit channel
DISC    Wait for a bit pattern on one channel
DISWST  Background sampling to buffer
DISTAT  Status of background sampling
DISWAB  Stop background sampling
DIMAX   Timed sampling stored in buffer
DIHDW   Samples channel on strobe, saves to buffer


Analog Output
AORAW   Send a value on one channel
AOSWST  Send values from buffer in background
AOSTAT  Status of background routine
AOSWAB  Stop sending background samples
AOMAX   Timed outputs on multiple channels


Initialization
AIINIT  Initialize analog input channels
AOINIT  Initialize analog output channels
DINIT   Initialize digital I/O channels
RESET   Clear LabPac to pre-initialized state
SWINIT  Initialize interrupt service routine
TIINIT  Initialize timer/counter channels

System Requirements

DOS Ver. 2.0 or higher

Minimum of 96K Bytes free system memory

Runs in DOS session of Win3.1, Win95 or Win98