User manual

Sample Applicaon Wireless UART
The following scenario is very common: two devices communicang over an RS-232 serial link.
The two devices might be two computers, or perhaps a computer and a slave peripheral. For the remainder of
this secon, we will refer to these devices as “end points.
In some cases, a direct physical connecon between the two end points is either inconvenient (long distance) or
even impossible (mobile end points).
You can use two SNAP nodes to wirelessly emulate the original hardwired connecon. One SNAP node gets
paired with each end point. Each SNAP node communicates with its local end point using an RS-232 port (such as
the ones on the Synapse demonstraon boards), and communicates wirelessly with the SNAP node connected
to other end point.
RS-232 802.15.4 Wireless RS-232
To summarize the requirements of this applicaon:
We want to go from RS-232 to wireless, and back to RS-232
We want to implement a point-to-point bidireconal link
We don’t want to make any changes to the original endpoints (other than cabling)
This is clearly a good fit for the Transparent Mode feature of SNAPpy, but there are sll choices to be made
around “how will the nodes know who to talk to?”
Option 1 Two Scripts, Hardcoded Addressing
A script named dataMode.py is included in the set of example scripts that ships with Portal. Because it is one of
the demo scripts, it is write-protected. Using Portal’s “Save As” feature, create two copies of this script (for
example, dataModeA.py and dataModeB.py). You can then edit each script to specify the other node’s address,
before you upload both scripts into their respecve nodes.
The full text of dataMode.py is shown here. Noce this script is only 19 lines long, and 8 of those lines are
comments (and 3 are just whitespace).
"""
RS-232 serial data cable
24 SNAP® Network Operang System