Signametrics
24
/***********************************************************************
* Exmp2040.C Exmp2040.EXE
*
* A simple Windows .EXE example for demonstrating the SM2060,64
* DMM’s using "C"
* Sets Function to VDC, Range to 24V, Rate set to 6rps.
* Display five measurements using a Message box.
***********************************************************************
* Make sure SM2060.lib is included in the libraries. For Microsoft
* Version 4.0 C++ and above, place under 'Source Files' in the
* Workspace, along side with Exmp2060.c
* PROJECT SETTINGS:
*
* /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"
* /FR"Release/" /Fp"Release/Exmp2060.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
*
* Copy both SM2060.DLL and SM2060.LIB to the project directory.
*
***********************************************************************/
// #define WINAPI __stdcall
#include <windows.h>
#include <string.h>
#ifdef _Windows
#define _WINDOWS
#endif
#include "SMX2060.h"
// functions declarations and error codes.
#include "DMMUser.h"
// All functions, range and rate info and function declarations.
int main(void){
int I, nDmm = 0;
// Address first DMM in the system
char
Read[16];
char
strMsg[256];
i = DMMInit(nDmm,"C:\\SM60CAL.dat");
// initialize SM2055, and read calibration file
if(i<0)
MessageBox(0,"Initialization ERROR !", "Startup SM2060 DLL",MB_OK);
// Error
DMMSetFunction(nDmm,VDC);
// Set to DCV function
DMMSetRange(nDmm,_24V);
// and to 33V range
DMMSetRate(nDmm,
RATE_6R50);
// meas. Rate = 6
strcpy(strMsg,"");
//
Clear
string
store
for(i=1; i<= 5; i++){ // take 5 readings
DMMReadStr(nDmm,
Read);
//
read
strcat(strMsg,Read);
// Append each reading
strcat(strMsg,"
");
//
insert space between readings
}
MessageBox(0,strMsg, "SM2060.DLL Read Resistance & VDC",MB_OK);
// Show readings
return
0L;
}
5.3 Visual Basic Front Panel Application
The Visual Basic front panel application,
SM2064.EXE,
is an interactive control panel for the SM2060 family of
DMMs. When it loads it will take a few seconds to initialize and self calibrate the hardware before the front panel is
displayed.
The push buttons labeled
V,
I
, etc. control the DMM function. As you push a function, the front panel application
will switch the DMM to the selected range and function. Autorange mode is selected by pushing the
AutoRange
check box. The
S-Cal
box recalibrates the DMM, leaving the DMM in the same state prior to operation. (This is an