STM8 Forth

At Tarlab, I dug out the cheap STM8 boards and stlink board that I'd had in my bag for a while now.

I updated some software and installed tools and compiled a blinky according to stm8ef tutorial. That essentially worked out of the box, blinking the second red led on the cheapo board.

After some messing with wiring and installing picocom, I flashed a binary of stm8ef the Forth and that also responded over the uart happily, albeit slowly.

This time the blinky had to be input by hand to slow it down but it finally resulted in another blinking LED.

I also went through more of the tutorials. Even the adc words seemed to work, giving varying values with the pin D2 unconnected, and zero when pulled down with a resistor. I went a found a set of high-ish resistors, and created some dividers and 1:1 gives about 508, 2:1 685, and 1:2 337. which seems quite sensible.

: conv ADC! ADC@ ;
3 conv . 771 ok

3 conv .  0 ok
3 conv .  0 ok
3 conv .  505 ok
3 conv .  507 ok
3 conv .  508 ok
3 conv .  507 ok
3 conv .  508 ok
3 conv .  507 ok
3 conv .  507 ok
3 conv .  682 ok
3 conv .  688 ok
3 conv .  682 ok
3 conv .  685 ok
3 conv .  682 ok
3 conv .  334 ok
3 conv .  339 ok
3 conv .  337 ok
3 conv .  344 ok

I just paste the expression in there and the output gets printed on the same line, which should explain the output.

Conclusion

It works. This would be a neat way to build some little cheap boards to drive motors and displays and things or interface to sensors. Next step would be to figure out how to store ready code in a file and flash a controller, preferrably in one shot. That's something that often doesn't get represented with languages where having a REPL steals the spotlight. Ultimately it is desirable to have coherent programs in files from so they can be installed (flashed) and put into use, studied, improved, and distributed.

Links