basic.get Statement/BASIC Program


Command basic.get Statement/BASIC Program
Applicable release versions:
Category BASIC Program (486)
Description gets raw characters from the specified port.
"variable" receives the input. Printable characters are echoed to the line, unless the program issues a 'ECHO OFF' statement. Control characters are included, but not echoed to the screen. No prompt is displayed.
"length" is the maximum characters to get. If no length is specified, and there is no "until" clause, "1" (one) is the default. If the length is specified, but this number of characters is not entered, the system waits indefinitely or until the "waiting" clause times out, the "termination.character" is entered, or the "length" is satisfied. If the "length" is satisfied, the "then" clause is executed.
"setting" specifies the number of characters to be returned. If the "length" expression is less than the number of characters specified by "setting", input terminates at the length. If the "length" expression is greater than "setting", only the number of characters specified by the "setting" are returned to the variable.
"from" is the port from which to get characters. This port must have been previously attached with the "dev-att" command. If an invalid port number is specified or the port is not attached , then the "else" clause is taken.
"until" defines a set of characters which terminate input. If the "x" option is not in effect, the input also terminates on a char(255) (x'ff'). The "termination.character" is not included in the returned string. When a "termination.character" is received, the "then" clause is executed.
"returning" returns the character which terminated input. If the "returning" variable is null, and either no length is specified, or the returned data length is less than the length limit, a segment mark (x'ff') is assumed as the "termination.character".
"waiting" specifies how long, in tenths of a second, the system should wait until an input termination condition exists (such as satisfying the length requirement or the "until" clause). If a timeout occurs, all input received up to this point is returned in the "variable", and the "else" clause, if present, is executed.
"getx" returns an exploded ASCII hexadecimal string which allows binary data to contain a decimal 255 (x'ff').
Syntax get{x} variable{,length} {setting character.count} from port.expression {until termination.character(s)} {returning termination.character(s)} {waiting seconds.expression} {then|else statement.block}
get xx,80 setting 5 from 10 until (char(13):char(10)) returning term waiting 60

This will get up to 80 characters from port 10 until that port generates a 
carriage return (char(13)) or linefeed (char(10)).   If more than 6 seconds 
elapse, then the statement terminates.  Note that xx will contain a maximum of 
5 characters.  The "term" variable will contain which character 
actually terminated input.

getx xx,10 from 10 waiting 50

If "HELLO" is entered on port 10, xx will contain 
"48454C4C4F". If the string, "HE<backspace>LLO" is 
entered, xx will contain "4845084C4C4F", where the "08" is 
the backspace character.
Related basic.send