Last Updated: 28-Jan-03
You can know if switch is open or closed by simply calling InPort()
function of ActiveWire API.
In above Pull Down wiring, the InPort() function reads
binary 0 when the switch is open, 1 when it is closed.
In above Pull Up wiring, the InPort() function reads
binary 1 when the switch is open, 0 when it is closed.
Please note that load has to be connected at Drain side and Source has
to be grounded because of required Vgs to turn on the MOSFET.
In this example, the relay is On when output pin is logical High, the
relay is Off when the pin is logical Low.
2N7000 used in this example can drive up to 60V 200mA continuous, or
500mA pulsed.
NEC's
optoisolator PS2501 used in this example can drive up to 60V 50mA.
Please refer to the source code of sample application for example of
statically load DLL. (available for download as AwusbIOSrc.exe,
click
here to download now.)
To statically load DLL, you need to link your application with awusb.lib
file, which is included in lib\ directory of the sample
application source code. From the menu bar,
choose Project, Settings, then click on Link
tab. Type in "..\lib\awusb.lib" in the
window right below Object/library modules.
In your C++ source code, include AwusbApi.h file, call LoadLibrary()
function with the name of DLL. The name of ActiveWire USB API
DLL, awusb.lib, is defined as a macro, AWUSB_DLL_NAME,
in the header file.
ex) #include "AwusbApi.h"
.....
// Load DLL library
LoadLibrary (AWUSB_DLL_NAME);
.....
Then, you are free to call any of the DLL functions anywhere in your
C++ code.
Please note that you have to at least re-link your application with awusb.lib
when awusb.dll has been updated. awusb.lib
and awusb.dll will be always updated together.
To avoid re-linking with awusb.lib, you can choose to
dynamically load DLL, calling GetProcAddress()
function. Please refer to Microsoft Visual C++ Reference
Manual for more detail.
Please refer to the sample Visual Basic projects. (available for
download as VBSampleDLL.exe or VBSampleOCX.exe, click
here to download now.)
Because the calling convention of functions in C/C++ and Basic is
different, there is a separate DLL specifically for Visual Basic
users. It has been named as awusbvb.dll
as opposed to the one for MCVC++. It provides the
exactly same functionality.
Instead of using DLL, using OCX may provide more convenient
and versatile interface to ActiveWire products in Visual Basic
application. OCX, or often called ActiveX Control, is
another form of library module in Microsoft Windows
environment. OCX provides common interface to most
of popular programming language, such as Visual Basic and C++,
and scripting language recently introduced, such as
JavaScript. As same effort as writing an application in
Visual Basic, you can write HTML file that can be browsed by
Internet browser and still you can use functionality of ActiveWire
products using JavaScript and OCX.
This idea of using Internet browser as a programming platform saves
your time and effort of trial and error in application development.
If you like the idea, please use OCX as ActiveWire interface!!
If your ActiveWire USB board does not work well on your system for
any reason, please contact our technical support, tech_support@ActiveWireInc.com.
Please give us information of your USB host controller when
contacting us.
You can see what kind of USB host controller you have in the system
by looking at Control Panel, System, Device
Manager, Universal serial bus controller section.
Created on May 14th, 1999.
Revised on Jun.22nd, 1999.
Broken link fixed.
Corrected figure in section 1-2. MOSFET output. Aug.23rd, 1999
Added information about Windows 2000 support.
Added information of new sample programs Oct.20th, 1999
Revised information about Windows 2000 support. Feb.24th, 2000