output_toggle(GREEN_LED);
delay_ms(500);
}
}
■ Photo 5. This
hardware configuration
allows us to use
the XBee radio
link as a
The “wireless” USB-to-UART hardware configuration
I had in mind is under the lens in Photo 5. I declared the
prototyping stick’s temporary independence from the
laptop USB portal by soldering a four-pin 0.1 inch pitch
male header to a USB 2.0 Type A female connector. As
you can see in Photo 5, the female USB connector’s outer
pins carry the + 5.0 VDC power rail which is provided by
the host USB portal. Our RS-232 verification code is self-explanatory. We are simply sending a message and
USB-to-UART
converter.
UART setup is performed in the RapidUSB.h code and the
#use RS232 pre-processor statement. Note that in
structure, our enhanced RS-232 code does not differ
greatly from our LED blinker code. Before the stick
assumes its duty in Photo 5, the RS-232/LED blinker code
is compiled and loaded into the stick in the normal
fashion via the IDE and host laptop’s USB portal.
A pair of XBee data radios stands in place of a hard-wired USB-to-UART module and its associated USB cable.
XBee radios will be coaxed into a remote control mode.
The XBee radio interface operates with 3. 3 volt logic
levels. As you can see in Photo 5, the prototyping stick
and its attached XBee radio are powered by a + 3.0 volt
battery supply via the modified female Type A USB
connector. This is just fine since the PIC16F1459 can
operate at supply voltages between 1.8 and 5. 5 volts. The
Let’s begin by giving the stick’s pushbutton a human name:
#include <RapidUSB.h>
#define RED_LED PIN_C6
#define GREEN_LED PIN_A5
#define PBTN PIN_C1
+ 3.0 volt battery power also suits the XBee radio module
as its recommended minimum operating voltage is
3.0 volts. At this point, a common and safe logic level of
3.0 volts is being used by the stick’s UART and the
attached XBee radio module.
The XBee radio mounted on the USB carrier is under
control of a host USB portal on my laptop. Both the
The PBTN moniker will be used when the state of the
pushbutton needs to be checked. The primary function of
the pushbutton is to trigger an external interrupt which
kicks off secondary processes. We will leave our
prototyping stick UART setup code intact. However, we
will need some additional variables to signal the interrupt
trigger, hold our messages, and drive a mini state machine:
XBee radio that is attached to the RS-232 port of the
prototyping stick and the XBee radio on the USB carrier
board are programmed with out-of-the-box default
settings. The default baud rate of the XBee radios is
reflected in our verification code’s #use RS232
pre-processor statement.
The photographic flash units overpower the stick’s
LEDs which are blinking away in Photo 5. The stick’s
UART output data stream captured in Screenshot 2 is
presented by the CCS C compiler serial input/output
monitor application, which is running in support of the
XBee module that is plugged into my laptop’s USB portal.
Sorry for the Interruption
I’m dying to write some code aimed at that
pushbutton! We will use the same wireless hardware
configuration as seen in Photo 5. By the time we’re done,
the prototyping stick that we used to blink LEDs and drive
■ Screenshot 2. Powering the Rapid USB prototyping stick
with a 3.0 volt battery pack allows us to interface the
stick's UART to an XBee data radio module.
November 2014 55