Send/Receive SMS Messages

To send or receive SMS Messages, you must first Configure a ModemConfigure a Modem.

  1. Click Modems in the Solution Explorer.

  2. Click Add Modem.

  3. Click the fields to edit Modem parameters Modem Name, Type, and Signal Quality Refresh rate fields.

  4. Assign a Communication Channel.
    The parameter Port defines the communication channel between controller and modem. You can select a channel that is physically located on a communication module, or the Panel USB Port.

  5. To enable the modem to accept incoming SMS messages and add them to the SMS Received Queue, you must check the Receive SMS option.

  6. To filter the phone numbers from which incoming message may be received, click Authorized Numbers and add permissible phone numbers to the list.  

Checking SMS Received adds the message to the queue. However, the only way for the controller to receive the message is via the Receive SMS ladder function

 

When you add the modem, the program creates a struct that you can use in your program.

Name

Data Type

Definition

Success

Bit

ON=Modem Initialized Successfully

Fail

Bit

ON=Modem Initialization Failed

Status

UINT32

Code

 Message

0 = No Errors

1 = Function Started

2 = Function in Progress

-1 = General initialization error

-2 = Pin code Error

-3 = Baud Rate Error

-4 = Signal Quality Error

-5 = Router name error

-6 = Save router parameter error

-7 = Modem GPRS error

-9 = Router General Error

-10 = Router signal quality error

-11 = Router session ID error

-12 = Router network type error

-13 = Router GPS error

-14 = Router mobile traffic error

-17 = Router Model Name error

-99 = Modem/Router not connected

-100 = Modem/Router powered off                   

Signal Quality

UINT8

Written here by the controller

Modem Name

ASCII

Entered by user when defining the modem.

PIN Code

ASCII

Entered by user when defining the modem.

GPRS APN

ASCII

Entered by user when defining the modem.

GPRS User

ASCII

Entered by user when defining the modem.

GPRS Password

ASCII

Entered by user when defining the modem.

GPRS IP

ASCII

Entered by user when defining the modem.

SMS Received Queue

UINT8

 

This is the number of SMS messages that are in the modem queue, that have not been transferrer to the controller.
Note that the only way for the controller to accept the message is via the Receive SMS ladder function.

 

 

Sending SMS

First, you must create the messages, and then send them in your program.

Create SMS Messages and set Phone NumbersCreate SMS Messages and set Phone Numbers

SMS message can contain both fixed text and variables.

Note

The length of the SMS message is limited by whether you have enabled non-English SMS characters in the Send SMS Ladder Element

  • English-only 150 ASCII character maximum.

  • Non-English enabled: 70 character maximum.

 

  1. Select SMS Messages in the Solution Explorer.

  2. Click the Add New SMS button.

  3. Click the SMS message to open it up and define it.

  4. From the Toolbox, select elements to add to the message, and configure these elements via the Properties Window.

  5. Add phone numbers by clicking the Message header icon to open the properties window, and then click Phone Numbers Collection.

  6. Click Add New Phone Number, and link a String-ASCII data tag.

 

SMS Message Struct

When you create an SMS message, UniLogic automatically creates a supporting struct.

Name

Data Type

Definition

Send:Success

Bit

ON=Sent Successfully

Send: Fail

Bit

ON=Send Failed

Status

 

UINT32

 

Error

SMS Send Status Message

0

No errors

1

Function start

2

Function in Progress

-1

Modem only: General COM error. Please check the physical connections.

-2

Modem only: Sent message error

-3

Modem only: Telephone number format error

Note that the number cannot contain spaces.

-4

 

Modem only: Parse Message error. This may result because:

- The elements in the message may contain a 'null' character

- Message length exceed the maximum limit,150 for English-only, 70 for non-English characters.
Note that if the message contains list elements, and the lists contain many members, this may cause the message to exceed the maximum limit.

-5

SMS Last Error

-6

Router only: Incorrect Username or Password to Router's SMS module

-7

Router only: General Error. Resend message; if error persists, check the Router authorizations.

 

 

Send Message via LadderSend Message via Ladder

  1. Place a COM>: SMS & email> Initialize Modem function in the Ladder.
    In order to ensure that the modem will be initialized at power-up, place it after a direct contact.

  2. Place a Send SMS ladder element after your desired logic send conditions.

  3. In the Send SMS element:

    1. Click parameter A to open the list of SMS messages and select one

    2. Click parameter B and select the modem that will send the SMS.

    3. If you are using a non-English characters in your SMS message, change parameter C to #1, otherwise leave it as default.

 

 

Receiving SMS Messages

In your Modem Configuration:

In your Ladder:

Receive Messages via LadderReceive Messages via Ladder

  1. Place a COM>: SMS & email> Initialize Modem function in the Ladder.
    In order to ensure that the modem will be initialized at power-up, place it after a direct contact.

  2. Check that there are messages in the SMS Received Queue.



     

  3. Place a Receive SMS ladder element after your desired logic send conditions.


You can parse your received message via the Third-party Protocol function, Parse.

 

If you are connected to the Internet, click to view the video Sending SMS Messages

Related Topics

SMS: Creating Messages

SMS: Sending via Ladder

LF: Receive SMS

LF: Initialize Modem

Buffers

Parse

Configuring a Modem

Configuring a Router