Pacetech
03-06-07, 09:12 PM
On page 49 of the ARM manual, it says we must use "SAVE-RAM" but it is not defined.
Do we still need it?
This code works - without storing it to flash
COLD
SCRUB
MACHINE REDBLINK
ON-MACHINE REDBLINK
APPEND-STATE LEDON
APPEND-STATE LEDOFF
IN-STATE
LEDON
CONDITION
-1
CAUSES
REDLED ON
THEN-STATE
LEDOFF
NEXT-TIME
IN-STATE
LEDOFF
CONDITION
-1
CAUSES
REDLED OFF
THEN-STATE
LEDON
NEXT-TIME
MACHINE-CHAIN RUN-STATES
REDBLINK
END-MACHINE-CHAIN
DECIMAL
: RUN-MACHINES ( -- )
LEDON SET-STATE INSTALL REDBLINK
EVERY 50000 CYCLES SCHEDULE-RUNS RUN-STATES
;
When I try to move the code to FLash, I used this:
COLD
SCRUB
MACHINE REDBLINK FLWORD
ON-MACHINE REDBLINK
APPEND-STATE LEDON FLWORD
APPEND-STATE LEDOFF FLWORD
IN-STATE
LEDON
CONDITION
-1
CAUSES
REDLED ON
THEN-STATE
LEDOFF
NEXT-TIME IN-EE
IN-STATE
LEDOFF
CONDITION
-1
CAUSES
REDLED OFF
THEN-STATE
LEDON
NEXT-TIME IN-EE
MACHINE-CHAIN RUN-STATES
REDBLINK
END-MACHINE-CHAIN FLWORD
DECIMAL
: RUN-MACHINES ( -- )
LEDON SET-STATE INSTALL REDBLINK
EVERY 50000 CYCLES SCHEDULE-RUNS RUN-STATES
; FLWORD
Whenever I execute "RUN-MACHINES", its locks up. Is there something I am missing? Do I need to use SAVE-RAM, which isn't in the ARM FORTH!
Also, TOGGLE doesn't work with REDLED, GRNLED OR YELLED.
One more thing I noticed
If I don't use FLWORD one one word, it shows as follows
COLD
IsoMax V1.0 Preliminary
SCRUB
IsoMax V1.0 Preliminary
: TEST1 ." TEST1" CR ; OK
: TEST2 ." TEST2" CR ; FLWORD OK
OK
OK
WORDS
8010 TEST2 40000898 TEST1 155C TASK
A10 ( 27AC @ 2750 C@
285C ! 2754 C! 33C 2@
So TEST1 is at 400000898, which is in RAM and TEST2 is at 8010, user flash. Sounds good
Now when I type WORD, there are a few words with a 40000XXX address:
40000030 GRNLED
40000020 REDLED
40000028 YELLED
40000010 IOSET
40000000 IOPIN
40000008 IODIR
40000018 IOCLR
These show they are stored in RAM right? Could it be that these words were not stored to flash properly?
And when putting variables in FLASH, I can't get this to work either. Trying to store a value to a variable locks up the POD.
COLD
IsoMax V1.0 Preliminary
SCRUB
IsoMax V1.0 Preliminary
VARIABLE TEST FLWORD OK
0 TEST !
Can anyone provide me with a working example of a program using state machines and stored into FLASH and AUTOSTARTS?
Do we still need it?
This code works - without storing it to flash
COLD
SCRUB
MACHINE REDBLINK
ON-MACHINE REDBLINK
APPEND-STATE LEDON
APPEND-STATE LEDOFF
IN-STATE
LEDON
CONDITION
-1
CAUSES
REDLED ON
THEN-STATE
LEDOFF
NEXT-TIME
IN-STATE
LEDOFF
CONDITION
-1
CAUSES
REDLED OFF
THEN-STATE
LEDON
NEXT-TIME
MACHINE-CHAIN RUN-STATES
REDBLINK
END-MACHINE-CHAIN
DECIMAL
: RUN-MACHINES ( -- )
LEDON SET-STATE INSTALL REDBLINK
EVERY 50000 CYCLES SCHEDULE-RUNS RUN-STATES
;
When I try to move the code to FLash, I used this:
COLD
SCRUB
MACHINE REDBLINK FLWORD
ON-MACHINE REDBLINK
APPEND-STATE LEDON FLWORD
APPEND-STATE LEDOFF FLWORD
IN-STATE
LEDON
CONDITION
-1
CAUSES
REDLED ON
THEN-STATE
LEDOFF
NEXT-TIME IN-EE
IN-STATE
LEDOFF
CONDITION
-1
CAUSES
REDLED OFF
THEN-STATE
LEDON
NEXT-TIME IN-EE
MACHINE-CHAIN RUN-STATES
REDBLINK
END-MACHINE-CHAIN FLWORD
DECIMAL
: RUN-MACHINES ( -- )
LEDON SET-STATE INSTALL REDBLINK
EVERY 50000 CYCLES SCHEDULE-RUNS RUN-STATES
; FLWORD
Whenever I execute "RUN-MACHINES", its locks up. Is there something I am missing? Do I need to use SAVE-RAM, which isn't in the ARM FORTH!
Also, TOGGLE doesn't work with REDLED, GRNLED OR YELLED.
One more thing I noticed
If I don't use FLWORD one one word, it shows as follows
COLD
IsoMax V1.0 Preliminary
SCRUB
IsoMax V1.0 Preliminary
: TEST1 ." TEST1" CR ; OK
: TEST2 ." TEST2" CR ; FLWORD OK
OK
OK
WORDS
8010 TEST2 40000898 TEST1 155C TASK
A10 ( 27AC @ 2750 C@
285C ! 2754 C! 33C 2@
So TEST1 is at 400000898, which is in RAM and TEST2 is at 8010, user flash. Sounds good
Now when I type WORD, there are a few words with a 40000XXX address:
40000030 GRNLED
40000020 REDLED
40000028 YELLED
40000010 IOSET
40000000 IOPIN
40000008 IODIR
40000018 IOCLR
These show they are stored in RAM right? Could it be that these words were not stored to flash properly?
And when putting variables in FLASH, I can't get this to work either. Trying to store a value to a variable locks up the POD.
COLD
IsoMax V1.0 Preliminary
SCRUB
IsoMax V1.0 Preliminary
VARIABLE TEST FLWORD OK
0 TEST !
Can anyone provide me with a working example of a program using state machines and stored into FLASH and AUTOSTARTS?