On 03Jan19 16:07, Jan Kromhout wrote:
> Hello,
> 
> Is in AmForth a microsecond delay available?
> 
> Cheers,
> 
> Jan
> 

Jan,

As far as I know, whilst AmForth does have a millisecond word 1ms, it
does not have an equivelent microsecond word, say 1us. I think it
would be possible to make one, using 1ms.asm as a template. However,

: 10us ( -- ) 1us 1us 1us 1us 1us 1us 1us 1us 1us 1us ;

would not give the 10 microsecond delay one might hope for because of
the time taken by the inner interpreter between forth words, which I
think, on a 16MHz UNO, is the same order of magnitude as a microsecond[1]. 

I have, however, made specific assembler words for specific project
delays (eg. 250us), for when the existing 1ms was too long.

Tristan

[1] In the absence of an interrupt




_______________________________________________
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