Receiving SMS by FUPLA

ReceiveSMS_fbd Block

ReceiveSMS_fbd

Lib\Unipi

V1.0

With a rising edge on the “ReadSMS” input, the function block will query the last received SMS message. This block is intended only for FUPLA and it is not recommended to be called very often, the suitable interval is e.g. 5 seconds.

Input Type Description
ReadSMS BOOL Rising edge starts reading SMS
Output Type Description
result INT numeric status; result of the system settings check
sms_channel STRING channel at which the SMS modem is connected
sender STRING SMS message sender number
message STRING received SMS message text (ASCII)
receive_time DT time of SMS receiving

The ReceiveSMS_fbd block checks the connected modem for SMS messages. The output is the channel number channel from which the message was read, message sender number sender, time when the SMS was received receivetime, the SMS message itself message, and result of reading.

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

Now, define the channel name which will be the output variable channel. 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, Wavecom or a Unipi controller. 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.

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

ValueDescription
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)
31 No message
42 GSM channel error (e.g. wrong PIN, network not available …)
  • © Energocentrum Plus, s.r.o. 2017 - 2024