Friday, December 04, 2009
uForth 0.99 -- almost there....
A bit fatter, but more capable... Plus there is some initial refactoring of the code. Download the latest here .
Monday, November 02, 2009
case statements in uForth
case .. of .. endof .. endcase was surprisingly easy to implement:
And, an example:
\ Variable used to keep track of how many 'of' clauses we have.
\
variable _endof
: case ( n -- )
0 _endof !
[compile] >r
; immediate
: of ( n -- )
[compile] r@
[compile] =
postpone if
; immediate
: endof ( -- )
_endof incr
postpone else
; immediate
: endcase ( -- )
_endof @ 0 do postpone then loop
[compile] r>
[compile] drop
; immediate
And, an example:
: test ( number -- )
case
1 of ." one" endof
2 of ." two" endof
3 of ." three" endof
." none"
endcase
;
Friday, October 30, 2009
Hexbug + MSP430 = Robotrophic Parasitism
It's been almost 2 years since I wrote about my interest in Biotrophic Parasitism in robotics...
In what I am calling Robotrophic Parasitism, the parasite (in this case a MSP430 based $3 EZ430-T2102), and the host (an original $10 Hexbug) live happily together.
In this case, the parasite was minimally invasive: the EZ430 lives between the battery switch and the Hexbug circuit, controlling the power. It also has a bi-directional line tapped to the antenna sensors so it can detect a "bump" or steer (the original hexbug only turns clockwise).
The parasite seeks light and steers the bug in that direction. When you first apply power, the parasite turns the hexbug clockwise (up to 6 times) looking for any light bearing direction. It then drives the hexbug in that direction. If the light wanes, it will then do another set of clockwise searches looking for a stronger light source.
I've got some fine tuning to do...
The parts list:
- 1 EZ430-T2102 board.
- 1 Hexbug.
- 1 photoresistor and 1 voltage dividing 1/8 watt resistor (from my parts bin).
- 1 TS5A3127DBVRG4 analog switch (free sample from TI).
Total Cost: ~ $15
This is the first of (hopefully) many Hexbug Robotrophic Parasites!
Wednesday, October 28, 2009
Tuesday, October 27, 2009
uForth 0.96 -- getting closer...
I've simplified uforth.c in this release. Some words coded in C were moved to core.f and init.f.
This made the C code smaller, so you can now compile uForth with the free IAR MSP430 Kickstart Edition!
Still no DOES> (not sure how to do this without dictionary rewriting which is a no-no in my MSP430 flash approach).
It is nicely shaping up though. I am really enjoying rewriting parts of uforth.c in uForth itself (see core.f and init.f in the distribution).
Downloads are here.
Friday, October 16, 2009
uforth 0.921 -- more pre-release goodness
Visit uforth for the latest "on your own for now" pre-release. I've included a link to a prebuilt binary for the MSP430 ez430-rf2500 board.
It's more robust and comprehensive. Plus it supports direct word compiles to the MSP430 flash.
It weighs just over 8KB flash + 900 bytes RAM. It support an 8KB (4096 cell) dictionary, so there is plenty of room to play.
The PC/Unix version still works well too. I use it for new dictionary development and create a TI file of the compiled dictionary for the MSP430.
Nothing automated yet and very little documentation. But, hey you can define words, loop and do some "meta" stuff.
Wednesday, October 07, 2009
uForth 0.7 pre-release
Last night I finally made some progress with compiling to the MSP430 flash dictionary: I can now compile words on the MSP430!
I also moved the MSP430 development to the more widely available (and cheaper!) ez430RF module (MSP430F2274 based).
Unoptimized, the VM/interpreter is 6.6KB and the RAM footprint is 844 bytes (essentially leaving room for 90 one cell variables on the MSP430F2274). I made the dictionary 4092 words (~8KB) to leave room for C app code. The uForth dictionary is (by architecture) limited to 32KB.
Subscribe to:
Posts (Atom)
