Have you tried something as simple as:

PAUSE 50

FLUSH:

IF PIR1.5 = 1 THEN
HSERIN [FlushChar]
GOTO Flush
ENDIF

Main Program: