Send SMS Triggered


Block name


ST call

It is better to use the sendsms block for ST programs.






The function sends a SMS at each transition of the control variable send from FALSE to TRUE. If there have to be sent more messages at a time, the block must be used multiple times or some sort of switcher for recepients has to be created. Every GSM gate has its queue limit, for example maximum four messages can be queued. It is highly recommended to send the messages with some pauses, for example a pause between two messages can be 10 seconds.  Messages that can not be handled by the queue are discarded in the GSM modem.


Input Type Description
CHANNEL STRING communication connection definition (set in PLC properties, see below)
RECIPIENT STRING recipient phone number
SEND BOOL command to send the SMS


Output Type Description
RESULT SINT Numeric status; result of the system settings check


Each rising edge on the send input sends a SMS from the predefined GSM modem to the recipient phone number. The SMS text is taken from the message variable.

The channel variable refers to the predefined communication channel. This has to be created in the PLC properties: doubleclick the PLC and select Message definition, then right-click the context menu and Add alarm channel.

Now, define the channel name which is the value of the channel variable. As next, the GSM connection type must be defined: click to select the channel and set the port to communicate to the modem in the channel properties. Set the channel communication properties. When using mark220 rev. 2.0 or mark320 rev. 2.0 set the software data flow control - RTS / CTS. If the SIM card is secured by a PIN, enter the PIN here. Finally, confirm all changes by clicking OK in the red dialogue.

If some of the predefined modem types is used, like Siemens TC-35 chipset, or Wavecom, it is possible to set in the AT command settings predefined commands to set up the modem. Then click the Apply button. The necessary AT commands are then added to the table. Click the Close button and confirm by clicking OK in the red dialogue. If another modem type is used, the AT command sequence has to be entered manually. (In case of unsupported modem types please contact the Domat Control System technical support.)

The output variable result indicates the result of the system settings check.

Status Meaning
0 OK
1 Unknown variable
2 Write failed
3 Size mismatch
4 Unspecified failure
5 Write denied
6 Invalid status
7 Image could not be read
8 Full e-mail box
9 Recipient address too long
10 Sender address too long
11 Subject too long
12 Message too long
13 Server name too long
14 User name in message definition too long
15 Password in message definition too long
16 Unknown channel
17 Unknown source coding
18 Unknown target coding
19 Conversion failed
20 Invalid conversion source
21 Congested conversion source
22 Congested conversion path
23 Connected
24 Error - status value can not be determined
25 Impossible to open port or init GSM modem (e.g. COM port number wrong) 
26 Timeout when executing AT command (default 2 s)
27 Unknown AT command
28 Invalid image
29 LSB not valid
30 Image marked as invalid
31 Empty
32 Overlap
33 Process restoration
34 Busy
35 Port in use
36 GUID error
37 Invalid CRC
38 Invalid stack type
39 Invalid task
40 Out of specified range
41 GSM modem error
42 GSM channel error (wrong PIN, network not available, …)
43 Waiting for PIN
44 Waiting for PUK
45 Wrong PIN entered
46 Service - GSM Prompt
47 GSM modem inbox full (see below)
48 Truncated
49 Unknown device
50 Unbalanced parenthesis
51 Invalid class
52 No free memory
53 File not found
54 Full run
55 Stopped
56 Unknown metadata
57 Bus error
58 NVRAM not available
59 Configuration error
60 Invalid port number
61 No device

Using the X3 communication port on the Wall PLC

For communication with GSM modem GSM-BGS-T2M or GSM-BGS-E2N via port X3 in RS-232 mode, it is necessary to use straight serial cable D-SUB 09 male-male

Error 47 - Full GSM modem buffer

Full GSM modem inbox occures if there are multiple alarm SMS requirements in a short time interval. Full modem inbox is cleared only after a rising edge is brought to the send variable of the "sendsmstrig" function block. The image below shows possible fix of SMS buffer congestion. In front of the OR function there is a pulse encoder which returns False on the Q output after time defined in the input variable PT. If the sendsmstrig function block returns 47 in its output variable Result, the EQ function returns True and this enables the pulse generator. The pulse generator must have set the TFALSE time interval long enough (10 s), and only 1 s interval in the TTRUE parameter. This repeats the cycle to send the SMS until the Full GSM modem buffer message is cleared.

Application example

This function is typically used to send alarm messages. The sending of a SMS is launched by the alarm status appearance. Another SMS is sent whe the alarm is reset and launched again. Alarm is active as soon as the teplota variable goes over the teplotni_limit value.