INPUTHEX/de

From MCS Wiki AVR
< INPUTHEX
Revision as of 00:42, 27 March 2013 by Stefanhamburg (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

= (**COPIED FROM ENGLISH PAGE**) === Action

Allows hexadecimal input from the keyboard during program execution.

 

 

Syntax

INPUTHEX [" prompt" ] , var[ , varn ]

 

 

Remarks

prompt

An optional string constant printed before the prompt character.

Var,varn

A numeric variable to accept the input value.

 

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

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.

The input entered may be in lower or upper case (0-9 and A-F)

 

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

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

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

 

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

BASCOM implements a new statement: INPUTHEX. This is only to save code as otherwise also code would be needed for decimal conversion.

 

 

Siehe auch

INPUT , ECHO , INPUTBIN

 

 

Beispiel


'-----------------------------------------------------------------------------------------
'name : input.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demo: INPUT, INPUTHEX
'micro : Mega48
'suited for demo : yes
'commercial addon needed : no
'-----------------------------------------------------------------------------------------
 
$regfile = "m48def.dat" ' specify the used micro
$crystal = 4000000 ' Taktfrequenz
$baud = 19200 ' Baudrate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
 
Dim V As Byte , B1 As Byte
Dim C As Integer , D As Byte
Dim S As String * 15
 
Input "Hier kann eine Frage stehen " , V
Input B1 'Weglassen wenn keine Frage
 
Input "Eingabe von Integer " , C
Print C
 
 
Inputhex "Eingabe einer Hex-Zahl (4 bytes) " , C
Print C
Inputhex "Eingabe Hex Byte (2 bytes) " , D
Print D
 
Input "Weitere Variablen " , C , D
Print C ; " " ; D
 
Input C Noecho 'Echo unterdrücken
 
Input "Bitte Namen eingeben " , S
Print "Hallo " ; S
 
Input S Noecho 'Ohne Echo
Print S
End

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language