Hi all,

A bit of a vague post I'm afraid, but I've been banging my head against a
Forth problem and I'm getting nowhere. Just wondered if anyone had any
ideas.

I'm trying to evaluate commands on an Atmega644pa using an XBee radio by
sending a string and the calling 'evaluate' but I can't get it to
'evaluate' when the radio is plugged in. Here's my code:


VARIABLE ctr
: inctr ( -- )
    ctr @ 1 + ctr !
;

: runte ( -- )
    applturnkey
    1 ctr !
    decimal
    keywait
    main:init
    xbee.wake
    50 bigloop
    10 0
    DO
s" is the value of the counter" ctr @ pmessage
s" inctr" evaluate
s" is the new value of the counter" ctr @ pmessage
50 bigloop
    LOOP
;

pmessage formats an xbee packet with a value and a string
bigloop is just a delay
The other commands just sewt up the xbee

Now here's the really bizarre bit. When I boot my device when it's plugged
in to my computer via USB (the way I usually interact with Forth) it runs
fine and increments the value of ctr each time round the loop. But when I
run it on batteries with the xbee plugged in, ctr doesn't get incremented -
it stays at 6 (or whatever I set it to initially). If I change 's" inctr"
evaluate' to just 'inctr' it increments it properly.

This is just a demo of the problem. I've tried loads of test but all with
the same result - commands evaluate with 'evaluate' over the USB but don't
evaluate when it's on batteries and the xbee is plugged in. This just seems
bonkers.

I'm running 5.1 because I'm having trouble compiling the later ones on
Linux.

If anyone has any ideas...

Cheers,

David
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to