USBee AX Toolbuilder Source Code
The USBee AX Test Pod is customizable using the USBee AX Toolbuilder software source code libraries. You can write your own Visual Basic or Visual C++ code to control the USBee AX Pod to create your own control systems.
The USBee AX Test Pod System consists of the USBee AX Test
Pod connected to a Windows® Vista, XP or 2000 PC High Speed USB 2.0 port through
the USB cable, and to your circuit using the multicolored test leads and clips.
Once connected and installed, the USBee can then be controlled using either the
USBee AX Windows Software or your own USBee AX Toolbuilder software.
The USBee AX has headers that are the interface to your
circuits. The signals on these headers
represent an 8 bit data bus, a Read/Write#/TRG signal and a clock line. Using the libraries and source code provided
you can do byte-wide reads and writes to these signals. The USBee AX
acts as the master, driving the Read/Write#/TRG signals and Clock lines
to your circuit.
There are six modes of data transfers that you can use
depending on your system needs.
·
Voltmeter Mode
·
Mixed Signal Scope Capture
·
Digital Logic Analyzer Capture
·
Digital Signal Generator
·
Bi-Directional “bit-bang” mode
·
Uni-Directional High Speed mode
Voltmeter Mode
The simplest of the analog functions is the DVM (Digital
Voltmeter) routine. It simply measures
the voltage on a specified channel. This
measurement is taken over a quarter second an the average is returned.
The routine GetAnalogAverageCount() samples the specified
channel and returns the measurement.
Mixed Signal Scope Capture
The USBee AX has the ability to capture samples from the 8
digital signals and one of the two analog channels at the same time. Each analog sample is time synchronized with
the corresponding digital samples.
In mixed signal mode, there are two sample buffers, one for
the digital samples and one for the analog samples. Each buffer is 8 bits/sample. The Digital samples are represented by each
bit in the byte. So Digital Signal 0 is
bit 0 of each byte. The Analog sample is
the 8-bit ADC value taken during that sample period. The samples range from 0 (at -10.0V) to 255
(at +10.0V). Each count of the ADC
equates to 78.125mV, which is the lowest resolution possible on the USBee AX
without averaging.
The maximum sample rate that is possible in Mixed Signal
mode is 16Msps. This value can depend on
your PC system and available processing speed.
The method for performing a single data capture, or
sampling, using the Mixed Signal routines is as follows:
·
Allocate the sample buffers (MakeBuffer16() and
MakeBufferScope())
·
Start the capture running (StartCaptureMSO(…))
·
Monitor the capture in progress to determine if
it is triggered, filling, or completed. (CaptureStatus()).
·
End the capture when it is finished.
(StopCaptureMSO())
·
Process the sample data that is now contained in
the sample buffers.
The Mixed Signal functions are the only method of doing
oscilloscope traces with the USBee AX.
This means that if you need just an oscilloscope trace, then you will
get the digital samples at the same time.
Digital Logic Analyzer Capture
The USBee AX has the ability to capture samples from the 8
digital signals at up to 24Msps in Logic Analyzer mode. In this mode, each digital signal is represented
by each bit in the byte that is stored in the sample buffer. Therefore, digital Signal 0 is bit 0 of each
byte. The maximum sample rate can
depend on your PC system and available processing speed.
The method for performing a single data capture, or
sampling, using the Logic Analyzer routines is as follows:
·
Allocate the sample buffer (MakeBuffer())
·
Start the capture running (StartCapture(…))
·
Monitor the capture in progress to determine if
it is triggered, filling, or completed. (CaptureStatus()).
·
End the capture when it is finished.
(StopCapture())
·
Process the sample data that is now contained in
the sample buffer.
Digital Signal Generator
The USBee AX has the ability to generate (output) samples
from the 8 digital signals at up to 24Msps in Signal Generator mode. In this mode, each digital signal is
represented by each bit in the byte that is stored in the sample buffer. Therefore, digital Signal 0 is bit 0 of each
byte. These samples can then be
generated on command. The maximum sample
rate can depend on our PC system and available processing speed.
The method for generating a single output pattern using the
Signal Generator routines is as follows:
·
Allocate the sample buffer (MakeBuffer())
·
Fill the sample buffer with the pattern data you
want to generate.
·
Start the generation running (StartGenerate (…))
·
Monitor the generation in progress to determine
if it is triggered, filling, or completed. (GenerateStatus()).
·
Terminate the generation. (StopGenerate())
The USBee AX can not generate analog output voltages using
this mode. Variable analog outputs are
possible using the PWM Controller and an external RC circuit.
Bi-Directional and Uni-Directional Modes
These two modes allow bit-level data transfers to and from
the USBee AX pod. The first offers complete
flexibility of the 8 digital signal lines, while the other gives you very high
transfer rates.
In the Bi-Directional Mode, each of the 8 data signals can
be independently setup as inputs or outputs.
When sending data to the pod, only the lines that are specified as
outputs will be driven. When reading
data from the pod, all 8 signals lines will return the actual value on the
signal (whether it is an input or an output)
In the High-Speed Mode, all of the 8 data signal lines are
setup in the same direction (as inputs or outputs) at the same time. When sending data to the pod, all signals
become outputs. When reading data from
the pod, all signals become inputs.
Also in High Speed mode, you can specify the CLK rate. Available CLK rates are 24MHz, 12MHz, 6MHz,
3MHz, and 1MHz. For slower rates you can
use the bi-directional mode
In each of the modes you can specify the polarity of the
CLK line. You can set the CLK line to
change data on the falling edge and sample on the rising edge, or visa versa.
The routines used to read and write the data to the pod are
the same for both modes. You call the
SetMode function to specify the mode you want to use. All subsequent calls for data transfers will
then use that mode of transfer.
The following table shows the possible transfer rates for
the various modes. This assumes that
your USB 2.0 host controller can achieve these rates. USB 2.0 Host controllers can vary greatly.
|
Mode
|
Transfer Type
|
Burst Rate
|
Sustained
Average Rate
|
|
Bi-Directional
|
Data
Write (SetSignals)
|
300k Bytes/sec
|
~300k Bytes/sec
|
|
Bi-Directional
|
Data
Read (GetSignals)
|
175k Bytes/sec
|
~175k Bytes/sec
|
|
High-Speed
|
Data
Write (SetSignals)
|
24M Bytes/sec
|
~20M Bytes/sec
|
|
High-Speed
|
Data
Read (GetSignals)
|
16M Bytes/sec
|
~13M Bytes/sec
|
System Software Architecture
The USBee AX Pod is controlled through a set of Windows DLL
function calls. These function calls are
defined in following sections and provide initialization and data transfer
routines. This DLL can be called using a
variety of languages, including C and Visual Basic. We have included sample applications in C and
Visual BASIC that show how you can use the calls to setup and control the pod.
After installing the software on your computer, you can
then plug in the USBee AX pod.
Immediately after plugging in the pod, the operating system finds the
USBEEAX.INF file in the \Windows\INF directory.
This file specifies which driver to load for that device, which is the
USBEEAX.SYS file in the \Windows\System32\Driver directory. This driver then remains resident in memory
until you unplug the device.
Once you run your USBee Toolbuilder application, it will
call the functions in the USBEEAX.DLL file in the \Windows\System32
directory. This DLL will then make the
correct calls to the USBEEAX.SYS driver to perform the USB transfers that are
required by the pod.
|