Program blocks
5.2 Programming SMS messages via OUC
CP 1243-7 LTE
Operating Instructions, 04/2017, C79000-G8976-C381-03
109
In the structure of the DB, create the following data types for the SMS messages:
●
DTL
12 bytes for the time stamp of the received SMS message (time stamp from the network)
●
String[22]
String of 22 bytes for the phone number of the sender (+ 2 byte string header)
●
String[160]
String of 160 bytes for the message text (+ 2 byte string header)
The SMS message text can contain max. 160 characters.
Per SMS message the structure requires memory space of 198 bytes.
Storing the last 10 received SMS messages
You can output up to 10 received SMS messages from the receive block by making the entry
"SMSSTORE" for the "PhoneNumber" parameter of TCON_PHONE.
To store the received data from 10 SMS messages , you need to create an adequately large
structure (2000 bytes) for the "DATA" parameter of the receiving block. As described above,
the structure has the following organization:
●
Received data SMS 1 (DTL, String[22], String[160], Byte)
●
Received data SMS 2 (DTL, String[22], String[160], Byte)
... to
●
Received data SMS 10 (DTL, String[22], String[160], Byte)
The received data of every SMS message gas the following structure:
●
DTL
12 bytes for the time stamp of the received SMS message (time stamp from the network)
●
String[22]
String of 22 bytes for the phone number of the sender (+ 2 byte string header)
●
String[160]
String of 160 bytes for the message text (+ 2 byte string header)
●
Byte
Status of the SMS message
If more than one SMS message is received the status of every SMS is stored in this
status byte:
–
0 = Invalid
1 = Unread
2 = Read
When receiving multiple SMS messages, per SMS message the structure requires memory
space of 200 bytes.