From: Tristan W. <ho...@tj...> - 2018-10-17 12:27:23
|
On 17Oct18 10:25, Martin Nicholas via Amforth-devel wrote: > Hi, > > I think that @ ! +! 2@ 2! d+! should disable interrupts on the AVR. > Although it's possible to code around a variable being changed by an > interrupt (using C@ C! for example), the 16-bit counter registers can't > be dealt with in a similar way. Section 17.3 of the datasheet > "Accessing 16-bit Registers" deals with all this. @ and ! do do the byte > accesses in the right order, but an interrupt using the 16-bit > registers associated with a particular counter will overwrite the "TEMP > (8-bit)" register (see Figure 17-4). > > Cheers! > > -- > Regards, > > Martin Nicholas. > > E-mail: rep...@mg... > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > Hello Martin, This page http://amforth.sourceforge.net/TG/AVR8.html sets out how AmForth handles interrupts and I think it is relevant to your post. Earlier this year I wrote some forth[1] that used the word 1ms and it was not running as I expected. I had not realised that the execution of AmForth words written in assembler would not be interrupted. @ ! +! are assembler words and so will not be interrupted. Tristan [1] https://sourceforge.net/p/amforth/mailman/amforth-devel/?viewmonth=201806 |