Chapter 6. Serial I/O, SNP & RTU Protocols
GFK-2222AD
April 2018
215
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)
VALUE
(hexadecimal)
MEANING
Address
0003
0003
Data block length
A1
0000
0000
NOWAIT mode
A2
0008
0008
Status word memory type (%R)
A3
0000
0000
Status word address minus 1 (%R0001)
A4
0000
0000
Not used
A5
0000
0000
Not used
A6
4303
10CF
Read port status command
A7
0076
004C
Port status memory type (%M)
A8
0101
0065
Port status memory offset (%M101)
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