Close

Using the 1-Wire Thermometer Chip DS18B20 with STM8 eForth

A project log for eForth for cheap STM8S gadgets

Turn cheap modules from AliExpress into interactive development kits!

thomasThomas 03/04/2021 at 20:120 Comments

I was asked whether STM8 eForth can support Brad Rodriguez 1-Wire code which was written for the MSP430 and I had a look into it. After familiarizing myself with the time-honored 1-Wire protocol (which I read for the first time at least 20 years ago) I quickly hacked some low-level routines:

That's indeed all that's needed for basic operations.

Brad Rodriguez, a well known name in the Forth scene, did some more than that: he also implemented the ROMSEARCH algorithm, needed for getting all devices on a bus. The code is part of his CamelForth repository.

CamelForth code looks very similar to eForth code (indeed I just had to provide INVERT as an "alias" of NOT, and implement a few words like LSHIFT. 

A write-up is here: https://gist.github.com/TG9541/348abfae54c79f1c1c5a4f4ed0dcfdf5

Discussions