6.2.9 Read Port Status Function (4303)
This function returns the current status of the port. The following events can be detected:
1. A read request was initiated previously and the required number of characters has now been
received or the specified time-out has elapsed.
2. A write request was initiated previously and transmission of the specified number of characters is
complete or a time-out has elapsed.
The status returned by the function indicates the event or events that have completed. More than one
condition can occur simultaneously, if both a read and a write were initiated previously.
Example Command Block for the Read Port Status Function
VALUE
(decimal)
Address
0003
Address +1 0000
Address +2 0008
Address +3 0000
Address +4 0000
Address +5 0000
Address +6 4303
Address +7 0076
Address +8 0101
Port Status
The port status consists of a status word and the number of characters in the input buffer that have not
been retrieved by the application (characters which have been received and are available).
word 1
Port status word (see below)
word 2
Characters available in the input buffer
GFK-2222AD
VALUE
MEANING
(hexadecimal)
0003
Data block length
0000
NOWAIT mode
0008
Status word memory type (%R)
0000
Status word address minus 1 (%R0001)
0000
Not used
0000
Not used
10CF
Read port status command
004C
Port status memory type (%M)
0065
Port status memory offset (%M101)
April 2018
Chapter 6. Serial I/O, SNP & RTU Protocols
215