Signametrics
28
Install the
SM4040.H
and
ScanUser.H
header files in a directory that will be searched by your C/C++ compiler for
header files. These header files are known to work with Microsoft Visual C++™.To compile using Borland, you
will need to convert the
SM4040.DEF
and
SM4040.LIB
using
ImpDef.exe
and
ImpLib.exe
, provided with the
compiler. Install
SM4040.LIB
in a directory that will be searched by the linker for import libraries. The SM2040
software must be installed prior to running any executable code. Install the
SM4040.DLL
in a location where either
your program will do a
LoadLibrary
call to load it, or on the
PATH
so that Windows will load the DLL
automatically. A common place for the DLL is at C:\WINDOWS\SYSTEM directory for Win98/95 or at
C:\WINNT\SYSTEM32 directory for NT and Windows 2000.
In using the SM4040 driver, first call
SCANInit
to initialize the scanner hardware and software. This function
should only be used once. Call
SCANSetConfig
to set the Scanner to a desired configuration, be it
TwoWire
,
FourWire
etc. The Scanner function constants are defined in the
ScanUser.H
header file, and have names that
clearly indicate the function they invoke.
Two functions are provided to set channel-relays,
SCANSelectChannel
and
SCANSetChannelRelay
. The first
opens all channels in a group, and closes the specified channel. The second function is usable while the scanner is in
the
Universal
configuration, and opens or closes a specified channel relay,.
Most functions accept a Scanner number parameter, which must be set to the
iScan
value when initializing the
scanner with the
SCANInit.
For multiple Scanners this
iScan
value will be 0,1,2..n. Most functions return an error
code that can be retrieved as a string using
SCANErrStr.
5.2.1 Multiple Card Operations under Windows
Single .EXE operation
Accessing multiple Scanners from a single executable is the most common way for running up to 10 Scanners using
the Windows DLL. A combination of several SM404X can be controlled, as long as the single .EXE (Thread) is
used to control all of the units. Make sure that prior to issuing commands to any Scanner, it is initialized using
SCANInit
. The
iScan
parameter is passed with each DLL command to define the unit to be accessed. Since this
configuration utilizes the DLL to service all units, it must handle one command at a time. For example, when one
Scanner’s channel is selected (with a non polled command the DLL must finish the operation prior to addressing
another Scanner. For improved performance, one can use the following:
Multiple .EXE operation
By having several copies of
SM4040.DLL
, and renaming them, you may multiple Scanners with separate
executables. For instance, having a copy named
SM4040A.DLL
and one named
SM4040B.DLL
in
C:\WINDOWS\SYSTEM (Win98/95), and having two executable files,
MultiExeA.exe
and
MultiExeB.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 above. If using VisualBasic, the
MultiExeA.exe
source code
should define
iScan
= 0, and
MultiExeB.exe
should define
iScan
= 1. In addition, the first EXE should declare the
SM4040A.DLL
and the second should declare
SM4040B.DLL
:
/***********************************************************************
* Exmp4040.C Exmp4040.EXE
*
* A simple Windows .EXE example for demonstrating the SM4040
* Scanners using "C"
* Sets Configuration to TwoWire, and select a channel.
*
***********************************************************************
* Make sure SM4040.lib is included in the libraries. For Microsoft
* Version 4.0 C++ and above, place under 'Source Files' in the
* Workspace, along side with Exmp4040.c
* PROJECT SETTINGS:
*
* /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"
* /FR"Release/" /Fp"Release/Exmp4040.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
Summary of Contents for SM4020
Page 61: ...Signametrics 60...