SendSMS
The SendSMS function block allows an SMS to be sent via a connected GSM modem. The function block is based on the 'Serial Communication' library.
Because the block only communicates via the ComBuffer structure in the 'Serial Communication' library, instances can be formed, and it can be applied to every kind of serial interface.
VAR_INPUT
Send : BOOL;
Number : String;
Text : String(160);
Send: The function block is activated by a positive edge at this input.
Number: telephone number to be dialled in national format (e.g.: 0170123456)
Text: The SMS message to be sent
VAR_OUTPUT
Busy : BOOL;
Error : INT;
Busy: This output is set when there is a rising edge at the Send input, and remains set until the SMS has been sent to the modem or until an error has occurred.
Error: If an error occurs while the SMS is being transferred, the Busy output is reset, and an error code is made available at the Error output. If the Error output is 0, the transfer was successful.
The function block can return the following errors:
Number | Meaning | Cause |
---|---|---|
1 | Communication with the modem is not possible. | Is the terminal correctly configured? |
2 | Modem reports an error during configuration. | Is a compatible GSM modem connected? |
3 | Modem cannot send SMS. | Is the SIM card working properly? Can the card be used without entering the PIN? Is the modem connected to the network? Is a compatible modem connected? |
4 | Communication error. | Has the correct transmission speed been set? |
VAR_IN_OUT
RXbuffer : ComBuffer;
TXbuffer : ComBuffer;
RXbuffer: Structure for communication with the serial interface. An interface-specific block in the 'Serial Communication' library fills this buffer with the data for the interface.
TXbuffer: Structure for communication with the serial interface. An interface-specific block in the 'Serial Communication' library transfers the data from this buffer to the interface.
These structures, and their usage, are described in more detail in the documentation for the ‘Serial Communication' library. The SendSMS block is here connected to a SendString or ReceiveString block.
Requirements
Development environment | Target system type | PLC libraries to include |
---|---|---|
TwinCAT v2.7.0 and higher | PC (i386) | TcPlcSMS.Lib, ChrAsc.Lib, COMLib.Lib, Standard.Lib, PlcHelper.Lib |
TwinCAT v2.8.0 and higher | PC (i386) | TcPlcSMS.Lib, ChrAsc.Lib, COMLib.Lib, TcSystem.Lib, ( Standard.Lib; TcBase.Lib; are included automatically ) |
TwinCAT v2.7.0 and higher | BCxxxx (165) | TcPlcSMSBC.Lb6, Standard.Lb6, PlcHelperBC.Lb6, ChrAsc.Lb6, COMLibBC5B.Lb6 |