WiSnap User Manual 4.41 05282015-ML
Page 30
The UDP auto-sleep timer is set using two variables. The timer interval is a product of the autosleep value and the comm flush
timer (in milliseconds). The timer is decremented every “product” milliseconds.
For example, if you need a UDP sleep timer of 40 milliseconds, you need to set the following variables:
set sys autosleep 4
-
sets the autosleep value to 4
set comm timer 10
-
sets the comm timer to 10 ms (default value)
The resulting UDP sleep timer will be 4*10 ms = 40 ms. You can also use a combination of autosleep =
2 and comm timer = 20 ms to achieve the same effect.
Using a minimum value of 2 (when the default flushtime=10 ms) is recommended to ensure that the
UDP packet gets transmitted. For larger packets the value should be increased.
10.1.2 TCP Connection Timers
Opening a TCP Connection
In TCP-Client mode, the auto-conn timer controls the establishment of a socket connection. When set, the device automatically
and periodically attempts to establish a connection each time the timer expires.
set sys autoconn
<secs>
-
causes the module to periodically connect to the host. The timer
<secs>
determines how often to
connect to the stored remote host. If set to 1, the module will only make one attempt to auto connect upon power up. If set to
2 or greater auto connect will re-open the connection after the connection is closed. Default=0 disables.
For auto connect timer to work, the remote host’s IP address and port number needs to be configured in the WiSnap module.
Closing the TCP connection
In TCP-Client AND TCP-Server mode (default mode), there is also a disconnect timer. This timer can be used to automatically
close a TCP connection after a specified number of seconds with no transmit or receive data.
set comm idle <secs>
For example, to close the TCP connection after 5 seconds of inactivity, use the
set comm idle 5
command.
The default value of the comm idle timer is 0, never disconnect on idle.
10.2 Wake on Sensor Input
SENSE 0 to 3 inputs are available to wake the module from sleep. SENSE 0 to 3 pins have a small current source that is
activated in sleep mode. This source is approximately 100nA, and will cause the input to float up to about 1.2VDC. If SENSE1,
for example, is enabled, pulling the SENSE1 pin to GROUND will wake the device.
To enable these inputs to wake the module, use the command
set sys trigger <value>.
The value is a bit-mapped setting. To
wake on sensor pin 2, use
set sys trig 4
, for example. Setting the value to 0 disables all sensors pins.
The table below describes the values to wake the module using individual sensor inputs.
Sensor Input Values
Wake on Sensor Input
Value
Command
0
1
set sys trigger 1