simple as it gets. As you can see in Schematic 1, our
mouthpiece hardware design consists of a PIC, two
resistors, three capacitors, a couple of connectors, and an
LED for fun. To facilitate easy communications to a
terminal emulator that will be running on my Lenovo
laptop, J2 is wired to directly interface a Digilent
PmodUSBUART module. The PmodUSBUART is shown in
Photo 2.
The heart and soul of our mouthpiece design — a 28-
pin PIC18F27J13 — is shown with the PmodUSBUART
mounted in the J2 screw terminal in Photo 3. Once we’ve
verified that our firmware is working as designed, we can
replace the PmodUSBUART module with a connection to
the Moray’s serial interface.
Note the crossed Rx and Tx signals between the
PmodUSBUART module and the PIC’s serial interface. We
must also connect to the Moray’s serial interface in this
manner. A serial port is always good to have in any case
as it can act as a debug device.
In this design, we’ve added what I call an “activity”
LED that can be used for general-purpose debugging or as
an “I’m alive!” indicator. The PICkit3 has proven to be a
reliable and popular programmer/debugger device. J1 is
wired to allow a PICkit3 to be directly plugged into the
design for programming and debugging.
The PIC18F27J13 is a very capable microcontroller.
However, the objective here is to not have to utilize any of
the PIC’s native resources. The Moray can sense analog
voltages for us. It can also perform general-purpose I/O
functions via commands issued by the PIC. The Moray’s
PWM engine allows us to utilize it in applications such as
light dimming or digital-to-analog voltage generation. In
essence, we are holding the PIC’s resources in reserve.
Any task that the Moray cannot perform can be
performed by compute and I/O resources native to the
PIC.
For instance, the Moray does not support SPI master
mode. So, we would call upon the PIC18F27J13 to step
ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
March 2015 73
■ Schematic 1. Absolutely no rocket
science is applied here as far as we
are concerned. All of the technology
is packed into the goo that connects
to the PIC's 28-pin frame.
■ Photo 2. Those of you that have previously visited the
Design Cycle space will recognize this little device as a
workhorse I use very often to add instant USB connectivity
to embedded projects.
■ Photo 3. The screw
terminal at J2 allows
us to easily move
between the
PmodUSBUART
module and the
Moray's serial
interface.