2.1 ISA Initialization and Exit Function Calls

When using Universal Driver, you must always place three specific function calls in your program. Any application using the UD API should always start with calls to dscInit and dscInitBoard and end with calls to dscFree. These calls are important in initializing and freeing resources used by the driver. Here is an example of the framework for an application using the driver

using DSCUD_Library;
namespace DMM16RPAT 
{
   class DMM16RPATClass
   {
     static int Main(string[] args)
     {
            DSCCB dsccb = new DSCCB(); 
            DSCUD_Class DSCUD_class = new DSCUD_Library.DSCUD_Class();
            if ((result = (DSCUD_Library.DSCUD_Class.dscInit(DSCUD_class.DSC_VERSION) )) != DSCUD_class.DE_NONE)
            return result;
                        
            dsccb.base_address = 768; //0x300 
            dsccb.int_level = (byte)5;
            
            if ((result = (DSCUD_Library.DSCUD_Class.dscInitBoard(DSCUD_class.DSC_DMM16RPAT, ref dsccb, ref (DSCUD_class.dscb) )) != DSCUD_class.DE_NONE) 
            return result;
            
            /* Application code goes here */
            
            if ((result = (DSCUD_Library.DSCUD_Class.dscFree() )) != DSCUD_class.DE_NONE) return result;
                        return 0;                        
      }
    }
} 

In the above example, DSC_VERSION, DSC_DMM16RPAT, and DE_NONE are macros defined in the C# DSCUD Library. Calls to any UD API function are always of the form, dsc[...], where [...] is a specific function (i.e., ADSample as in dscADSample). Most function calls using the driver require the initialization of a UD-specific structure (i.e. DSCCB ) that is defined in C# DSCUD Library and described in the Data Type Reference. Each board must be initialized separately, and each board must also have its own unique base address and I/O address range that is different from all other boards in the system and does not overlap with any other board or system resource (such as COM port or parallel port).

Last updated