On 08Jun18 14:57, Matthias Trute wrote: > Am Donnerstag, den 07.06.2018, 21:05 +0100 schrieb Tristan Williams: > > Hello, > > > > I am clearly not understanding how something works, and would be > > grateful for any help. > > > > I am decoding infrared remote control codes using the input capture > > mode of TIMER1 on an ATmega328P (UNO). This works successfully. > > > > Then I decided to buffer the codes received, so that should the MCU > > be > > busy, the codes be collected by the isr will still be available for > > when the MCU is ready. > > > > To test this, I have been using these three "busy" words > > > > : busy1 10 0 ?do $ffff 0 ?do noop loop loop ; > > > > : busy2 5000 0 ?do 1ms loop ; > > > > : busy3 5000 0 ?do pause 1ms loop ; > > I can only guess, but it seems that the 1ms delay is way too > long. Interrupts are handled inside the inner interpreter and > 1ms does not get aborted when an interrupt occurs. That may > lead to lost bytes in your input buffer. > > Matthias > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amforth-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/amforth-devel >
Matthias, Thank you. Yes, this helps a lot. I had not appreciated that 1ms would not be interrupted. Having read http://amforth.sourceforge.net/TG/AVR8.html more carefully, I now understand why busy1 works, but busy2 does not. Many thanks, Tristan ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel