INPUTB
(Statement)
[Version 1.5 or later]
Inputs one byte of data through an RS232C or Ethernet port.
inputb[#<portnumber>,]<integervarnumber>[,WTIME=<timeout> [,RVAL=<restore variable>]
<portnumber>
Input port number.
(1: controller's RS232C port, -1: µVision board's RS232C port, 4-7: Ethernet server ports, 8-15: Ethernet client ports)
Default: 1 (controller's RS232C port)
<integervarnumber>
Inputs one byte of data through an RS232C or Ethernet port.
<timeout> Version 2.2 or later
If no input data is found for any variable, the system will wait for the timeout period specified for this variable, and after that, it will terminate the processing of this INPUTB statement and will pass control to the next command. The timeout period should be specified in ms (milliseconds). In practice, however, the actual wait time is incremented every 1/60 of a second.
<restore variable> Version 2.2 or later
This parameter is used in conjunction with <timeout>. If the processing of a variable is normally completed by data received, then TRUE (1) will be stored into the specified restore variable; if it terminates as a result of a timeout, FALSE (0) will be stored.
This command stores a single byte of data inputted from the specified port, into <integervarnumber>.
If you have not specified a timeout length for this command, the absence of data at the specified port would result in an endless wait. To check whether data actually exists, issue a com_state command.
'!TITLE "<title>"
|
|
PROGRAM sample
|
|
defint 1i
|
|
·
|
|
·
|
|
·
|
|
inputb #1,I10
|
'Store data received through RS232C port
'in I10.
|
inputb #1,I10,WTIME=100,RVAL=1i
|
|
|
'If there is no input data, transfer control to
'the next command after timeout of 100 ms.
'Store "0" into 1i, indicating that the
'processing has terminated because of timeout.
|
·
|
|
·
|
|
·
|
|
END
|
|