Справочник Пользователя для Mitsubishi Electronics FX2NC

Скачать
Страница из 382
FX Series Programmable Controllers
Points Of Technique 10
10-19
10.14.2 Header and Terminator Characters
The header and terminator characters can be changed by the user to suit their requirements.
The default setting for the header stored in D8124 is 'STX' (or 02H)and the terminator default
setting stored in D8125 is 'ETX' (or 03H).
The header and terminator characters are automatically added to the 'send' message at the
time of transmission. During a receive cycle, data will be ignored until the header is received.
Data will be continually 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
message is considered incomplete.
If no termination character is used, then reading will continue until the receive data buffer is
full. Only at this point will a message have been accepted and complete. There is no further
buffering of any 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 very important to specify the receive buffer length the same size as the longest
message 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 being used to
identify the message length in the RS instruction this
should be set to the new message length. The send flag
M8122 should then be SET ON. This will automatically
reset once the message has been sent. Please see the
example program right.
Events encountered when receiving a message:
The RS instruction should be set up and active.
Once data is being received and an attempt is made to
send out data, the special M flag M8121 is set ON to
indicate the transmission will be delayed. Once the
'incoming' message is completely received the message
received flag M8123 is set ON. At the same time if M8121
was  ON it  i s  aut omatically r es et allowing  f ur th er
messages (delayed 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 by the user. This is then ready to send a
message or to await receipt of a new message.
K 10
D200
RS
D49
D50
M8000
X3
BMOV
K 6
D50
D100
MOV
D49
K6
SET M8122
K 10
D200
RS
D49
D50
M8000
M8123
BMOV
K 10
D70
D200
RST M8123