Keil RTX51 Manual page 61

Table of Contents

Advertisement

RTX TINY
TR1
*/
ES
= 1;
*/
}
GETLINE.C
/*****************************************************************************
*/
/*
*/
/*
*/
/*
*/
/*****************************************************************************
*/
#include <stdio.h>
#define CNTLQ
#define CNTLS
#define DEL
#define BACKSPACE
#define CR
#define LF
/***************/
/* Line Editor */
/***************/
void getline (char idata *line, unsigned char n)
unsigned char cnt = 0;
char c;
do
{
if
((c
*/
if
(c
*/
if (cnt != 0)
cnt--;
*/
line--;
*/
putchar
*/
putchar (' ');
putchar (0x08);
}
}
else
if
*/
putchar (*line = c);
*/
line++;
*/
cnt++;
*/
}
}
while (cnt < n - 1
*/
=
1;
GETLINE.C:
0x11
0x13
0x7F
0x08
0x0D
0x0A
=
_getkey
())
==
==
BACKSPACE
||
{
(0x08);
(c
!=
CNTLQ
&&
c
&&
c != LF);
/* enable serial port interrupt
Line
Edited
{
CR)
c
=
LF;
c
==
DEL)
{
!=
CNTLS)
{
/*
/* echo and store character
/* increment line pointer
/* check limit and line feed
/*
timer
1
run
Character
Input
/*
read
character
/*
process
backspace
/* decrement count
/* and line pointer
/*
echo
backspace
ignore
Control
S/Q
/* and count
61
6

Advertisement

Table of Contents
loading

Table of Contents