7.3.3 RPN command reference

The table below summarizes all commands and operations which are accepted by the device driver in RPN mode. The second column of the table describes how a command changes the stack. Left of the -- the objects the operation takes from the stack are listed. The TOS (top of stack) is the rightmost value. Right of the '--' the results the operation leaves on the stack are shown.

command stack usage description
variable-name -- v Pushes the contents of the variable onto the stack. The type of the variable is retained (CHOICE parameters are represented by string values).
numeric-constant -- v A numeric value (only decimal notation is allowed) is pushed as a floating point number onto the stack.
%numeric-constant -- v A numeric value (decimal) preceded by a % character is pushed as a long integer number onto the stack.
#hex-constant -- v A hexadecimal numeric value preceded by a # character is pushed as a long integer number onto the stack.
"text" -- v A text in double quotes is pushed onto the stack as a string constant.
! variable-name v -- The exclamation mark, followed by a variable name, tells the driver to take one value from the stack an store it into the variable. Type conversion and range check is done as defined at the VAR statement which created the variable.
^ variable-name v -- The caret, followed by a variable name works much like store operator described above. However, while the store (!) operator refers to the value the device driver read from the device, the caret operator loops the value to the driver as if an operator had commanded it.
< x y -- b Compares x and y numerically. The result is true if x < y .
= x y -- b Compares the string representation of x and y . The result is true if x = y . Be careful when comparing floating point values.
> x y -- b Compares x and y numerically. The result is true if x > y .
- x y -- z Subtracts two values. The result is x - y .
/ x y -- z Divides two values. The result is x / y . With y = 0 the result always is zero (although this is mathematically not correct).
* x y -- z Multiplies two values.
+ x y -- z Adds two values.
@ 's' -- z Replaces the name of a parameter by it's value. The parameter name must be a complete parameter ID, the value is that one displayed at the GUI, not the recently commanded one. If @ fails, the string 0 ist left on the stack.
binand x y -- z Performs a bitwise AND of two numeric operands.
binneg x -- z Binary negates the value on the stack.
binor x y -- z Performs a bitwise OR of two numeric operands.
binxor x y -- z Performs a bitwise XOR of two numeric operands.
bit n p -- b Isolates a bit value from a numeric value. Leaves a boolean flag on the stack which is true if the bit number p of the value n was set. Bit number 0 denotes the least significant bit in n .
clr ... v -- Clears the stack.
copy 's' 'd' -- Copies a single parameter or a complete device setup from one device to another. s, d are interpreted as source and destination of the operation, must both be either plain device names or fully qualified parameter IDs (e.g. MYDEVICE.grp.parName). When copying complete device setups, this is done via the device preset facility: a temporary / unnamed device preset is taken from the source device an applied to the destination device.
cut 's' n -- 's' Cuts the string s to the length of n characters. If n is greater than the length of the string to cut, the latter is leaved unchanged.
debug x -- Takes a numeric value from the stack. Turns on debugging output if non-zero. The debugging output can be watched on the debug console window of the MNC software.
do -- Starts a do ... while or a do ... until loop.
drop v -- Removes one value from the stack.
dup v -- v v Duplicates the value on top of the stack.
else -- Part of the if ... else ... endif construct.
endif -- Closes an if ... endif or an if ... else ... endif construct.
find 's' 'p' -- 's' Finds the pattern p in the string s. Removes the beginning if s including the first occurrence of the pattern p. The result starts with the character following the first occurrence of p in s. If p is not found in s, find leaves an empty string on the stack.
fmt n 'fmt' -- 's' Formats a numeric value according to format specification given in fmt. Leaves the formatted number as a string on the stack. The format specification follows the same rules the FMT option of the PRINT statement does.
func v 'fname' -- v Processes a numeric value through a tabular function using linear interpolation. First takes the name of the function to apply from the stack, then the value to process. The interpolated value id pushed back to the stack. Works much like the FUNCTION clause available in most I/O statements of the driver language. Chapter Function tables in I/O functions gives an extensive description about functions an how they are used.
hex 'x' -- n Interprets the top of the stack as the string representation of a hexadecimal number. Leaves the numeric value on the stack.
if n -- Start a if ... endif or a if ... else ... endif clause. Takes one value from the stack. If this value is non-zero, the commands between if and else are executed.
inp -- 's' Reads one message from the device and places the data as a string on the stack. The protocol frame is removed.
log10 x -- z This is the inverse function to pow10. It takes the common logarithm of the value on the TOS. To use this function to convert a mW expressed power to dBm follow this example: mwval log10 10 * converts the contents of mwval from mW to dBm.
not v -- v Negates the top of stack. Works with boolean values, numeric values (non-zero is turned into 0, 0 is turned into 1), and common string codings of boolean states.
over a b -- a b a Copies the value located one below the TOS on top of the stack.
pow x y -- z Raises x to the power of y. May be used to compute the square of a number (3 2 pow leaves 9 on the stack). Floating point numbers are allowed for both operands, hence you may compute a square root like this: myvar 0.5 pow leaves the square root of the contents of myvar on the stack.
pow10 x -- z Raises 10 to the power of x. This mainly is intended to convert RF power values expressed in dBm to mW. Example: dbmval 10 / pow10 converts the contents of dbmval from dBm to mW, leaves the latter value on the stack.
prt 's' -- Takes a value from the stack and sends its string representation to the device after adding the protocol frame.
rot a b c -- b a c Rotates three values on top of the stack.
table rxlt 's' -- 's' Translates a string value through the given translation table. Translates from right to left. Uses the table with the name defined somewhere before the rxlt command. The table is not pushed to the stack, so the exact position of the table name does not matter.
send 'v' 'd' -- Sends a message to another device, setting a parameter at this device. d is interpreted as the full parameter ID of the message destination (e.g. MYDEVICE.grp.parName), v is the value to be set there.
shl 'x' 'y' -- 'z' Shifts x left by y positions. treats all values as long integers.
shr 'x' 'y' -- 'z' Shifts x right by y positions. treats all values as long integers.
strcat 's' 's' -- 's' Concats two string values.
substr 's' n -- 's' Removes n character from the beginning of a string value.
swap a b -- b a Swaps two values on top of the stack.
trm 's' 'p' -- 's' Cuts the string s at that point where the pattern p is found in the string. Leaves the string s unchanged if p does not exist in s
until n -- Closes a do ... until loop. Takes one value from the stack, loops again if this is zero.
while -- Closes a do ... while loop. Takes one value from the stack, loops again if this is non-zero.
table xlt 's' -- 's' Translates a string value through the given translation table. Translates from left to right. Uses the table with the name defined somewhere before the xlt command. The table is not pushed to the stack, so the exact position of the table name does not matter.