INKEY/de

(Difference between revisions)
Jump to: navigation, search
((**COPIED FROM ENGLISH PAGE**) =)
(Remarks)
Line 17: Line 17:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <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 or String variable.
+
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);" |  
A constant number that identifies the opened channel if software UART mode
+
Konstante Nummer des Software-UART-Kanals.
  
 
|}
 
|}
Line 38: Line 38:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
If there is no character waiting, a zero will be returned.
+
Wenn kein Zeichen ansteht dann wird Null zurückgegeben.
  
Use the IsCharWaiting() function to check if there is a byte waiting.
+
Benutzen Sie IsCharWaiting() um zu prüfen ob ein Zeichen ansteht.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
The INKEY routine can be used when you have a RS-232 interface on your uP.
+
Die INKEY-Funktion kann benutzt werden wenn eine serielle Schnittstelle benutzt wird.
  
The RS-232 interface can be connected to a comport of your computer.
+
Die serielle Schnittstelle kann mit einem Com-Port eines PCs verglichen werden.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
As zero(0) will be returned when no character is waiting, the usage is limited when the value of 0 is used in the serial transmission. You can not make a difference between a byte with the value 0 and the case where no data is available.
+
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 that case you can use IsCharwaiting to deterimine if there is a byte waiting.
+
In so einem Fall kann man IsCharwaiting benutzen um herauszufinden ob ein Zeichen ansteht.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</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

WAITKEY , ISCHARWAITING

 

 

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  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language