begin ASSR c@ 1 2 lshift \ TCN2UB 1 0 lshift or \ TCR2UB 1 1 lshift or \ OCR2UB and until
I am new to the forth world and i'm loving it. I was on the newark ( an electronics parts distributor ) a few months ago and they were selling avrbutterflys for 8 US dollars. So I bought a few and while thinking about what to do with them I found forth and fell into the rabbit hole. That being said, in the cookbook section/popular boards/avr butterfly section it gives an rtc example code. The problem is that the above loop should wait until those three registers are 0. If you leave a 0 on the stack you end up in an infinite loop, and yet surprisingly the +32kHz function that loop comes from works. Well if you dump the ASSR register value ( using .s ) you see that the first look at the register that the TCRTUB flag is set so the value on the stack is one and the loop ends. This is not what the exit condition you want for this loop. Those last three bits in ASSR should be 0 according to the data sheet for the atmega169 (and I also for the atmega328) before moving on. A simple fix is:
begin ASSR c@ 1 2 lshift \ TCN2UB 1 0 lshift or \ TCR2UB 1 1 lshift or \ OCR2UB and 0= \ add this line until How would I submit this as a patch for the documentation? Thanks, Brian-in-ohio ps used this loop to see the values on the stack begin ASSR c@ 1 2 lshift \ TCN2UB 1 0 lshift or \ TCR2UB 1 1 lshift or \ OCR2UB bin .s cr hex and 0= until _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel