2016 Microchip Technology Inc. DS50002466A-page 51
Variable range can also be defined by two conditions: with AND or OR logic operations.
In the following script lines, $VAR1 is defined to be valid in the range between 0x0050
and 0x0120; while $VAR2 is defined to be either larger than 0x0100 or less than
0x0020.
In the first two lines of the script, ranges of variables are defined. The following two
script lines read values of analog channel 1 and 2, respectively and assign the values
to the two variables. If the reading of the analog channel 1 is between value 0x0050
and 0x0120, the value is assigned to the server characteristic handle 0x0019; other-
wise, no value is assigned to the handle.
Similarly, if the reading of the analog channel 2 is larger than 0x0100 or less than
0x0020, the value is assigned to the server characteristic handle 0x0021; otherwise,
no value is assigned to the handle.
Currently, only single character logic operator > or < are supported.
3.1.5
Handle Association
In the same manner, an I/O port can be associated with a handle of server character-
istic. Once the handle receives requests from the peer device to read or write, the I/O
port is read or written, respectively, without further instruction. The associated handle
can be identified by proceeding identifier %.
For instance, the following script line associates server characteristic handle 0x0021
with read operation of the analog channel 2, thus, whenever the peer device reads han-
dle 0x0021, analog channel 2 is read and the value returns to the peer device.
The following script associates server characteristic handle 0x0023 with write operation
of PIO22, thus, whenever the peer device writes to handle 0x0023, the written value
from the peer device is used to set the output voltage on PIO22.
3.1.6
Remote Function Call
3.1.6.1 FUNCTION DEFINITIONS
RN4870/71 supports three custom functions. These functions are defined as ?FUNC1,
?FUNC2 and ?FUNC3. Each function can be associated with write operation of a char-
acteristic handle using the following syntax:
As an example, the following line in a script associates write operation of the handle
0x0018 to the function ?FUNC2:
$VAR1 > "0050" && $VAR1 < "0120"
$VAR2 > "0100" || $VAR2 < "0020"
$VAR1 = @,1
$VAR2 = @,2
SHW,0019,$VAR1
SHW,0021,$VAR2
%0021 = @,2
|O,01,%0023
%handle = ?FUNCx
%0018 = ?FUNC2