Service Manuals, User Guides, Schematic Diagrams or docs for : Keithley Misc 24405B(PCF-40)

<< Back | Home

Most service manuals and schematics are PDF files, so You will need Adobre Acrobat Reader to view : Acrobat Download Some of the files are DjVu format. Readers and resources available here : DjVu Resources
For the compressed files, most common are zip and rar. Please, extract files with Your favorite compression software ( WinZip, WinRAR ... ) before viewing. If a document has multiple parts, You should download all, before extracting.
Good luck. Repair on Your own risk. Make sure You know what You are doing.




Image preview - the first page of the document
24405B(PCF-40)


>> Download 24405B(PCF-40) documenatation <<

Text preview - extract from the document
                            PCF-40




Keithley Data Acquisition            Keithley MetraByte/Asyst
                       User Guide

                                 for fhe



                            PCF-40

       PASCAL, C, 81FORTRAN

                Callable Drivers

                           For The

                           DAS-40




                   Rev sion B - December 1992
            Copyright B Keithley Data Acquisition           1992
                       Part Number: 24405




KEITHLEY   DATA ACQUISITION                    - Kelthley   MetraByte/Asyst

            440 Myles Standish      Blvd., Taunton,   MA 02780
               TEL. 5081880~3000,        FAX 5081880-0179


                                      .. .
                                    - 111  -
                                Warranty Information
   All products manufactured by Keithley Data Acquisition are warranted
   against defective materials and workmanship for a period of one year
   from the date of delivery to the original purchaser. Any product that is
   found to be defective within the warranty period will, at the option of
   the manufacturer, be repaired or replaced. This warranty does not apply
   to products damaged by improper use.



                                       Warning

           Keithley Data Acquisition assumes no liability for damages
        consequent to the use of this product. This product is not designed
          with components of a level of reliability suitable for use in life
                          support or critical applications.




                                      Disclaimer
   Information furnished by Keithley Data Acquisition is believed to be
   accurate and reliable. However, Keithley Data Acquisition assumes no
   responsibility for the use of such information nor for any infringements
   of patents or other rights of third parties that may result from its use. No
   license is granted by implication or otherwise under any patent rights of
   Keithley Data Acquisition.



                                      Copyright
   All rights reserved. No part of this publication may be reproduced,
   stored in a retrieval system, or transmitted in any form by any means,
   electronic, mechanical, photoreproductive, recording, or otherwise
   without the express prior written permission of the Keithley Data
   Acquisition.



Note:
   Keithley MetraBytem is a trademark of Keithley Instruments.

   BasicTM a trademark of Dartmouth College.
         is

   IBM@' is a registered trademark of International Business Machines
   Corporation.

   PC, XT, AT, PS/2, and Micro Channel Architecture@ are trademarks of
   International Business Machines Corporation.

   Microsoft@ is a registered trademark of Microsoft Corporation.

   Turbo C@'is a registered trademark of Borland International.




                                        - iv -
                                              Contents


CHAPTER   1   INTRODUCTION

   1.1        Overview . . . . . . . . , . . . . . . . .        . . . .   .   .   ,   .   .   .   .   ,   .   .   .   .   .   .   .   .   .   .   . l-l
   1.2        Supported Languages . . . . . . . . . .           . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   . l-l
   1.3        Copying Distribution Software . . . . . .         . . . .   .   .   .   .   .   .   .   .   .   .   .   ,   .   .   .   .   .   .   . l-1
   1.4        Loading/Unloading The DAS-40 Software             Driver    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   . l-2
   1.5        Running The Example Programs . . . .              . . . .   .   .   .   .   .   .   .   .   ,   .   ,   .   .   ,   .   .   .   .   . l-3
   1.6        Writing Your Program. . . . . . . . . . .         . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   . l-4


CHAPTER   2: THE DAS-40 DRIVER

   2.1        Overview .......................................                                                                                    .2-l
   2.2        Calling The DAS-40 Driver ..............................                                                                            .2-2
   2.3        Modifying The DAS-40 Driver ............................                                                                            .2-3
   2.4        Modifying The DAS-40 Language Interface Modules ................                                                                    .2-3


CHAPTER   3   LANGUAGE        INTERFACE       MODULES

   3.1        Overview .......................................                                                                                    .3-l
   3.2        Microsoft Cflurbo C .................................                                                                               .3-l
   3.3        Microsoft PASCAL ..................................                                                                                 .3-3
   3.4        Borland Turbo PASCAL ...............................                                                                                .3-5
   3.5        Microsoft FORTRAN .................................                                                                                 .3-8
   3.6        Microsoft QuickBASIC ................................                                                                               3-l 0




                                                  n n n




                                                   -V-
   cl




- vi -
CHAPTER 1

                                                                     INTRODUCTION



1 .I       OVERVIEW
   The PCF-40 is a software package for programmers using Pascal, C, FORTRAN, and QuickBASIC to
   write data acquisition and control routines for the DAS-40 Data Acquisition Board. This package is
   normally supplied on 5.25" low-density diskettes but is also available (upon request) on 3.5"
   diskette(s). Contents of the package include the following:

       l   DAS-40 Software Driver
       l   Language Interface Modules
       l   Source code for Driver and Language Interface Modules
       l   Miscellaneous documentation (.DOC) files
       l   Example program files in all supported languages




1.2 SUPPORTED LANGUAGES
   The PCF-40 supports all memory modules of the following languages:

           Microsoft C (V4.0 - 7.0)
           Microsoft Quick C (V1.0 - 2.0)
           Microsoft Pascal (V3.3 - 4.0)
           Microsoft FORTRAN (V4.0,4.1)
           Microsoft QuickBASIC (V4.0 and higher)
           Borland Turbo Pascal (V3.0 and higher)
           Borland Turbo C (Vl .O- 2.0)
           Lahey Personal FORTRAN (V1.0 - 2.0)
           GW, COMPAQ, and IBM BASIC (V2.0 and higher)




1.3 COPYING DISTRIBUTION SOFTWARE
   As soon as possible, make a working copy of your Distribution Software. You may put the working
   copy on diskettes or on the PC Hard Drive. In either case, making a working copy allows you to store
   your original software in a safe place as a backup.

   To make a working copy of your Distribution Software, you will use the DOS COPY or DISKCOPY
   function according to one of the instructions in the following two subsections.




                                                                                                   I-1
PCF-40          USER GUIDE



      To Copy Distribution Software To Another Diskette
      In either of these instructions, the SOUYC~diskette will be the diskette containing your Distribution
      Software; the farget diskette will be the diskette you will copy to. Before you start, be sure to have
      one (or more as needed) formatted diskettes on hand to serve as target diskettes.

      First, place your Distribution Software diskette in your PC's A Drive and log to that drive by typing
      A:. Then, use one of the following instructions to copy the diskette files.

       l     If your PC has just one diskette drive (Drive A), type COPY * . *     B : (in a single-drive PC,
           Drive A also serves as Drive B) and follow the instructions on the screen.

           If you prefer to use the DOS DISKCOPY function, instead of COPY, you will type DISKCOPY
           A: A: and follow instructions on the screen. This alternative is faster, but requires access to
           DISKCOPY COM, in your DOS files.
       l     If your PC has two diskette drives (Drive A and Drive B), type COPY * . *       B : (the same as
           above) and follow the instructions on the screen.

           If you prefer to use the DOS DISKCOPY function, instead of COPY, you will type DISKCOPY
           A:   B : and follow instructions on the screen. This alternative is faster, but requires access to
           DISKCOPY.COM, in your DOS files.



      To Copy Distribution Software To The PC Hard Drive
      Before copying Distribution Software to a hard drive, make a directory on the hard drive to contain
      the files. While the directory name is your choice, the following instructions use PCF40 .

       1. After making a directory named PCF40 , place your Distribution Software diskette in your PC's A
          Drive and log to that drive by typing A: .
      2. Then,type COPY *.*        path\PCF40          , where path is the drive designation and DOS path (if
         needed) to the PCF40 directory.


      When you finish copying your Distribution Software, store it in a safe place (away from heat,
      humidity, and dust) for possible future use as a backup.




1.4 LOADING/UNLOADING                          THE DAS-40 SOFTWARE DRIVER
      The DAS-40 Device Driver consists of the two files MDA!%O.EXE, and VIPARSE.EXE. As executable
      files, both are self-loading. Loading and unloading may be performed from the DOS command line or
      from a batch file. Note that a path may have to proceed the commands unless you are logged into the
      correct directory.




l-2
                                                                         CHAPTER 1: INTRODUCTION


 At the DOS command line, type the following:

  VIPARSE

 followed by

  MDAS40       lCO= fire0 ICI = $lel

 Where file0 and fire1 are optional configuration files for Cards #0 and Card #l, respectively. These
 files are presumed created via the Distribution Software utility CONFIG4O.EXE. Refer to the Section
 3.4 ( CHMGEVG THE FACTORY CONFIGURATlON                ) for more detail. Specification of switches /CO=
 and /CZ= is optional. If you specify no switches, Factory Configuration is assumed for up to two
 physical boards. If you specify both /CO=and /Cl=, their order on the command line is irrelevant.

 These loading commands may be entered automatically on power-up by adding them to your
 AUTOEXEC.BAT file. Use any ASCII text editor or a word processor to add the commands in the
 order shown above.

 The DAS40 Device Driver (both files) may also be unloaded from the DOS Command line or from a
 batch file. Unloading the Device Driver returns the memory it occupies to DOS. The Device Driver
 files must be unloaded in the following order: first MDA%lO.EXE, then VIl'ARSE.EXE.

 To unload MDA!%O.EXE, type the following:

  MDAS40       /U

 and for VIPRASE.EXE,

  VIPARSE       KJ

 Note that VIPARSE and MDAS40 occupy approximately 7600 bytes and 18000 bytes respectively.




1.5 RUNNING THE EXAMPLE PROGRAMS
 The PCF-40 Distribution Software includes several example programs written in the various
 supported languages. These programs are in source-code and executable (.EXE) forms. To run these
 programs proceed as follows:

  1. With the computer powered down, install your Factory Configured DAS-40 board and then
     power up. Refer to the appropriate section of your User Guide for hardware installation
     directions.
  2. Install VIPARSE and MDAS40 as described in Section 1.4 of this manual.
  3. Type the name of the example program you wish to run (for example, pa th\MSCEXMPL
     followed by < Enter > where path is the drive designation and DOS path (if needed).


 Note that most example programs assume that the DAS-40 is factory-configured (the various on-board
 switches and jumpers are set to factory-default positions. Refer to Section 3.6 of the DAS-40 User
 Guide for more information. If the Factory Configuration is not adequate for your system (the DMA
 Channel(s) or the Interrupt Level conflict with other devices in your system), refer to Section 3.4 of the
 DAS-40 User Guide for instruction on how to re-configure your board.

                                                                                                       1-3
PCF-40 USER GUIDE


  If you make changes to any of the example programs, refer to the supplied file HOWTOEXE.DOC for
  steps necessary to recreate a new executable program.




1.6 WRITING YOUR PROGRAM
  The example program for the language you are using will provide you with most of the information
  you need to start your own DA!540-based application program. As an illustration, to create a program
  using Microsoft C, proceed as follows:

      1. Write your program using a text editor or the QuickC Environment.
      2. Compile your program using the CL command
                 CL /Ax /c exalnp1e.c

         where in the memory-model switch /Ax, x = S, C, M, or L.
      3. Link your program to the Language interface module DA%O.LIB:
                 LINK exaxnple,,,DAS4O.LIB;


  You now have an executable program ready to run. Repeat all three steps as you modify/fix this
  program.




1-4
     CHAPTER 1: INTRODUCTION




cl




                         1-5
CHAPTER 2

                                                            THE DAS-40 DRIVER



2.1 OVERVIEW
 All languages supported by the PCF-40 use the same installable driver, MDAS40,EXE . This driver
 was programmed in Assembly Language with the Microsoft Assembler (MASM), Version 5.1, and
 consists of the following modules:

  l     D4Odrive.ASM
  l     D40modes.ASM
  l     D$Ofunct.ASM
  l     D40utils.ASM
  l     LU.ASM


 The DAS40.EXE Znclude file is DAWLDEF . All of these files are included in your PCF40
 Distribution Software diskette(s).

 In addition to the MDAS40 Driver, Interface Modules for various languages are also included in this
 package. You must LINK your program to the appropriate module for proper communication to the
 MDA940 Driver. A typical module occupies approximately 200 bytes. These Modules are as follows:

  l     DAS40.LIB: Use for mode calls from Pascal, C, FORTRAN, and stand-alone QuickBASIC
      programs.
  l     DAS40,BIN: Use for mode calls from BASIC(A).
  .     DAS40,QLB: Use for mode calls from the QuickBASIC Integrated Development Environment
      (Ver. 4.0 - 4.5).
  l     DAS40x.QLB:     Use for mode calls from the QuickBASIC Extended Environment (Ver. 7.0).
  .     DAS40TP.OBJ: Use for mode calls from TURBO Pascal.


 The Interface Modules support all MODES listed here and described in the User Guide. MODES are as
 follows:

      MODE 0   Initialize and Query Configuration of an installed DAS-40.
      MODE 1   Assign a buffer and sample count to each DMA level for both A/D and D/A. Used
               before calling MODES 4 or 5.
      MODE 2   Setup for N A/D or D/A conversions for transfer via DMA. Used before calling MODES
               4or5.
      MODE 3   Setup global start and stop channels and overall gain.
      MODE 4     Start A/D conversions and transfer via DMA as setup in MODES 1,2.
      MODE 5     Start D/A conversions and transfer via DMA as setup in MODES 1,2.
      MODE 6     Setup Pacing clock rate.

                                                                                                  2-1
PCF-40 USER GUIDE

       MODE 7       Perform one A/D conversion on specified channel.
       MODE 8       Perform one D/A conversion on DAC channel (1,2, or both).
       MODE 9       Monitor ADC/DAC DMA transfer status.
       MODE 10 Setup for Digital Input/Output.
       MODE 11 Input Byte/Word.
       MODE 12 Set/Query current DAS-40 Card number
       MODE 13 Terminate Current DMA transfer - A/D In or D/A Out.
       MODE 14 Output Byte/Word.
       MODE 15 Tag channel numbers to data.
       MODE 16 A/D Triggered Block Scan (DMA).
       MODE 17 Transfer A/D Data to a BASIC Array.
       MODE 18 Allocate Memory buffer for DMA.
       MODE 19 Free DMA Memory Buffer.



2.2 CALLING THE DAS-40 DRIVER
      The DAS40 Driver is called through a single and unique label to the language/model you are using.

      The following is a list of CALL routine labels available in the Language Interface Modules.

      DAS40.LIB :
         mscs-das40                                 For Calls from Microsoft C, Small Model
         mscm-das40                                 For Calls from Microsoft C, Medium Model
         mscl-das40                                 For Calls from Microsoft C, Large Model

         tcs-das40                                  For Calls from TURBO C, Small Model
         tcm-das40                                  For Calls from TURBO C, Medium Model
         tcl-das40                                  For Calls from TURBO C, Large Model

         msp-das40                                  For   Calls   from   Microsoft Pascal
         basdas40                                   For   Calls   from   Microsoft QuickBASIC
         msf-das40                                  For   Calls   from   Microsoft FORTRAN
         lhy-das40                                  For   Calls   from   Lahey FORTRAN


      TPDAS4O.OBJ :
         tp-das40                                   For Calls from TURBO Pascal


      DAS40.BIN :
         das40                                      For Calls from BASIC(A)




2-2
                                                                         CHAPTER 2: THE DAS-40 DRIVER

 Regardless of the language/model you are using, each call to its label requires the specification of
 three input parameters, as follows:

       MODE             A &bit integer quantity containing the number of the MODE to be executed by the
                        DA!+40 driver.
       PARAM            An array of ten 16-bit integers containing MODE-dependent arguments required for
                        the successful execution of the MODE. These are also used to return information.
       FLAG             A &bit integer quantity that contains a number representing any Error Code
                        reported by the DA!540 driver. Note that the least significant eight bits contain the
                        error number, while the most significant eight bits contain the current MODE
                        number.


 Refer to Chapter 3 for details on how to declare and use these variables in the language you are using.

 The following is a code fragment on how to declare and use the call parameters.


 int      Mode:
 int      Flag;
 int      Params[lO];

 Mode = 0;
 Flag = 0;
 Params[O] = 0;
 mscl_das4O(&Mode,             Params,    &Flag);
 if (Flag != 0)
       printf      (I'****   Error   %u detected     in mode O", Flag        & Oxff) ;



2.3 MODIFYING THE DAS-40 DRIVER
 DAS40.EXE is a functional and fully tested software driver that supports all documented MODES of
 operation, as described in the DAS-40 User Guide. To create a new version of this driver, your
 development tools must include the assembler (MASM) and the program Linker (LINK), and they
 must be installed on your system and accessible from your current directory. To assemble a module
 (D40FUNCT.ASM for example), proceed as follows:

  1. Your command-line entry should be MASM D40FUNCT;
  2. Once all modules are assembled without errors, use the following command to link these
     modules:
                LINK D40DRIVE+D40MODES+LU+D40FUNCT+D40UTILS,DAS4O,DAS40,VI.LIB;
 The successful outcome of the LINK step is the installable DAS40 driver DAS40.EXE . Refer to the
 DA%0 manual section LOADZNG THE DAS-40 DRWER for more detail.

 Note, the VLLIB is the interface library to VIPARSE and is included on the distribution diskette(s).

2.4 MODIFYING THE DAS-40 LANGUAGE INTERFACE MODULES
 The Interface Modules support all MODES described in the DAS-40 Manual. To create a new version
 of any of these modules, your system must have the necessary development tools, including:

 MASM.EXE                    Microsoft Assembler




                                                                                                          2-3
PCF-40 USER GUIDE

  LINK.EXE                  Microsoft Linker

  LIB.EXE                   Microsoft Librarian


  Other utilities will be specified below, as necessary. All of these tools must be installed on your
  system and accessible from your current directory. Source code for these modules is in the files
  DASlOPCF.ASM and DAS4OTP.ASM (TURBO Pascal only), which are in the Distribution Software.




      DAS40.BIN - BASIC(A) Interface
  The BASIC(A) interface is the BLOAD'able DAS40.BIN file. To create this file, you must have access to
  the following utilities:

       EXE2BIN.EXE                A Microsoft .EXE to .COM file conversion utility.
       MAKEBIN.EXE                A .COM to .BIN file-conversion utility (supplied with the PCF-40
                                  Distribution Software).


  To create DAS40.BIN, use the following commands:

        MASM /DBIN=I DASIOPCF;
        LINK DAS4OPCF,,,;
        EXE2BIN DAS40PCF.EXE   DAS4O.COM
        MAKEBIN DAS40.COM



  All four steps must be successful. Note that the LINKing operation generates the warning:

            LINK : Warning L4021: no stack segment


  This warning is irrelevant; ignore it and proceed to the next step.

      DAS40TP.OBJ - TURBO PASCAL Interface
  The TURBO PASCAL interface is the DAS40TP.OBJ file and is linked directly into the TURBO
  PASCAL module, by using the $L compiler directive. To create this file you must have access to the
  following utilities:

            TASM.EXE - TURBO Assembler


      To create DASlOTP.OBJ, use the following command:

         TASM   DASQOTP;



      DAS40.QLB - QuickBASIC Integrated Environment (V4.5) Interface
      The interface for QuickBASIC Integrated Environment (up to Ver 4.5) is made using the Quick Library
      file DAS40,QLB. This file is specified on the command line with the load /L switch. For example,
      QB /L DAS40.QLB.

      To create the DASlO.QLB file you must have access to the utility BQLB45.LIB, which is the
      QuickBASIC Integrated Environment Library. Use the following entries:


2-4
                                                                 CHAPTER 2: THE DAS-40 DRIVER

   MASM /DBIN=O    DASQOPCF;
   LINK   /q DAS4OPCF,DAS4O,,BQLB45;




DAS4OX.QLB - QuickBASIC Integrated Environment (V7.0) Interface
To create a QLB library compatible with QuickBASIC Version 7.0, follow the procedure described for
QB V4.5; however, link with QBXQLB.LIB instead of BQLB45.LIB, as follows:

   LINK   /q DAS4OPCF,DAS4Ox,,QBXQLB;



Note that the output file (from the linker) is renamed DAS~OXQLB to avoid incompatibility
conflicts with QuickBASIC 4.5. To create a stand-alone QuickBASIC .EXE program, see the
discussion that follows on the PASCAL, C, and FORTRAN Interface.




DAS40.LIB - PASCAL, C, And FORTRAN Interface
The interface for Pascal, C, or FORTRAN (and stand-alone QB .EXEsl uses the library file DAS40LIB      .
This file is linked to the user's program with the following commands:

   MASM /DBIN=O DASQOPCF;
   LIB DAS40-+DAS4OPCF;



Note that DASlOPCF.OBJ is the only module in the output library DAS4 0 . LIB . This was done
intentionally at development time to eliminate possible confusion between the different versions of
DAS4OPCF.OBJ (/DBIN=O or /DBIN=l ?). However, you may want to bypass the LIB step and add
the DAS40PCF.OBJ to your linker input list.



                                              n DD




                                                                                                 2-5
PCF-40 USER GUIDE




2-6
CHAPTER 3

                                        THE LANGUAGE INTERFACE



3.1 OVERVIEW
 Although your DA%0 software driver modes are identical for all supported languages, there are
 differences in the manner in which parameters and parameter values are passed to these modes from
 different languages. Specifically, the items causing the most confusion are as follows:

  1. Memory allocation for DMA buffers.
  2. Separating a FAR (32-bit) pointer into its Segment and Offset values (two l&bit values).


 Refer to the appropriate section below for details on performing the Driver Mode Calls from the
 language you are using. The language sections below contain brief code fragments for illustration
 only; refer to the example program(s) on your distribution diskette(s) for more information.




3.2 MICROSOFT C I TURBO C
 The C Language with its large run-time libraries and full pointer-manipulation support provides the
 most flexible environment for writing programs that fully utilize your DAS40 product.


 The Software Driver Mode Call Labels
 In your program, declare one of the following function prototypes:

 mscs-dasg(int       *, int *, int *);            /* MS C Small Model */
 msczn_dasg(int      *, int *, int *);            /* MS C Medium Model */
 xnscl-dasg(int      *, int *, int *);            /* MS C Large Model */
 tom-dasg(int      *, int *, int *);              /* Turbo C Medium Model*/
 tcl-dasg(int      *, int *, int   *);            /* Turbo C Large Model */



 These function prototypes may be optionally proceeded by the C keyword extern I


 The Call Parameters
 Declare the mode call parameters as follows:

 int Mode;
 int Param     1101;
 int Flag;

 The Params[l array index values are 0 thru 9 inclusive.




                                                                                                     3-1
PCF-40 USER GUIDE

      An Example

      To call MODE 0 of the DAS-40 driver from an MS C Medium Model program,


      Mode=0 ;
      Flag=0 ;
      Pararns[O]=O;
      rnscxr-das40  (&Mode, Params,        &Flag);
      if (Flag !=O)
          i
             printf ("Mode %d Error       Flag   = %d\n",    Mode,   Flag   & Oxff);
             exit(l);
         I


      Note that specifying Params in the call statement is the same as &Pa~mrzsFJl .

      Linking To The Driver/Interface Module
      Once you have your C program written, you must compile and LINK it to the Interface Module,
      DAS40.LIB. DAS40.LIB is where the label mscm~da.540label resides.

      For example, if your program is in the Medium Model,

         CL /AM /c .OBJ,,,DAS4O.LIB;



      If no errors are reported, you now have the executable file .EXE that is ready to test.
      In the case that errors such as Unresolved External(s) are reported by the LINKer, then you must
      verify that you have LINKed to DAS40.LIB correctly.

         NOTE:     Be sure to use the correct Call Label for the Memory Model you are using. For example,
                   use mscm~das40 when you compile your program using the Medium Memory Model i.e
                   using compiler switch /AM.



      DMA Memory Buffer Allocation
      MODE 1 requires the specification of one or two far pointers to DMA buffers each in the form of two
      lb-bit values: Segment and Offset. These pointers should be previously obtained via calls to MODE 18.
      The following C program fragment illustrates the use of Modes 18 and 1:

      /* ALLOCATE A DMABUFFER */
      Mode = 18;
      ErrFlag = 0;
      Params[Ol  = Asamples;
      mscl_daslO   (&Mode, Paraxns, &ErrFlag);
      if (ErrFlag != 0) ProcessErrO;




3-2
                                                             CHAPTER 3: THE LANGUAGE INTERFACE


 /* SAVE ACTUAL BUFFER           SIZE,    SEGMENT   AND   OFFSET   */
 Asamples = Params[O];
 BufAOffSet   = Params [l] ;
 BufASegment = Paraxns [2] ;
 ActBufAOf f set = Params [ 31
 ActBufASegrnent  = Params [4] ;

 /* SPECIFY BUFFER FOR DMA CONTROLLER */
 Mode = 1;
 ErrFlag  = 0;
 Params[O]     = BufAOffset
 Paraxns [l]   = BufASegznent
 Par-[21       = Asamples;

 Note that the contents of ParamsIll and ParamsI21 as returned by Mode 18 are passed to Mode 1;
 while the contents of ParamsI31 and ParamsI41 should be later used by Mode 19 to free the allocated
 memory block.

 Refer to your DAS-40 User Guide for a complete description of the Modes mentioned here.

 Note for Borland Turbo C/C++ users
 Similar to `allocmem0 in the Borland Turbo C/C++ run-time library function, MODE 18 uses DOS
 INT 0x21 function 0x48 to allocate a free memory block from the far heap. According to the Borland
 Turbo C/C++ Library Reference, allocmem0 function remarks: `allocmem and -dos-allocmem can not
 coexist with malloc.' Furthermore, MODE 18, like allocmem0, can not coexist with all C/C++
 functions that indirectly use malloc such as fopen0, fprintf0, etc... this restriction applies to all
 Borland Turbo C/C++ versions.

 However, as the supplied example TCexamp2.c illustrates, Turbo C functions such as `fopen0' may be
 safely used before the first call to MODE 18.

 Far Pointer Manipulation
 MODES 1,2, and 17 require that FAR pointers be passed in the user Params[] integer array. The
 Segment and Offset of all FAR pointers (32 bit) in C may be retrieved using the built-in functions:
 FE-OFF and El'-SEG. Refer to your C Run-time library manual for more detail.

 The following code fragment illustrates how to pass the addresses of user arrays ChansIl and GainsI
 to Mode 2:

 int far *pChans =          &Chans[Ol;
 Mode = 2;
 Params[O]  = (int)         FP OFF(pChans);
 Params[l]  = (int)         FP-SEG(pChans);
 Par-[21    = (int)         FP-OFF(pGains);
 Pararns[3] = (int)         FPSEG(pGains);



3.3 MICROSOFT PASCAL

 The Software Driver Mode Call Labels
 In your program, declare the following function prototype:

 FUNCTION   MSP-DASQO(VAR   Mode:integer;VAR   Params:PArray;VAR   Flag:integer):integer;   external;




                                                                                                        3-3
PCF-40 USER GUIDE

  The Call Parameters
  Declare the mode call parameters as follows:

  TYPE
     PArray      = array   [l..lO]   of word     ;

  VAR
     Params         : PArray;                         (* MODE     PARAM ARRAY *)
     Mode,Flag      : integer;                        (* MODE     CALL VARIABLES  *)
     Result         : integer;                        (* MODE     CALL RETURN VALUE *)



  The Params[] array index valuesare 1 through 10 inclusive. Note that if PArray TYPE is declared as
  [0..9] then the index value starts at 0.


  An Example
  To call MODE 0 of the DAS-40 driver from MS Pascal program,


  Mode := 0;
  Params[l]  := 0;                                     (* BOARD    NUMBER   0 *)
  Result := MSP DAS40 (Mode, Params,                 Flag);
  if (Result <>-0) then ReportError;



  where XeportError is a previously declared procedure that displays an error message and terminates
  the program. Refer to the Microsoft PASCAL example program (in the Distribution Software) for
  more detail.


  Linking To The Driver/Interface Module
  Once you have your MS Pascal program written you must compile and LINK it to the Interface
  Module, DASIO.LIB. DAS40.LIB is where the label MSP-DASIO label resides.

  For example,

        PL ,,,DAS4O,LIB;

  If no errors are reported, you now have the executable file .EXE that is ready to test.
  In case errors such as Unresolved External(s) are reported by the LINKer, then you must determine
  whether you LINKed to DAS40.LIB correctly.

  DMA Memory Buffer Allocation
  MODE 1 requires the specification of one or two far pointers to DMA buffers each in the form of two
  16-bit values: Segment and Offset. These pointers should be previously obtained via calls to MODE 18.
  The following MS Pascal program fragment illustrates the uses of Modes 18 and 1:

   (* ALLOCATE MEMORY FOR DMA BUFFER             *)
  Asamples   := 20000;
  Mode := 18;
  Params[l]   := Asamples;
  Result := MSP_DAS40(Mode,Para,Flag)                   ;
  if(result <> 0) THEN ReportError;




3-4
                                                                   CHAPTER 3: THE LANGUAGE INTERFACE


  (* SAVE RETURNED VALUES *)
 Asamplea     := Paramstl];
 AOffset      := Params [2] ;
 ASegment     := Parazns[3];
 AOffActual   := Params[4];
 ASegActual   := Paraxns[S];

  (* PASS ADDRESS OF DMA BUFFER                TO MODE      1 *)
 Mode := 1;
 Paraxnstll := AOffset;
 Params[2]   := ASegment;
 Params [ 31    := Asamples;


 Note that the contents of Params[l] and Params[2] as returned by Mode 18 are passed to Mode 1;
 while the contents of Params[Sl and Params[41 should be later used by Mode 19 to free the allocated
 memory block.

 Refer to your DAS-40 User Guide for a complete description of the           Modes mentioned here.


 FAR Pointer Manipulation
 MODEs1,2,and 17require that FAR pointers passedin the userParams[]integerarray.
                                                be                                            The
 Segment and Offset of all FAR pointers (32 bit) in MS Pascal may be retrieved using the built-in
 operator ADS and the .S and .R sub-operators! Refer to your MS Pascal manual(s) for more detail.

 The following code fragment illustrates how to pass the addresses of user arrays Chans[l and Gainsi]
 to Mode 2:


 Mode           :=   2.
 Params         :=   (ADS   Chans).R;
 Paraxns [21    :=   (ADS   Chans).S;
 Params[3]      :=   (ADS   Gains).R;
 ParamsC41      :=   (ADS   Gains).S;



3.4 BORLAND TURBO PASCAL

 The Software Driver Call Label
 The call label T'P-DAS40 is provided to use from any Turbo Pascal program; declare this label in your
 program as follows:

 FUNCTION   TP-DASQO(VAR    Mode:lnteger;VAR     Parms:PArray;VAR     Flag:integer):integer;   external;




 The Call Parameters
 Declare the mode call parameters as follows:

    TYPE
            PArray    = array      [l..lO]     of   word;
    VAR
            Paraais                 : PArray;                (* MODE    PARAM ARRAY *)
            Mode,Flag               : integer;               (* MODE    CALL VARIABLES  *)
            Result                  : integer;               (* MODE    CALL RETURN VALUE *)

 The Params[] array index values are 1 thru 10, inclusive. Note that if PArray TYPE is declared as

                                                                                                           3-5
PCF-40 USER GUIDE

      [0..9], then the index values start at 0.




      An Example:
      To call MODE 0 of the DAS-40 driver from Turbo Pascal program:


      Mode := 0;
      Params[l]  := 0;                                      (* BOARD   NUMBER    0 *)
      Result := TP DAS40 (Mode, Params,            Flag);
      if (Result .pas



      DMA Memory Buffer Allocation
      MODE 1 requires the specification of one or two far pointers to DMA buffers each in the form of two
      16-bit values: Segment and Offset. These pointers should be previously obtained via calls to MODE 18;
      refer to the DA%0 User Guide for complete description of this mode. For this MODE to work
      correctly from Turbo Pascal, you must set aside some free memory as the DOS far heap; use the $M
      Compiler Directive to configure this heap.

      By default, Turbo Pascal reserves all memory, that is normally given back to DOS (while your
      program is running), for its own internal Heap Manager. The Heap manager is the part of Turbo
      Pascal that your program goes through when using the Pascal functions GetMemO and FreeMemO.
      Using the $M Directive in your program, you can specify the amount of memory to reserve for the
      program stack and for the Heap Manager. The remaining memory not allocated for programs, data,
      Stack or the Heap manager constitutes DOS far heap; the total size of this heap depends on your
      system.

      Examples:

      1. To reserve all free memory to the Pascal heap manager:

                    $M (16384,0,6553601

      This is the default where calls to MODE 18 WILL ALWAYS FAIL:




3-6
                                                           CHAPTER 3: THE LANGUAGE INTERFACE

2. To reserve 16K bytes for the stack and 64K bytes for the Pascal heap manager:

$M (16384,0,65536)

The remaining memory not allocated for programs, data less 16K bytes for Stack and less 64K bytes
for the Heap manager constitutes the new DOS heap.

3. To reserve 16K bytes for stack no space for the heap manager:

             $M (16384,0,0)

These parameters are recommended when not using any TURBO Pascal heap manager functions (e.g.
GetMemO, FreeMemO...) and using MODE 18 in your DAS-40 application programs. Using these $M
parameters reserves the remaining memory not allocated for programs or data, less 16K bytes for
Stack as the new DOS heap. The following Borland Turbo Pascal program fragment illustrates the uses
of Modes 18 and 1:

 (* ALLOCATE MEMORY FOR DMA BUFFER *)
Mode := 18;
Params[ll   := 10000;               (* 10K SAMPLES              *)
Result := TP_DAS40(Mode,Params,Flag)     ;
if (result  <> 0) THEN ReportError;

 (* SAVE MODE 18 RESULTS *)
Asamples     := Params[l];
AOffset      := Pararns[2];                 (*   DMA BUFFER OFFSET *)
ASegment       := Pararns[3]   ;            (*   DMA BUFFER SEGMENT *)
ActAOffset    := Params[4];                 (*   MEMORY BLOCK OFFSET *)
ActASegment:=    Params[5];                 (*   MEMORY BLOCK SEGMENT *)

 (* SPECIFY    PARAMS    OBTAINED    THRU MODE     18 *)
Mode := 1;
Params[l]     := AOffset;
ParamsC21     := ASegment;
Params[3]     := Asamples;

Note that the contents of Params[l] and Params[2] as returned by Mode 18 are passed to Mode 1;
while the contents of Params[3] and Params[4] should be later used by Mode 19 to free the allocated
memory block.

Refer to your DAS-40 User Guide for a complete description of the Modes mentioned here.



FAR Pointer Manipulation
MODES 1,2, and 17 require that FAR pointers be passed in the user Params[] integer array. The
Segment and Offset of all FAR pointers (32 bit) in Turbo Pascal may be retrieved using the built-in
functions Ofs and Seg . Refer to your Turbo Pascal manual(s) for more detail.

The following code fragment illustrates how to pass the addresses of user arrays Chans[l and Gains11
to Mode 2:

Mode := 2;
Params[l]     :=   Ofs   (Chans);
Params[2]     :=   Seg   (Chans);
Params[3]     :=   Ofs   (Gains);
Params[4]     :=   Seg   (Gains);




                                                                                                      3-7
PCF-40 USER GUIDE

3.5 MICROSOFT FORTRAN

      The Software Driver Call Label
      The call label msf_du.& is provided to use from any MS FORTRAN program; no prototype
      declaration of the label is required.




      The Call Parameters
      Declare the mode call parameters as follows:

              integer*2    i (10)                    !Parameter Array
              integer*2    mode                      !Mode number
              integer*2    flag                      !Return error flag



      Note that by default, FORTRAN array index values begin at 1. The latest versions of FORTRAN,
      however, allow you override this default to start at index value 0. Refer to your FORTRAN Manuals
      for more detail.




      An Example
      To initialize DAC#O to plus-full-scale (MODE 8 of the DAS40 driver) from a MS FORTRAN program:

              mode=8
              i(l)=4095                     ! + Full Scale
              i(2)=0                        ! DAC # 0
              call msf_das4O(mode,  i(l), Flag)
              if (flag .NE. 0) then
                   print *,'Mode = ',mode,'      Error # ',flag                 .AND. 255
              endif




      Linking To The Driver Interface Module
      The FORTRAN Interface consists of LINKing to the supplied DAS40.LIB. This Library is where the
      label msf&s40 resides.

              FL /FPi /c .for
              LINK ,,,DAS4O.LIB;



      If no errors are reported, you have the executable file .EXE ready to test. In the case
      that errors such as Unresolved External(s) are reported by the LINKer, you must check on whether
      you LINKed to DASIO.LIB correctly.

      DMA Buffer Memory Allocation
      MODE 1 requires the specification of one or two far pointers to DMA buffers each in the form of two
      16-bit values: Segment and Offset. These pointers should be previously obtained via calls to MODE 18;
      refer to the DAS-40 User Guide for complete description of this mode.




3-8
                                                             CHAPTER 3: THE LANGUAGE INTERFACE

 The following FORTRAN program fragment illustrates the uses of Modes 18 and 1:

         C ALLOCATE     20K   WORDS       OF MEMORY
         mode=1 8
         i (1)=20000                          ! NUMBER   OF SAMPLES
         call xnsf-das4O(md.e,            i(l), Flag)

         C SAVE RETURNED PAR&METERS
         SAMPLES = i(1)            ! ACTUAL NUMBER OF SAMPLES
         BUFOFF = i(2)             ! DMA BUFFER OFFSET
         BUFSEG = i(3)             ! DMA BUFFER SEGMENT
         ACTBUFOFF  = i(4)         ! MEMORY BLOCK OFFSET
         ACTBDFSEG  = i(5)         ! MEMORY BLOCK SEGMENT

         C SETUP DATA      BUFFER        FOR DMA OPERATION
         mode=1
         i(l)=BUFOFF                         ! MEMORY    OFFSET
         i(2) =BUFSEG                        ! MEMORY    SEGMENT
         i( 3) =SAMPLES                      ! NUMBER    OF SAMPLES

 Note that the contents of i(2) and i(3) as returned by Mode 18 are passed to Mode 1; while the contents
 of i(4) and i(5) should be later used by Mode 19 to free the allocated memory block. Refer to your
 DAS-40 User Guide for a complete description of the Modes mentioned here.

 FAR Pointer Manipulation
 To obtain the Segment and Offset values for a given FAR variable address, use the functions
 KM-segadr0 and KM_offadr(~. These functions are designed for use from Large Model programs only
 because FORTRAN does not provide any straight-forward way to perform them.

  KM-segadr(far pointer)       Returns a lbbit Segment value of the FAR pointer specified.
  KM-offaddr(far pointer)      Returns a 16-bit Offset value of the FAR pointer specified.


 The following code fragment illustrates how to pass the address of user array `buffer' to Mode 17:

         mode=17
         i(l)=BUFOFF                           !SOURCE ADDRESS OFFSET
         i(Z)=BUFSEG                           !SOURCE ADDRESS SEGMENT
         i (3)=KM_offadr      (buffer)         !DESTINATION ADDRESS OFFSET
         i(4)=KM_segadr(buffer)                !DESTINATION ADDRESS SEGMENT
         i (5) =2000                           !SAMPLES TO TRANSFER
         i (6)=0                               !INDEX OF 1ST SAMPLE




3.6 MICROSOFT QUICKBASIC
 The Software Driver Call Label
 You must declare the CALL label to make it known to your application; you make this declaration by
 inserting the following at the beginning of your program:

 DECLARE SUB BASDASIO             (MODE AS INTEGER,           BYVAL PARAMS AS        INTERGER,
 FLAG AS INTERGER)

 Note that all subroutine DECLARES in your program MUST be made before any $DYNAMIC arrays
 are allocated. $DYNAMIC data is data that is allocated space in the FAR heap, outside the default
 data segment. All arrays used for data acquisition must be declared as $DYNAMIC; QuickBASIC
 assumes $STATIC data (Default data segment) unless otherwise specified.



                                                                                                      3-9
PCF-40 USER GUIDE

  The Call Parameters
  Declare the mode call parameter array D%(lO) as follows:

        DIM D%(lO)
        COMMON SHARED D%()

  By making it COMMON SHARED, other modules and subroutines can use this array.

  An Example
  To initialize your DAS-40 board use MODE 0 as follows:


  180 iD% = 0                       `initialize      mode
  190 FLAG% = 0                     `declare     error  variable
  200 D%(O) = 0                     'Card #0
  210 CALL BASDASIO(MD%, VARPTR(D%(O)),       FLAG%)
  220 IF FLAG% <> 0 THEN PRINT "MODE 0 Error # I'; FLAG% AND                   255:   STOP




   Linking To The Driver Interface Module
  The QuickBASIC Interface consists three separate Modules:

       DAS4O.QLB              Use when you load the QuickBASIC Environment Version 4.5 and you
                              plan to run your program from within the Environment (no EXE
                              involved here). Use the /L switch to load this Quick Library into
                              QuickBASIC:

                                              QB /L DASIO 


       DAS40X.QLB             This is identical to DAS40.QLB except that it is designed for QuickBASIC
                              Extended Environment Version 7.0 (QBX). Use the /L switch to load this
                              Quick Library into QuickBASIC:

                                              QBX /L DASIOX 
       DAS40.LIB              Link to this library when you want to make a stand-alone EXE program
                              from your QuickBASIC source. To create such a program, use BC and
                              LINK the QuickBASIC compiler and linker as follows:

                                              BC .bas   /o;
                                              LINK , ,,DASIO.LIB;



   DMA Buffer Memory Allocation
  MODE 1 requires the specification of one or two far pointers to DMA buffers each in the form of two
  16-bit values: Segment and Offset. The DMA buffers are obtained differently depending on whether
  you are running your application program from the QuickBASIC Integrated Environment or as a
  Stand-alone EXE from the DOS command line.

  When running as stand-alone EXE programs, use MODE 18 to allocate DMA buffers; refer to the DAS-
  40 User Guide for complete detail.



3-10
                                                        CHAPTER 3: THE LANGUAGE INTERFACE

When running your programs from within the Integrated Environment, your program can not include
calls to MODE 18. This mode call will always fail because the QuickBASIC Environment controls all
free memory. In the QB Environment, you can declare large $DYNAMIC arrays as your DMA buffers.
$DYNAMIC arrays are placed by QuickBASIC in the far heap (controlled by QB only!) and are
generally suitable for DMA.

Example:
REM $DYNAMIC
DIM DMABUJi'(20000) AS INTEGER
REM $STATIC

MODE = 1
PARAMS(0)  = VARPTR(DMABUF(0))
PARAMS(1)  = VARSEG(DMABUF(0))
PAFaMS(2)  = 20000
CALL BASDAS40(MODE,   VARPTR(PARAMS(O)),            FLAG)


Note that all $DYNAMIC data declarations must occur after all COMMON and DECLARE statements
in your program. If you get the QB error: "COMMON and DECLARE must proceed all executable
statements", then double check the order of all your DECLARE, COMMON and $DYNAMIC
declarations.

FAR Pointer Manipulation
QuickBASIC provides the built-in functions VARPTR and VARSEG for obtaining the Offset and
Segment of a given variable. If the variable is declared in the $STATIC area (by default), VARSEG
returns the default data segment. If the variable is declared as $DYNAMIC, then it is placed in the
FAR heap and VARSEG for such a variable returns a unique Segment value outside the default data
segment. Refer to the previous section for an example.




                                                                                                3- 11
PCF-40 USER GUIDE




                    cl




3- 12



◦ Jabse Service Manual Search 2024 ◦ Jabse PravopisonTap.bg ◦ Other service manual resources online : FixyaeServiceinfo