FX Series Programmable Controllers Points Of Technique 10
10-19
10.14.2 Header and Terminator Characters
The header and terminator characters can be chan
g
ed b
y
the user to suit their requirements.
The default settin
g
for the header stored in D8124 is 'STX' (or 02H)and the terminator default
settin
g
stored in D8125 is 'ETX' (or 03H).
The header and terminator characters are automaticall
y
added to the 'send' messa
g
e at the
time of transmission. Durin
g
a receive c
y
cle, data will be i
g
nored until the header is received.
Data will be continuall
y
read until either the termination character is received or the receive
buffer is filled. If the buffer is filled before the termination character is received then the
messa
g
e is considered incomplete.
If no termination character is used, then readin
g
will continue until the receive data buffer is
full. Onl
y
at this point will a messa
g
e have been accepted and complete. There is no further
bufferin
g
of an
y
communications, hence if more data is sent than the available destination
buffer size then the excess will be lost once the buffer is full.
It is therefore ver
y
important to specif
y
the receive buffer len
g
th the same size as the lon
g
est
messa
g
e to be received.
Events to complete a transmission:
The RS instruction should be set up and active.
The data to be transmitted should be moved into the
transmission data buffer. If a variable is bein
g
used to
identif
y
the messa
g
e len
g
th in the RS instruction this
should be set to the new messa
g
e len
g
th. The send fla
g
M8122 should then be SET ON. This will automaticall
y
reset once the messa
g
e has been sent. Please see the
example pro
g
ram ri
g
ht.
Events encountered when receiving a message:
The RS instruction should be set up and active.
Once data is bein
g
received and an attempt is made to
send out data, the special M fla
g
M8121 is set ON to
indicate the transmission will be dela
y
ed. Once the
'incomin
g
' messa
g
e is completel
y
received the messa
g
e
received fla
g
M8123 is set ON. At the same time if M8121
was ON it is automaticall
y
reset allowin
g
further
messa
g
es (dela
y
ed or otherwise) to be transmitted.
It is advisable to move the received data out of the received data buffer as soon as possible.
Once this is complete M8123 should be reset b
y
the user. This is then read
y
to send a
messa
g
e or to await receipt of a new messa
g
e.
K 10D200RS D49D50
M8000
X3
BMOV K 6D50D100
MOV D49K6
SET M8122
K 10D200RS D49D50
M8000
M8123
BMOV K 10D70D200
RST M8123