A SERVICE OF

logo

iVIEW-100 Series user’s Manual, 2006, v2.0 ----- 114
Kbhit()
Func.: Checks if any key board hit data is currently available in the input
buffer.
Syntax:
int Kbhit(void);
Header: #include ”mmi100.h”
Description:
Checks if any data is currently available in the input buffer.
Return 0 : for no data input.
Return Oth
ers : Has data in input buffer, and the return value is the next
data in buffer, if the next data is '\0' it will return -1(0xFFFF).
Example:
(stdio.c)
#include <iVIEW.H>
#include <mmi100.h>
void main()
{
int quit=0,data;
InitLib();
Puts("\n\rPress any key to show ASCII('Q' to quit):\n\r");
while(!quit){
if(Kbhit()){
data=Getch();
if(data=='Q') quit=1;
Putch(data);
Print(" ASCII is: %d\n\r", data);
Puts("\n\rPress any key to show ASCII('Q' to quit):\n\r");
}
}
}
Getch()
Func.: Wait until get one character from key board hit.
Syntax:
int Getch(void);
Header: #include ”mmi100.h”
Description:
Read one character from input buffer. If there is no any input in d
ata
buffer, the function will wait until inpur buffer receive any data.
Return Value: 0 to 255.
Example: Please refer to “Kbhit()” for example.
Ungetch()
Func.: Put one character back to input buffer.
Syntax:
int Ungetch(int data);
Header: #include ”mmi100.h”
Description:
If there is no data in the input buffer when call Ungetch, next time call
Getch() will return the data.
data:0 to 255. If data > 255, only the low byte will be send out.
Return Value: On success return NoError, on fail
(the buffer is full)
return 1.
Example: Please refer to “Kbhit()” for example of Getch().