INKEY
Action

Returns the ASCII value of the first character in the serial input buffer.

Syntax

var = INKEY()

var = INKEY(#channel)

Remarks

Var Byte, Integer, Word, Long or String variable.
Channel The channel number of device
If there is no character waiting, a zero will be returned.

The INKEY routine can be used when you have a RS-232 interface on your uP.
See the manual for a design of an RS-232 interface.
The RS-232 interface can be connected to a comport of your computer.

The INKEY() function only works with the hardware UART, not the software UART.

See also
WAITKEY

Example


DO 'start loop
A = INKEY 'look for character
IF A > 0 THEN 'is variable > 0?

PRINT A 'yes , there was a character in the buffer END IF 'so print it
LOOP 'loop forever

Example


Open "COM2:" For Binary As #1 'open serial channel 1 on 80537
Dim St as Byte
St = Inkey(#1) 'get key from com2
If St > 0 Then
Printbin #1 , St 'send to com 2
End If
Close
#1