How
can you construct a digiScope, digital analyzer?
That
was the question we asked ourselves when we wanted to start this project.
We
based the project on analog electronics and used the mega32 chip as a
processor.
In
this rapport we will explain how we constructed and used our combined knowledge
of electronics to program and produce a working two-channel digiScope
that will display all its information on a computer screen. The user will be
able to connect two outside signals to the digiScope
and use the computer as an interface. The user will also be able to sample and
trigger the signal.
How
can one construct a simple but reliable and portable digital analyzer?
By
using the mega32 processor chip and several other simple but key components one
can do just that. Connect the signal you want to measure to a board where the
mega32 chip is installed and does all the computations, such as sampling and
trigging. Then display any given signal through a desired computer. The
connection between the computer and the board is through a serial port (RS232).
Our
digiScope has two channel inputs that allow you to
measure any digital signals.
The
mega32 processor is simple enough and has enough memory so that the user can
use the board to sample signals and trigger them.
The
sample rate will be max 128 bits, and the trigger fallows that. It is enough to
get accurate information of most signals.
Our
digiscope involves two separate software
components. A Java application to set parameters for sampling and two
display the captured signals, and the C on the Mega32. Focusing on the C
component, our design is highly interrupt driven. The USART on the Mega32
is used to communicate with the Java application. The interrupt signaling
“data received” is used to process data to the chip from the application.
If a “start” command is received, then the C program begins looking for an edge
within the data. On a “stop” command, processing of the signals is
halted.
If
started, once an edge has been found then the internal timer output compare
interrupts are used to signal sampling. The last 8 samples are help in a
register and compared to the trigger. With each sample taken, the current
register is stored in an array of the previous 256 values of that
register. If the Trigger is found, then data is either sent out, or
another 248 samples are collected, depending upon the set location of the
trigger (beginning of the sample, or at the end). A rudimentary bit-sync
is used to ensure sampling takes place during time when the data is valid (not
near an edge).
The
format of data transferred both to and from the Mega32 is standardized, so that
the meaning of a received byte can be determined even if one series of bytes is
interrupted by another.
If
a “start” command is sent while neither of the two signals is enabled, an error
message is sent back to the java application, and sampling does not begin.