Exploring amforth on my arduino uno is a bit difficult without
a working upload tool. I help myself with a simple bash script
which just waits after characters and newlines and works often
(but not always) for short single files and is s l o o o o w ...
But here we go:
Whats wrong with the following simple test code:
\ ################################################################
marker _TIMER0_
variable ticks
: tim0isr ( -- ) 1 ticks +! ; \ timer0 ISR
: tim0ini ( -- ) \ initialize timer0
0 ticks !
0 TCNT0 c! \ clear counter
0 TCCR0A c! \ normal mode
4 TCCR0B c! \ internal clock /256 \ hangs system, had to re-flash amforth
\ some variants:
\ 3 TCCR0B c! \ internal clock, prescaler set to 64 \ does NOT tick
\ TCCR0B c@ &fff8 and 3 or TCCR0B c! \ internal clock /64 \ same
\ 5 TCCR0B c! \ internal clock /1024 \ reset?
['] tim0isr TIMER0_OVFAddr int!
\ ['] noop TIMER0_OVFAddr int! \ just a test
;
: +tim0int ( -- ) 1 TIMSK0 c! ; \ enable interrupt
: -tim0int ( -- ) 0 TIMSK0 c! ; \ disable interrupt
: tim0start ( -- ) tim0ini +tim0int ;
\ ################################################################
The result on my arduino uno is quite inconsistent, but mostly I see:
3 TCCR0B c!
does not hang the system, but does not tick either.
4 TCCR0B c!
hangs system, had to re-flash amforth
often also takes my /dev/ttyACM0 down and I have to reboot linux
(which looks to me like a linux kernel issue).
5 TCCR0B c!
reset?
The system starts to print the boot message interruptet by some
bytes of garbage and endlessly repeats that.
Confused,
Robert
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel