HELP
 

For a list of basic AT Commands, go to Wikipedia/Hayes Command Set
For A complete list of AT Commands for the Sierra Wireless modems (fw 7.52) go to Sierra Wireless

Macro Commands

Command Syntax Description
$SET $SET @variable=value This command assigns the value to the variable.  This variable can then be used later in the script in any line.  Be careful of creating variables which may occur accidentally in commands, such as variables whose names are substrings of others (e.g. @number and @num or @file1 and @file13).  Unexpected results may occur.  It’s recommended to use a long name, such as @filename or @baudrate, rather than @f or @b.  It is possible to assign variables to equal other variables also.
Examples:-
$SET @baudrate=115200
AT+IPR=@baudrate

$SET @backuprate=@baudrate
  $SET BAUD=rate This command sets the baud rate of the connection to the new rate.  It will automatically close and re-open the port, once the rate has been changed.  This does NOT issue an instruction to the remote device to change baud rate, it affects only the local status.
Examples:-
$SET BAUD=115200
$SET BAUD=AUTO
$SET BAUD=@baudrate

The baud rate must either be a valid integer, or "AUTO" to let the program auto-detect the baud rate. It does this by sending "AT" commands and seeking an "OK".  AUTO will not work with a device which does not respond "OK" to an AT command.
$WAIT $WAIT time Instructs the app  to pause for a particular number of milliseconds
Example:
$WAIT 20000
  $WAIT OK [time] Instructs the app to wait for an OK response.  Anything else will throw an error.  An optional time will set the time for how long the app will wait for the OK response. The default timeout is 10 seconds.
Example:-
$WAIT OK 20000
$WAIT NAK [time] Instructs the app to wait for a NAK character (21) to be sent .  It will wait by default for 10 seconds, unless a timeout is provided also.
Example:-
$WAIT NACK 20000 The timeout is optional.  If omitted, the script will wait indefinitely.

  $WAIT RESPONSE [time] Instructs the app to wait for any response.  As soon as any data is returned from the modem, irrespective of contents, it will continue.
Example of timeout:-
$WAIT RESPONSE 20000
The timeout is optional.  If omitted, the script will wait indefinitely.
  $WAIT OK|NACK|RESPONSE|ERROR [time] Instructs the app to wait for any of the options you specify coming back.  List as many of the options as you wish.
Example of timeout:-
$WAIT OK|ERROR 20000 The timeout is optional.  If omitted, the script will wait indefinitely.
$SEND $SEND file Instructs the app to load the contents of a particular file and send it using the XMODEM-1K protocol.
Example:-
$SEND c:\firmware\NewFW.img
$PROMPT $PROMPT @variable Prompts the user to set the value for that particular variable.  The prompt box which appears also allows the user to select a filename, if they wish to. example of use:-
$PROMPT @baudrate
AT+IPR=@baudrate
$PROMPT @firmware-file
$SEND @firmware-file
:label :labelname Sets a specifically labelled point in the script.  This can be used as the target for jump commands.

Example of use as a generic error target:-

:printerror
$PRINT There was an error
$HALT
$JMP $JMP labelname Changes the flow of execution of a script to a named label unconditionally.

Example:-

JMP print
$PRINT This is never printed

:print
$PRINT This is printed
$JMPONSUCCESS $JMPONSUCCESS labelname Instructs the program to jump to a label if the next command completes with success.

Example:

AT
$JMPONSUCCESS worked
$WAIT OK 10000
$PRINT That failed
$HALT

:worked
$PRINT Well, that worked.  On with the program...


$JMPONERROR $JMPONERROR labelname Instructs the program to jump to a label if the next command completes with failure.

Example:

AT
$JMPONERROR boo
$WAIT OK 10000
$PRINT That worked! We're done
$HALT
 
:boo
$PRINT Well, that failed.  Try something else.
$JEQ $JEQ @variable value labelname Tests that the variable is equal to the value. If it is, the program will jump to the nammed label. If not, execution will continue

$SET @a=1
$JEQ @a 1 one
$HALT not one
:one
$HALT is one


The above would print "is one", unless @a is set to something other than one.
$JNE $JNE @variable value labelname Tests that the variable is not equal to the value. If it's different, the program will jump to the nammed label. If the two are the same, execution will continue

$SET @a=1
$JNE @a 1 notone
$HALT is one
:notone
$HALT not one


The above would print "not one", unless @a is set to one.
$MATCH $MATCH [regular expression] Matches a pattern of characters.  Follows the Microsoft regular expression language.  Will match multiple items.  For example, the AT+CREG command may return 0,0.  Matching on (\d) will return two result variables @1 and @2, which can be used.  Alternatively, one can match on (\d+),(\d+) will similarly return two variables, @1 and @2

AT+CREG?
$MATCH (\d+),(\d+)
$JEQ @1 0  notregistered
$HALT Registered
:notregistered
$HALT Not Registered



More information on regexps can be obtained here

$HALT $HALT [message] Instructs the program to halt execution immediately.   An optional message can be passed which changes the default output "Script Halted Execution" to the message.

Example:

$HALT  Complete with success
$DEC $DEC @a Decrements a variable by 1.  Will fail if the variable does not exist, or if the value is not parsable (e.g. "TEST").
Example:

$DEC @variable
$JEZ $JEZ @a jumptarget Conditionally jumps the execution to a named label, if the value in the variable is zero.  Will fail if the variable or label do not exist.  The value of the variable can be anything, however execution will only migrate to the jumptarget if the value of the variable is "0", i.e. numerical Zero.

$SET @variable=1
$DEC @variable
$JEZ @variable iszero
:isnotzero

$HALT The variable is not zero
:iszero
$HALT The variable is zero


The above script will print "The Variable is zero", demonstrating JEZ jumping to :iszero
#Comment #This is a comment Marks a line as a comment only.  Comments will not be printed.