• Character getU2 ( ) — Waits for a new character
to arrive to the serial port and then returns it.
Testing the Data Logger
■ FIGURE 9.
You must do a #include “CONU2.H” in MAIN and
also include the CONU2.C driver source code in your
project to use the serial port. The serial port can support a
PC serial port or USB with the proper physical interfaces.
Acroname ( www.acroname.com) provides ideal physical
interfaces at a reasonable price.
Only four connections are required to work with the
Experimenter. They are pin 9 and 8 of the I/O expansion
bus, and + 3.3V and GND, as well. If USB is required,
some software INF files and USB drivers will need to be
installed on your PC. (Acroname provides all the code and
instructions with their product.) The CONU2 library
functions used in the data logger are:
• initU2( ) — Initializes the serial port using UART2 of the
PIC24F for pins 8 and 9 of the Experimenter expansion
bus for 9600 BAUD, eight-bit data, no parity, and one
stop bit (or 96008N1 for short).
• putU2( character) — Writes a character out to the serial port.
• putsU2( string) — Writes an entire string out to the serial port.
Assemble the hardware using the connection
diagram supplied in Figure 8. The Acroname
interfaces and PC are not required at the start). I
Now, connect the Experimenter to your PC using one
of the designated interfaces (USB or serial). Bring up the
Hyper Terminal application. Configure HyperTerminal for
96008N1 and no hardware handshake. Start the data
logger again and you should see a banner announcement
on Hyper Terminal indicating that the Experimenter is
communicating. All logging activities will be displayed as
automatic updates on the Hyper Terminal Window. Once
you finish logging, the data logger will “dump” all its
stored record data — on your command — to
Hyper Terminal using the 16 byte record ASCII format. The
data logger retains its records until the next logging
session which allows you to execute a number of record
“dumps” if necessary. Here’s where the magic begins.
You can do analysis and plotting of this dumped
record data using PC software (like Excel). To help you
along, Figure 10 shows a screenshot and the procedures
to transfer a data record dump to a text file through
Hyper Terminal and import it to Excel for plotting.
Ideas for Future Expansion
We now have completed our first real application
for the Experimenter. It has some very practical
capabilities, so put it to good use. I’m sure there are lots
of ideas out there that can work with it. Stay tuned!
More exciting applications are coming! NV
32 June 2010
■ FIGURE 10. Using
Excel to plot data.
A complete kit to go with this series of articles can
be purchased online from the Nuts & Volts
Webstore at www.nutsvolts.com or call our
order desk at 800-783-4624.