Download Print this page

FATEK FBs-CMGSM User Manual page 3

Communication module
Hide thumbs Also See for FBs-CMGSM:

Advertisement

How CMGSM stores a received message:
Message received
Phone number
Every register of
characters ends with special character 0x00. Examples:
String with one character – "A": D3720 = 0x0041
String "TEXT": D3720 = 0x4554, D3721 = 0x5458, D3722 = 0x0000
String "HELLO": D3720 = 0x4548, D3721 = 0x4C4C, D3722 = 0x004F
If length of phone number is exactly 20 characters (or 160 characters of text) the
character 0x00 at the end is omitted!
CMGSM contains a queue of up to 100 SMS messages. After the queue is full all
other SMS messages are discarded. If a power failure occurs all received messages
in the queue are lost. Base of
or R register via configuration key REGRECV. No other registers are changed than
the necessary ones.
Example of receiving of message "TEST MESSAGE." from phone "+420123456789":
Register
Value
0x0001
RecvFlag: new message
D3700
0x342B
RecvOrigAddress, characters "+" and "4"
D3710
0x3032
RecvOrigAddress, characters "2" and "0"
D3711
0x3231
RecvOrigAddress, characters "1" and "2"
D3712
0x3433
RecvOrigAddress, characters "3" and "4"
D3713
D3714
0x3635
RecvOrigAddress, characters "5" and "6"
D3715
0x3837
RecvOrigAddress, characters "7" and "8"
D3716
0x0039
RecvOrigAddress, characters "9" and end of string
D3720
0x4554
RecvUserData, characters "T" and "E"
D3721
0x5453
RecvUserData, characters "S" and "T"
D3722
0x4D20
RecvUserData, characters " " (space) and "M"
D3723
0x5345
RecvUserData, characters "E" and "S"
0x4153
RecvUserData, characters "S" and "A"
D3724
0x4547
RecvUserData, characters "G" and "E"
D3725
0x002E
RecvUserData, characters "." and end of string
D3726
4.2 GSM Data Connection (Data Call, CSD)
Data connection can be established anytime, even if GPRS communication is in
progress.
Warning
There is no security mechanism against unauthorized data connection to
PLC. So it is highly recommended to set security in PLC (password).
4.3 Service SMS Commands
Received SMS message with string '#!' and password at the beginning are
considered to be
service SMS commands
but they are processed in CMGSM. Device will check for a valid access code (ACODE
parameter in configuration) and if the access code is valid, the message is searched
for keywords. Only one keyword in every SMS is executed.
Example of this SMS:
#!1234 INFO
#!998877 CONFIG
140903 FBs-CMGSM User's Manual EN v3-04
PLC1.ir
START
ELSE
? D3700
WAIT 1s
0x0000
WRITE
Phone number
INTO
D3710-D3719
WRITE
Text of SMS
INTO
D3720-D3799
WRITE
0x0001
INTO D3700
END
Text
or
contains two characters. String of
Recv Record
(D3700) may be changed to another D
Description
. These messages are not forwarded to PLC,
Table of all keywords:
Keyword
Device will respond with SMS describing its current status, e.g.
CMGSM: NETWORK=Vodafone CZ 77%
IN1=off
INFO
OUT2=off
STATE
CSD=no connection
GPRS=no connection
PLC=connected
CMGSM v8.2
Device will respond with confirmation SMS and restart itself. PLC is
not affected.
RESET
This command is used after change of configuration in PLC register
to accept the changes by CMGSM.
Device
will
respond
CONFIG
configuration is a default configuration with some values changed by
configuration string in PLC, see Chapter 5 – Configuration.)
CMGSM will respond with confirmation SMS. CMGSM will write
FACTORY
default configuration to attached PLC and restart itself.
Activate digital output OUT2
ON
Deactivate digital output OUT2
OFF
4.4 TCP over GPRS
One of the primary functions of this device is to establish and maintain TCP
connection from PLC to a server. In order to achieve this goal FBs-CMGSM has to
make following steps after power up:
Establish connection to PLC via serial port. Parameters of the serial port are: 9600
baud, 7 data bits, EVEN parity, 1 stop bit, no hw handshake (it is default FATEK
settings for all serial ports), address 01h.
After power on the FBs-CMGSM will proceed steps:
Read configuration from PLC register D3900 – D3999.
Login to the GSM network, using PIN from configuration.
Attach to GPRS, using APN, USER and PASSWD from configuration.
Establish and maintain TCP connection to SERVER on port PORT.
CMGSM will try indefinitely to read configuration from PLC at the beginning. If there
is no serial communication between CMGSM and PLC device will not login into the
GSM network! If there is no configuration in PLC or the configuration is damaged or
other problem occurs CMGSM writes default configuration into the PLC.
GPRS can be controlled and monitored via set of registers in PLC and via
configuration:
Registers
Caption
D3510
GprsCommand
GprsState
D3511
D3512
GprsCntErr
GprsCntUp
D3516-D3517
GprsCntDown
D3518-D3519
GprsLocalIP
D3520-D3523
D3524
GprsLocalPort
GprsRemoteIP
D3525-D3528
D3529
GprsRemotePort
This range of registers cannot be used for any other purposes!
GPRS diagnostic is part of Diagnostic (see chapter Diagnostic). Base of
(D3500) may be changed to another D or R register via configuration key REGDIAG.
4.5 Events
Device can detect special events and send a warning about them as a SMS:
Connection to PLC failure/restore
It is needed to set parameter MASTER in configuration for both of these events,
see chapter 5.2 Basic Parameters.
Description
with
current
configuration.
(Current
Description
0=no connection (written by PLC)
1=open connection (written by PLC)
0x00=no connection, idle
0x01=connecting
0x80=connected
0x81=disconnecting
Error counter for connection
Data
counter,
direction
(= PLCTCP), D3516 LSB
Data
counter,
direction
(= TCPPLC), D3518 LSB
Local IP address if connected. "0.0.0.0" if
not connected. (D3520=MSB)
Example:
If local IP address is 147.32.80.1, then
D3520 ... 0x0093 (147d)
D3521 ... 0x0020 (32d)
D3522 ... 0x0050 (80d)
D3523 ... 0x0001 (1d)
Local TCP port if connected, 0 if not
connected
Remote IP address if connected. "0.0.0.0"
if not connected. (D2425=MSB)
Remote TCP port if connected, 0 if not
connected
Diag Record
Page #3 of 7
UP
DOWN

Advertisement

loading