PHOTO 3. The RN-171-XV is very easy to configure and
contains its own TCP/IP stack. Once the TCP connection is
established, data flows over the Wi-Fi connection via the
RN-171-XV's serial port.
The bit_set and bit_clear macro statements are coded
in CCS C compiler syntax. The LATx definitions are foreign
to the CCS compiler unless you inform it where to find the
LATx registers:
#byte
#byte
#byte
#byte
#byte
LATE = 0x0F8D
LATD = 0x0F8C
LATC = 0x0F8B
LATB = 0x0F8A
LATA = 0x0F89
PHOTO 4. This is a
fly-over view of the
Atlanta H-bridge
controller. The
H-bridge controller
also features a pair
of optically isolated
inputs, two
optional DPDT
relays, microSD
storage, and an
auxiliary device
area.
54 SERVO 06.2013
What you don’t see in Photo 2 are the screw terminals that
take the Si9986 H-bridge’s output pin states to the loads.
We now have the power to switch external device power,
drive motors, open and close valves, and actuate solenoids
with minimal code and minimal hardware. For instance, to
drive OUTPUTA of H-bridge 1, we would simply code:
hb1outa;
I’m in Florida ... the H-bridge is in Georgia
No worries. We can flip that H-bridge in Atlanta from
Key West if we have to. All we need to do is add some
additional hardware capability to our initial design. Even
with the additional parts, the base design we started with
in Schematic 1 will not radically change.
In the good old days, reaching out to the H-bridge in
Atlanta would have entailed the installation of a modem at
both ends of the communications link. Most likely, the
modems would be dial-up types since leased telephone lines
were expensive and the H-bridge would probably not need
immediate around-the-clock service. Today, if there is a
civilized human being nearby, you will most likely find an
Internet portal. So, all we need to do is add some hardware
that can give the PIC18F46J13s at each end access to the
Internet. Once that’s done, we can choose to communicate
elegantly with a custom application or use free readily
available communications resources.
The hardware design you see in Schematic 3 wasn’t
pulled out of the air. It is a solid design that has worked for
me many times in the past. The first order of business is to
get the RN-171-XV Wi-Fi radio on the Florida LAN. The Key
West RN-171-XV needs to be configured with the following:
• Gateway address
• IP address
• Local port number
• Channel
• Authorization type
• Authorization key or pass phrase
• LAN SSID
The Key West IP and WLAN setups are shown in
Screenshot 2. DHCP is disabled to allow for a stable local
IP address that can always be matched to the local port
address of 9000. The gateway address is the local IP
address of the router or access point that interfaces the
LAN to the Internet. I turn on both TCP and UDP so as not
to miss anything that may use UDP as a communications
datagram carrier.
In that the Key West router/access point requires WPA2
authorization, we must configure the Key West RN-171-XV
with a pass phrase. The Key West SSID value is important,
as well. The Join = 1 instructs the Key West RN-171-XV to
only join a LAN whose SSID is keywest. The Key West LAN
will always operate on channel 11, and that is reflected in
the Key West RN-171-XV setup. Both ends of the link
need to belong to their respective resident LAN. So,
what was done for the Key West RN-171-XV must also