Industrial Automation
Industrial Automation | Europe

myKnowledge

Main > Product Type > Software > Visualisation
Minimize Text   Default    Enlarge Text
 

Print
E-mail

How To Send An SMS Message From A CX-Supervisor Application


Introduction

We often get questions about whether it is possible to send a text message alert from CX-Supervisor using SMS.
 
This article contains an example of how to do this.
 

Finding your modem

You must have a GSM modem connected with your CX-Supervisor runtime machine, this could be attached in a number of ways, the most common would be a Bluetooth connected mobile phone or a USB GSM Dongle.
 
You must first confirm the the GSM modem is configured correctly using Windows Control panel. Most GSM modems will automatically configure themselves when you install the drivers or the helper software. You can check this by navigating through 'System' to open device manager (Under the Hardware Tab) and expanding the Modems section.
 
 
 
Under this section you will see a GSM modem. This may be a 'Standard Modem over Bluetooth link' or be branded with the manufacturer of your GSM device, if not consult the manufacturer instructions for attaching the device.
 
Right click the modem and choose properties, this shows you the setup for the modem. First of all choose the 'Diagnostics' tab and press the 'Query Modem' button, this checks the connection with the modem and will return information about it - this confirms you have a good connection.
 
 
Now you need to find out what COM port the modem is on. This is shown under the 'Modem' tab
 
 
In This case the COM port is 6.
 
You now know you have a valid GSM modem on a COM port.
 

Using the GSM Modem in CX-Supervisor to send SMS Messages

All modems allow you to send commands to them known as AT commands, GSM modems have additional commands that allow text messages to be sent, these can be sent from CX-Supervisor using the varous COM port commands. There are many commands and methods of using them which are documented further in the AT command sets freely available for download on the internet. The attached application sends the correct commands to a GSM modem on COM6 to send a message to a specified phone number.
 
The VB script behind the send button is (You can paste this into CX-Supervisor VBScript) :

Dim AtString
Dim quotemark

'setup and open the com port use device manager to locate the port for
'your GSM modem (or bluetooth connected handset)

SetupCOMPort 6, "256000,N,8,1", 0, 13, TRUE, 3
OpenCOMPort 6

'Set the operating mode of the GSM modem
AtString = "AT+CMGF=1"
OutputCOMPort 6, AtString

'Set the telephone number to send to
quotemark = Chr(34)
AtString = "AT+CMGS=" + quotemark + phonenumber + quotemark
OutputCOMPort 6, AtString

'Send the sms message
AtString = SMSMessage
OutputCOMPort 6, AtString

'Finish the message and close the port
AtString = Chr(26)
OutputCOMPort 6, AtString

CloseCOMPort 6

SMSMessage and phonenumber are CX-Supervisor memory (or PLC) points storing the phone number and the message.
 
To use the attached application (written in CX-Supervisor 2.11), you must set the com port in the script to the com port of your GSM modem. When you run the application you simply enter the correct phone number, a suitable message and press send.
 



Attachments

smssender.zip - Size: 15157


Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2009-06-03
Modified 2009-06-04
Views 6020

 

You are not logged in.