Hi,

> How can I know if the mcu is ready to receive another line?

A nice discussion ;)

The forth text interpreter in amforth is line based. This is
coded in QUIT as follows (simplified)

: quit ( stack setup )
   [ \ turn on interpret state
   begin
     ( some prompt magic)
     refill ['] interpret catch
     ( some exception handling)
     prompt-ok
   again
; 

If I understand you correctly you want to stop further input 
as long as interpret works (can be time consuming). For that
I'd recommend to extent REFILL and add the flow control
operations to it. Example code is in lib/hardware/xonxoff.frt

Another place to add flow control is KEY/KEY? Whenever KEY?
is called, it is safe to think, that a key (character) can
be processed too. You could extend KEY? (a deferred word) 
to send XON once (or its hardware counterpart) and the sender  
can start again. The place to send XOFF is trickier. 
IMHO it's application dependent. The REFILL above is the right
place for the interpreter itself.

btw: the echo flow control, the amforth shell uses is way more
complex. It waits for every character individually, not for a whole
line at once. Look for "def send_line(" Only academic people
call it slow ;)

Matthias

------------------------------------------------------------------------------
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to