0% found this document useful (0 votes)
890 views2 pages

Sample Cicode To Send Sms From Scada

The document provides instructions for configuring a serial port to send SMS messages via a modem. It describes running a communication wizard to set up an ASCII-based serial port. Settings for the port include 115200 baud rate, 8 data bits, 1 stop bit, no parity. The port is tested using HyperTerminal and able to send test SMS messages. A Cicode function is written to open the serial port, send AT commands to initiate an SMS, send the message text, and close the SMS with Ctrl-Z. The function is called from a button to test sending an SMS via the configured serial port.

Uploaded by

hifzur_sk
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
890 views2 pages

Sample Cicode To Send Sms From Scada

The document provides instructions for configuring a serial port to send SMS messages via a modem. It describes running a communication wizard to set up an ASCII-based serial port. Settings for the port include 115200 baud rate, 8 data bits, 1 stop bit, no parity. The port is tested using HyperTerminal and able to send test SMS messages. A Cicode function is written to open the serial port, send AT commands to initiate an SMS, send the message text, and close the SMS with Ctrl-Z. The function is called from a button to test sending an SMS via the configured serial port.

Uploaded by

hifzur_sk
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

run a Communication Express Wizard follow with

1) Selected Driver Manufacturer : Generic Model : ASCII Based Protocol Devices Communication : Serial 2) connect I/O Device to PSTN - Not Selected 3) Detected Serial Ports: COM6 (Current serial port where modem is connected) 4) Link I/O Device to an external tag database - Not selected 5) Finish -----------------------------------------------------------------------------After the step I configured the Ports Settings 1) Baud Rate = 115200 Data Bits = 8 Stop Bits = 1 Parity = NONE Port Name = PORT3_BOARD1 Make sure that you do not define an I/O Device if it is there then delete it leave only a port (and a COMX board). In the port's "Special Options" field put: -nt ri

*Note: I try to connect through Hyper Terminal and is connected and working fine where able to send SMS through Hyper Terminal with the following AT Command AT+cmgs=016******* <CR> >Hello <Ctrl+Z> -----------------------------------------------------------------------------------After that write a cicode to call COMOpen() and COMWrite() the cicode as follow : INT FUNCTION StartSerial(STRING sPort) INT length; INT SerialWriteError; INT hPort; STRING buffer; STRING CR; STRING CtrlZ; hPort = ComOpen(sPort, 0); IF hPort < 0 THEN

Prompt("Cannot open port " + sPort); RETURN -1; ELSE Prompt("Open Port Success" + sPort);

buffer = "AT+CMGS=0163712151"; // your phone number where sms to be sent// length = StrLength(buffer); SerialWriteError = ComWrite(hPort, buffer, length, -1);

StrSetChar(CR, 0, 13); // put CR into string StrSetChar(CR, 1, 0); // terminate so may be used as a normal Citect string buffer = CR; length = StrLength(buffer); SerialWriteError = ComWrite(hPort, buffer, length, -1); SleepMS(200);

buffer = "test sms"; // test to be sent// length = StrLength(buffer); SerialWriteError = ComWrite(hPort, buffer, length, -1); SleepMS(200);

StrSetChar(CtrlZ,0,26); StrSetChar(CtrlZ,1,0); buffer = CtrlZ; length = StrLength(buffer); SerialWriteError = ComWrite(hPort, buffer, length, -1); SleepMS(200); IF SerialWriteError THEN Prompt ("Error Writing port"); ComReset (hPort); END END RETURN 0; END --------------------------------------------------------------------------------------------Next I created a button to run the cicode function - StartSerial(PORT3_BOARD1) // name of the port created

You might also like