Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 513 of 909
LEN
Length of Character Count in Communications Port 0
APPLICATION: Communications control
DESCRIPTION: Number of characters in channel 0 receive buffer
EXECUTION: Immediate
CONDITIONAL TO: Communications channel 0 must be open in data mode
LIMITATIONS: Maximum buffer length is 31 characters
READ/REPORT: RLEN
WRITE: Read only
LANGUAGE ACCESS: Formulas and conditional testing
UNITS: Number of available characters
RANGE OF VALUES: 0 to 31
TYPICAL VALUES: 0 to 31
DEFAULT VALUE: 0
FIRMWARE VERSION: 5.x and later
COMBITRONIC: N/A
DETAILED DESCRIPTION:
The LEN command checks the receive buffer of serial communications channel 0 and returns
the number of characters that are waiting to be processed. Testing the value of LEN is a good
way to see if there is a character available for retrieval with the GETCHR command (see the
following example).
EXAMPLE:
i=0
IF LEN>0 'Any data received?
GOSUB5 'If so, process data
ENDIF
END
C5
ab[i]=GETCHR 'Read and store in data
'Process incoming data
i=i+1 'Maintain reference index
RETURN
In the previous example, "i" will be equal to LEN.
RELATED COMMANDS:
R
GETCHR Next Character from Communications Port 0 (see page 459)
R
GETCHR1 Next Character from Communications Port 1 (see page 461)
R
LEN1 Length of Character Count in Communications Port 1 (see page 514)
OCHN(...) Open Channel (see page 601)
Part 2: Commands: LEN