Multiple Card Operations Under Windows. Artison SMX2040, S-LCR-DM, SMX2042, SMX2044

Add to My manuals
127 Pages

advertisement

Multiple Card Operations Under Windows. Artison SMX2040, S-LCR-DM, SMX2042, SMX2044 | Manualzz

the DMM hardware. DMMInit accepts the name and location of the calibration file. A qualified technician may modify individual entries in the calibration file, then reload them using th e DMMLoadCalFile command.

5.2 Using the SMX2040 Driver Wit h C++ or Similar Software

Install the SM204032.H and UserDMM.H header file in a directory th at will be searched by your C/C++ compiler for header files. This header file is known t o work with Microso ft Visual C++™. To compile using Borland, you will need to convert the SM 204032.DEF an d SM204032.LIB using ImpDef.exe and ImpLib.exe, provided with the co mpiler.. Install SM204032.LIB in a directory that will be searched by the linker for import libraries. The

SMX2040 software must be installed prior to running any executable code. Install the SM204032.DLL in a location where either your program will do a LoadLibrary call to load it, or on the PATH so that W indows will load the

DLL au tomatically.

In using the SMX2040 driver, first call DMMInit to read the ca libration information. Call DMMSetFunction to set the DMM function. The DM M function constants are defined in the UserDMM.H header file, and have names that clearly indicate the fun ction t hey invoke. Use DMMSetRate to set the reading rate defined in the header file.

Two functions are provided to return DMM readings. DMMRead returns the next reading as a scaled doubleprecision (double) re sult, and DMMReadStr returns the next reading as a formatted string ready to be displayed.

M -numb er parameter, which must be set to the value nDmm, which w as returned by

DMMInit() fu nction. F or multiple DMMs this value will be 0,1,2..n. Most functions return an er ror code which can b e retrie ved as a string using DMM ErrStr().

Multiple Card Operations U nd er Windows

Single .EXE operation

A ccessin g multiple DMMs from a single e xe cutable is the most common w ay for running up to 10 DMMs using the

W indow s DLL. A combination of several SMX 2040s and SMX2044s can be cont rolled, as long as the single .EXE

( Thread) is used to control all of the units. Make sure that prior to issuin g comman ds to any DMM, it is initialized using DMMInit(). The nDmm parameter is passed with each DLL co m mand to define the DMM to be accessed.

Since this configuration utilizes the DLL to service all DMMs, it must handle a single reading or control command o ne at a tim e. For example, when one DMM reads DCV, and another reads Ca pacitan ce, the DLL must finish reading the DCV be fore it will proceed to take a Capacitance reading. Being a relatively slow measurement,

Capacitance will dictate the measurement throughput. For improved performance, one can use the following:

Multiple .EXE operation

By having several copies of SM204032.DLL, and renaming them, y ou can run multiple DMMs with separate e xecutables. For instance, having a copy named SM204032A.DLL i n C:\windows\system (Win98/95), and having two executable files, MultiExe0.exe and MultiExe1.exe, each of the executables will run independently, making calls to the respective DLL. This can provide an execution throughput advantage over the method mentioned abov e.

If using VisualBasic, the MultiExe.exe source code should define nDmm = 0, and MultiExe1.exe should define n Dmm = 1. In addition, the first should declare the SM204032.DLL and the second should declare

SM204432.DLL:

MultiExe0.exe VB function declarations:

Declare Function DMMInit Lib "sm204032.dll" (ByVal calFile As String) As Long

Declare Function DMMRead Lib "sm204032.dll" (ByVal nDmm As Long, dResult As Double) As Long

NDmm = 0

MultiExe1.exe VB function declarations:

Declare Function DMMInit Lib "sm20432A.dll" (ByVal calFile As String) As Long

Declare Function DMMRead Lib "sm20432A.dll" (ByVal nDmm As Long, dResult As Double) As Long

NDmm = 1

/* ************************* *********************************************

* Exmp2040.C Exmp2040.EXE

47 Signametrics

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

*

* A simple Windows .EXE example for demonstrating the SMX2040,44

* DMMs using "C"

* Sets Function to VDC, Range to 33V, rate to 10rps.

* Display five measurements using a Message box.

* **** ******************************************************************

* M ake sure SM204032.lib is included in the libraries. For Microsoft

* Version 4.0 C++ and above, place under 'Source Files' in the

* Workspace, along side with Exmp2040.c

* PROJECT SETTINGS:

*

* /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG " /D "_CONSOLE" /D "_MBCS"

* /FR"Release/" /Fp"Release/Exmp2 040.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c

*

* C opy both SM204 032.DLL and SM204032.LIB to the project directory.

*

**** *******************************************************************/

// #d efine WINAPI __stdcall

#inc lude <windows.h>

#inc lude <string.h>

#ifde f _Windows

#define _W INDOWS

#end if

#inc lude "sm204032.h"

#inc lude "UserDMM.h" int m ain(void){ int I, nDmm = 0;

Read[16];

// functions declarations and error codes.

// All functions, range and rate info and function declarations.

// Address first DMM in the system i = DMMInit(nDmm ,"C:\\sm40cal.dat"); if(i<0)

// initialize SMX2044, and read calibration file

MessageBox(0,"Initi alization ERROR !", "Startup SM204032 DLL",MB_OK);

DMMSetFunction(nDm

DMMSetRange(nDmm m,VDC); // Set to DCV function

,_30V); // and to 33V range

// Error

DMMSetRate(nDmm,RAT E_10); strcpy(strMsg,""); for(i=1; i<= 5; i++){

// 60 samples per sec

// take 5 readings

R ead); read strcat(strMsg," ");

}

// reading

// insert space between readings

MessageBox(0,strMsg, "SM204032.DLL Read Resistance & V DC",MB_OK); return

}

// Show readings

5.3

Visual Basic Fr l lication

The Visual Basic front panel application, SM2044.EXE, is an interactiv e control panel for the SMX2040 DMM.

Dur ing loading, which takes a few seconds, it initializes and self calibrates t he hardware before the front panel is displ ayed.

The push buttons l abeled V, I, etc. control the DMM function. As you push a function, the front panel application will sw itch the DMM to the selected ran ge an d function. Autorange mo de is selected by pushing the AutoRange chec k box. The S-Cal t the D MM, leaving the DMM in the sa me state prior to operation. (This is an inte er t from the external calibration, which uses external stan dards and writes to the

SM 40CAL.DAT file. S-Cal is used to co rrect fo r any internal offset a nd gain drifts du e to changes in operating temp erature). frequency and amplitude are shown at the same time. In this mode, the reading rate is slower than indicated. When

per is enabled, the period is shown. The SMX2044 panel has additional capabilitie s, which are disabled if an

SMX2040 is detected.

Signametrics 48

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

advertisement

Related manuals

advertisement

Table of contents