User manual

Here is the source code to SNAPpy script dataModeNV.py
"""
Example of using two SNAP wireless nodes to replace a RS-232 cable
After loading this script into a SNAP node, invoke the setOtherNode(address)
function (contained within this script) so that each node gets told "who his
counterpart node is." You only have to do this once (the value will be preserved
across power outages and reboots) but you DO have to tell BOTH nodes who their
counterparts are!
The otherNodeAddr value will be saved as NV Parameter 254, change this if needed.
Legal ID numbers for USER NV Params range from 128-254.
Node addresses are the last three bytes of the MAC Address
MAC Addresses can be read off of the SNAP Engine sticker
For example, a node with MAC Address 001C2C1E 86001B67 is address 001B67
In SNAPpy format this would be address "\x00\x1B\x67"
"""
from synapse.switchboard import *
OTHER_NODE_ADDR_ID = 254
@setHook(HOOK_STARTUP)
def startupEvent():
"""System startup code, invoked automatically (do not call this manually)"""
global otherNodeAddr
initUart(1, 9600) # <= put your desired baudrate here!
flowControl(1, False) # <= set flow control to True or False as needed
crossConnect(DS_UART1, DS_TRANSPARENT)
otherNodeAddr = loadNvParam(OTHER_NODE_ADDR_ID)
ucastSerial(otherNodeAddr)
def setOtherNode(address):
"""Call this at least once, and specify the OTHER node's address"""
global otherNodeAddr
otherNodeAddr = address
saveNvParam(OTHER_NODE_ADDR_ID, otherNodeAddr)
ucastSerial(otherNodeAddr)
This script shows how to use the saveNvParam() and loadNvParam() funcons to have units remember
important configuraon sengs. The script could be further enhanced to treat the baud rate and hardware
handshaking opons as User NV Parameters as well.
You can read more about NV Parameters in the SNAP Reference Manual.
26 SNAP® Network Operang System