Skip to main content
shopping_basket Basket 0
Login

A Forth-based Embedded Controller Development System

Bill Marshall
4
Having been a fan of the computer language Forth for many years, I began a project some time ago to create a version for embedded control based on the Microchip dsPIC33. DS blog posts have covered my progress to this version for the Clicker 2 board.

Parts list

Qty Product Part number
1 MikroElektronika Clicker 2 for dsPIC33 MCU Add On Board MIKROE-2567 144-8343
1 Development Kit USB to UART Interface for use with CP2102N USB Bridge 184-0913
1 MikroElektronika MIKROE-1154 791-6485
1 Microchip Microstick II MCU Development Kit DM330013-2 749-6445
1 FTDI Chip USB to UART Cable for Raspberry Pi - TTL-232R-Rpi 767-6200
1 Parallax Inc, BoE Prototyping Shield for Arduino - 35000 781-3027
Engineer, PhD, lecturer, freelance technical writer, blogger & tweeter interested in robots, AI, planetary explorers and all things electronic. STEM ambassador. Designed, built and programmed my first microcomputer in 1976. Still learning, still building, still coding today.

Comments

[Comment was deleted]

September 10, 2020 08:33

Fantastic article! I am author of RoboForth and one thing I have observed is that new users who have never programmed anything before get on to Forth and RoboForth very quickly indeed and get robot motion within minutes. For programmers used to syntactic languages like C or Python Forth can seem to be a paradigm shift.

0 Votes

September 10, 2020 08:32

@ROBOTICS1 Thanks! A piece of 'raw' Forth code with its RPN format can be really intimidating to newcomers - especially without indents and copious comments. I found I really enjoyed not having all the padding of procedural calls and bracketed lists of parameters, once I'd got the hang of it. Forth must be unique in allowing an 'expert' to create a much simpler and intuitive programming language for specific applications such as your RoboForth.

September 10, 2020 08:33

Back in the day (late 80s) I used Forth on an embedded microcontroller from Zilog - the Z8681 family. It was cost effective and C compilers were not well supported for that family at the time.
I inherited the device on 2 physical platforms designed by Arcom Controls and they provided a version of Basic compiled on a Z80 CP/M based SBC for embedded programming.
Using Forth from MPEForth in Southampton, I could test and compile on a PC - the first machine was an Apricot 286 based machine. During the compile of less than 32K of code there was time to make a coffee!
Forth was a joy to write code - indeed "fun" in the words of its inventor Charles Moore. The PC interpreter made it possible to run, test and debug code before compilation. Another money saver for a small business.
Two memorable incidents stick in my mind:
1. The hours spent debugging some code which used the keyword "WITHIN" to return a flag if the a value was in range of 2 other values. It turned out that the interpreter and compiler treated the boundary values differently.
2. The upgrade to a 486DX PC. I pressed the enter key to start the compilation and began to stand up from my chair to make the coffee. By which time the prompt had re-appeared and the compilation was complete. No more coffee breaks.
Thanks for reminding me of those times with this project.

0 Votes

September 11, 2020 15:39

@gazak Back in the early 1980's if you wanted to develop a microcomputer for anything like 'real-time' operation your only option was to program in the assembly language of the particular chip being used. Nearly all were 8-bit, apart from the new-fangled 16-bit Intel 8086 and the rather more obscure National Semiconductor INS8900 PACE. You really needed a 16-bit micro to run C - and a lot of memory. Forth slotted perfectly into the world of embedded control until micros became powerful enough with more 'regular' instruction sets to run compiled C. Even so, Forth stayed around, being the language of choice for designers of long-range space probes until quite recently. In those days, Forth language software was available for most home computers, including the ZX81, Spectrum and BBC micro. I just loved being able to test out a line of code with the interpreter, and then compile it almost as fast as the source text file loaded. Ah, happy days!

Related Content

DesignSpark Electrical Logolinkedin