Hi dear friends,
when I enable interrupt this works well:
decimal
2variable ticker
variable seconds
262144. 2constant clkpi ( clks per interrupt = 256*prescaler )
1. ticker 2!
0 seconds !
\ overflow2 interupt service routine
\ ! not optimised yet
: tick_isr
ticker 2@ clkpi d- ticker 2!
ticker 2@ clkpi d< if f_cpu ticker 2@ d+ ticker 2!
1 seconds +!
then ;
However with 2variable "seconds" definition:
decimal
2variable ticker
2variable seconds
262144. 2constant clkpi ( clk per interrupt = 256*prescaler )
1. ticker 2!
0. seconds 2!
\ overflow2 interupt service routine
\ ! not optimised yet
: tick_isr
ticker 2@ clkpi d- ticker 2!
ticker 2@ clkpi d< if f_cpu ticker 2@ d+ ticker 2!
1. seconds 2@ d+ seconds 2!
then ;
it crashes in such a way I have to reflash rom to get access to system.
What is the trick here?
I've tried
: 2variable create 0 , 0 , ;
as well as
: 2variable here 2 cells allot constant ;
Thanks a lot,
Pito
|