SENDSMS
PROGRAM TEST_SENDSMS VAR TESTSMS:BOOL:=TRUE; CHANNEL : STRING[64] := 'ALRCHANNEL'; RECIPIENT : STRING[64] := '00420123456789'; MESSAGE : STRING[64]; END_VAR IF TESTSMS THEN MESSAGE := 'TEST SMS HAS BEEN SENT.'; MESSAGING.SENDSMS(CHANNEL,RECIPIENT,MESSAGE); TESTSMS := FALSE; END_IF; END_PROGRAM
MESSAGING
V1.0
The function sends a SMS in each PLC computing cycle. It is highly recommended to be used in ST code only to prevent occassional flooding of the recipient with many messages of the same contents. If You want to send more than one message at the time, You have to use this block multiple times or create some sort of switcher for recepients. Every GSM gate has it's queue lemit, for example limit of four messages. We highly recommend to send the messages with some breaks, for example pause between two messages can be 10 seconds. Messages that can't be handeled by the queue are forgotten.
Input | Type | Description |
CHANNEL | STRING_REF | reference to variable with the communication connection definition (set in PLC properties, see below) |
RECIPIENT | STRING_REF | reference to variable with recipient's phone number |
MESSAGE | STRING_REF | reference to variable with the SMS message text (ASCII) |
Output | Type | Description |
⇒ | SINT | Numeric status; result of the system settings check |
At each of the sendsms function calls, a SMS is sent from the predefined GSM modem to the recipient phone number. The SMS contents 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. Then, 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. 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.
Value | Description |
0 | OK |
16 | Unknown channel |
24 | Error - impossible to determine the status |
25 | Port can not be opened or modem can not be initialised (e.g. wrong COM port number) |
26 | Timeout at the AT command (default 2 s) |
42 | GSM channel error (e.g. wrong PIN, network not available …) |
other | Internal error - contact Domat Control System support |
The function is typically used to send alarm messages or regular reports with energy consumption, environmental parameters etc. See ST call above for function call