DENSO DENSO WAVE

Close

Technical Information

Application Development Manual | Reading incoming data

Reading incoming data

Function

Read incoming data from the receive buffer.

Syntax

Detailed Description

The BHT stores incoming data--a response from the printer, for example--in the data receive buffer. The user application program must first read this data from the receive buffer before processing it.

Use the LOC function to check the number of bytes in the receive buffer and then supply that number to the INPUT$ function.

The INPUT$ function reads the specified number of bytes from the receive buffer data, waiting if necessary until len bytes are available. Be aware that it waits forever if data dropout means that the BHT receives fewer bytes than expected.

Set fileno to the value specified when opening the communications device file.

Examples

Wait for data input and then read from receive buffer

  private recvlen%
private recvdata$
open "COM1:115200" as #1
wait 0,&h08                        ' wait for data input
recvlen% = loc(#1)                 ' check number of bytes in receive buffer
recvdata$ = input$(recvlen%, #1)   ' read incoming data
print recvdata$                    ' display data received
close #1

Wait for data input or timeout (10 seconds) and then read from receive buffer

  private recvlen%
private recvdata$
open "COM1:115200" as #1
timea = 100
wait 0,&h18                        ' wait for data input or timeout
if loc(#1) > 0 then
recvlen% = loc(#1)               ' check number of bytes in receive buffer
recvdata$ = input$(recvlen%, #1) ' read incoming data
print recvdata$                  ' display data received
close #1
else
if timea = 0 then
print "Timeout"
close #1
endif
endif

Contact us

QBdirect

If you have not registered

The services on this member site are available only for registered customers.

New member reg.