Top  Previous  Next


Allows input from the keyboard during program execution.




INPUTHEX [" prompt" ] , var [ , varn ]   [ NOECHO  ] [TIMEOUT=xx]





An optional string constant printed before the prompt character.


A numeric variable to accept the input value.


Disables input echoed back to the Comport.


Optional delay time. When you specify the delay time, the routine will return when no input data is available after the specified time. No timer is used but 4 bytes are taken from the internal memory to provide a count down timer.


When you use the TIMEOUT option once, you must use it for all INPUT/INPUTHEX statements. Providing zero as the timeout parameter will wait for the longest possible time.

The INPUTHEX routine can be used when you have a RS-232 interface on your uP.

See the manual for a design of a RS-232 interface.

The RS-232 interface can be connected to a serial communication port of your computer.

This way you can use a terminal emulator and the keyboard as input device.

You can also use the build in terminal emulator.


If var is a byte then the input must be 2 characters long.

If var is an integer/word then the input must be 4 characters long.

If var is a long then the input must be 8 characters long.



Difference with QB

In QB you can specify &H with INPUT so QB will recognize that a hexadecimal string is used.

BASCOM implement a new statement : INPUTHEX.



See also





Dim  x As Byte

INPUTHEX " Enter a number " , x        'ask for input