From: Kalus M. <mic...@on...> - 2011-03-30 02:47:34
|
Hi. Am 29.03.2011 um 21:33 schrieb Matthias Trute: .. > Receiving characters is a completly different thing. The characters > can come at any time, therefore the code needs to deal with the > situation relativly fast (at least before the next character > arrives). If you just want to connect a terminal to type in commands, amforth is fast enough to handle this situation: Wait for a key, grab it, put it in inputbuffer, wait again. amforths accepts keys till end of line, then interprets the line. See: uart-rx-poll.asm Since you - the user - wait for the ok of amforth to appear, there is no overflow. I use 12Mhz chrystal, 14400 Baud, atmega168, works fine this way. But to download a file you have to make shure your sending program will immediatly stop sending if a CR is echoed, and continues after OK is encounterd. Terminals usualy can not handle this situation. That is why Mathias is using a Phyton script for downloads. I use ZTerm with Mac OSX. In typing mode, it stops sending when XOFF character is echoed, and continues after XON. So my amforth CR sends xoff to the Terminal too, and the OK is followed by XON. (Typing mode: copy&paste forth souce into ZTerm window, do not use ZTerms file transfer feature. Setup the ZTerm as VT100 with line prompt character ^C ($13 = xoff)). There may be about two characters on its way down to amforth till terminal finaly stops sending more characters. I allways insert 4 or more blanks at the beginning of each line in my forth sources to handle this situation. This way interpretation of a line stays successful even if some characters are lost in the handshaking process. : hallo ." hallo world" ; ^^^^ Maybe this helps. Michael |