WAITKEY/de

(Difference between revisions)
Jump to: navigation, search
((**COPIED FROM ENGLISH PAGE**) =)
(Remarks)
Line 25: Line 25:
  
 
| valign="top" width="100%" style="width: 417px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 417px; border: 1px solid rgb(0, 0, 0);" |  
Variable that receives the ASCII value of the serial buffer.
+
Variable für Empfang des ASCII-Zeichens aus dem seriellen Buffer.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
Can be a numeric variable or a string variable.
+
KAnn eine numerische Variable oder eine Zeichenketten-Variable sein.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
Line 36: Line 36:
  
 
| valign="top" width="100%" style="width: 417px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 417px; border: 1px solid rgb(0, 0, 0);" |  
The channel used for the software UART.
+
Für Software-UART benutzter Kanal.
  
 
|}
 
|}
Line 42: Line 42:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
While Inkey() returns a character from the serial buffer too, INKEY() continues when there is no character. Waitkey() waits until there is a character received. This blocks your program.
+
Inkey() gibt ebenfalls ein Zeichen aus dem seriellen Buffer zurück aber Inkey() wartet nicht wenn kein Zeichen im Buffer ist.
 +
 
 +
Waitkey() wartet bis ein Zeichen empfangen wird und blockiert dadurch den Programmablauf.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>

Revision as of 23:19, 21 February 2013

Contents

Funktion

Wartet bis ein Zeichen empfangen wird.

 

 

Syntax

var = WAITKEY()

var = WAITKEY(#channel)

 

 

Remarks

var

Variable für Empfang des ASCII-Zeichens aus dem seriellen Buffer.

 

KAnn eine numerische Variable oder eine Zeichenketten-Variable sein.

#channel

Für Software-UART benutzter Kanal.

 

Inkey() gibt ebenfalls ein Zeichen aus dem seriellen Buffer zurück aber Inkey() wartet nicht wenn kein Zeichen im Buffer ist.

Waitkey() wartet bis ein Zeichen empfangen wird und blockiert dadurch den Programmablauf.

 

 

See also

INKEY , 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