INKEY/de
(→(**COPIED FROM ENGLISH PAGE**) =) |
(→Remarks) |
||
Line 17: | Line 17: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | = <span class="f_Header"> | + | = <span class="f_Header">Anmerkungen</span> = |
<div style="padding: 0px; margin: 0px 0px 0px 4px;"> | <div style="padding: 0px; margin: 0px 0px 0px 4px;"> | ||
{| width="488" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;" | {| width="488" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;" | ||
Line 25: | Line 25: | ||
| valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" | | | valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" | | ||
− | Byte, Integer, Word, Long | + | Byte-, Integer-, Word-, Long- oder String-Variable. |
|- style="vertical-align: top;" | |- style="vertical-align: top;" | ||
Line 32: | Line 32: | ||
| valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" | | | valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" | | ||
− | + | Konstante Nummer des Software-UART-Kanals. | |
|} | |} | ||
Line 38: | Line 38: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | + | Wenn kein Zeichen ansteht dann wird Null zurückgegeben. | |
− | + | Benutzen Sie IsCharWaiting() um zu prüfen ob ein Zeichen ansteht. | |
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | + | Die INKEY-Funktion kann benutzt werden wenn eine serielle Schnittstelle benutzt wird. | |
− | + | Die serielle Schnittstelle kann mit einem Com-Port eines PCs verglichen werden. | |
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | + | Eine Null (0) wird zurückgegeben wenn kein Zeichen ansteht. Die Funktion eignet sich daher nur bedingt wenn auch Nullen empfangen werden sollen. Man kann nicht unterscheiden zwischen einer empfangenen Null und dem Fall dass kein Zeichen ansteht. | |
− | In | + | In so einem Fall kann man IsCharwaiting benutzen um herauszufinden ob ein Zeichen ansteht. |
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> |
Revision as of 23:37, 21 February 2013
Contents |
Funktion
Gibt den ASCII-Wert des ersten Zeichens aus dem seriellen Buffer zurück.
Syntax
var = INKEY()
var = INKEY(#channel)
Anmerkungen
Var |
Byte-, Integer-, Word-, Long- oder String-Variable. |
Channel |
Konstante Nummer des Software-UART-Kanals. |
Wenn kein Zeichen ansteht dann wird Null zurückgegeben.
Benutzen Sie IsCharWaiting() um zu prüfen ob ein Zeichen ansteht.
Die INKEY-Funktion kann benutzt werden wenn eine serielle Schnittstelle benutzt wird.
Die serielle Schnittstelle kann mit einem Com-Port eines PCs verglichen werden.
Eine Null (0) wird zurückgegeben wenn kein Zeichen ansteht. Die Funktion eignet sich daher nur bedingt wenn auch Nullen empfangen werden sollen. Man kann nicht unterscheiden zwischen einer empfangenen Null und dem Fall dass kein Zeichen ansteht.
In so einem Fall kann man IsCharwaiting benutzen um herauszufinden ob ein Zeichen ansteht.
See also
Example
'----------------------------------------------------------------------------------------- 'name : inkey.bas 'copyright : (c) 1995-2005, MCS Electronics 'purpose : demo: INKEY , WAITKEY 'micro : Mega48 'suited for demo : yes 'commercial addon needed : no '----------------------------------------------------------------------------------------- $regfile = "m48def.dat" ' specify the used micro $crystal = 4000000 ' used crystal frequency $baud = 19200 ' use baud rate $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 A As Byte , S As String * 2 Do A = Inkey() 'get ascii value from serial port 's = Inkey() If A > 0 Then 'we got something Print "ASCII code " ; A ; " from serial" End If Loop Until A = 27 'until ESC is pressed A = Waitkey() 'wait for a key 's = waitkey() Print Chr(a) 'wait until ESC is pressed Do Loop Until Inkey() = 27 'When you need to receive binary data and the bibary value 0 , 'you can use the IScharwaiting() function. 'This will return 1 when there is a char waiting and 0 if there is no char waiting. 'You can get the char with inkey or waitkey then. End
Languages | English • Deutsch |
---|