Run Forth On The Raspberry Pi Pico / Mecrisp

preview_player
Показать описание
This video will describe how to load and run Mecrisp Forth on the Raspberry Pi Pico microcontroller. As an introduction, simple programs involving the GPIO and ADC will be covered.

Mecrisp Forth:

Mecrisp Word List:

ReadMe:
Рекомендации по теме
Комментарии
Автор

Thank you Ken for all you do with these videos! Sometimes it's frustrating that all of the code isn't presented, but it's also so much more rewarding when I finally start to figure it out using the data sheets and the references that you suggest. I'm aware of forth for microcontrollers because of you and I thank you for presenting it to us.

joerit
Автор

...great video. C and MicroPython cannot compete with FORTH on microcontrollers. And you sir will have been among those few responsible for having started a renaissance of microFORTH!

PerScientiaAdAstra
Автор

Nice video ! very well explained. Forth has a few features that make programming fun, thanks!

_Est
Автор

Oh my. So short a video! I was enthralled for the whole time. I have not used Forth for, well since, I bought a PC in the late '80s. It must have been Forth79 come to think of it. Wonderful language, I believe the Z80 was idealy suited to it because of its command set. I just have to do a bit of searching around now.
Many thanks.

jamesgoacher
Автор

Just what I had been hoping for. Thanks!

gregt
Автор

In the rp2040-ra directory of the Mecrisp Stellaris distribution is a file "playground.4th" included, which implements some of the words used in this tutorial. Maybe a good entry point to play around with it.

computermuseumvisselhovede
Автор

Excellent ! This was the video I was hoping for too !

ShellacScrubber
Автор

Thank you very much 0033mer another great forth video

harnaikhothi
Автор

I'm curious as to why the USB connector on the Pico can't be used to access the Forth command prompt. I've only used CircuitPython on the Pico, but print() statements go through the USB connection.

JonMcPhalen
Автор

I'm really happy with 0033mer's video about Forth on the pico and I want to say thank you to him for his post. Forth is an excellent language for controller programming because it is very close to assembly language and higher programming languages. My use of Forth dates back to the ZX81, Spectrum and QL, I suppose things have changed in the meantime.
As indicated I have connected my pico to my Linux computer with an ftdi. I am running Moserial Terminal on my computer.
To only use 1 instead of 2 usb ports such as 0033m34, I feed the pico from the FTDI with 5v on pin 40.
Pico: FTDI cable 3.3 volts on data lines
GND - GND
GP0 (UART RX) <--TXD
GP1 (UART TX) --> RXD
PIN 40 - 5V
So far I was along and got the pico spinning in Forth, but that's where it stopped too. Like many others, I was disappointed that there was not more explanation for the words used. like ".pins" etc. how do you program them.
The ReadMe.txt says

Three registers are enough to control the GPIO pins.
IN
OUT
DIR
I think this is only sufficient for very few beginners, so I write down what I discovered after a day of searching and sighing.
To light up the internal LED (=GPIO 25), you must first:
set pin 25 of the DIR (direction I suppose) register to HIGH, then
set pin 25 of the OUT register to HIGH.
to turn off the led, set pin 25 of the OUT register to LOW.
If you then want to make the LED light up again, you must apparently again set pin 25 of the DIR register back to HIGH.
A possible code looks like this:
1 25 lshift dup ! !
put 1 on the stack and shift it 25 times to the left,
copy the result and paste it back on the stack so that it is there twice
put the result in the DIR register
put the result in the OUT register
and the internal LED lights up.
to extinguish the LED it is sufficient to
0 !
0 in the OUT register

if you want to program Forth words it might look like this:
: intLedOn 1 25 lshift dup ! ! ;
: intLedOff 1 25 lshift ! 0 ! ;
type intLedOn and the led will go ON
type intLedOff and the led will go OUT
This is of course just the beginning and I expect that by reading bits into the IN register we can tell if an INPUT is HOGH or LOW. But I have not tested this and I have no idea how to program PULLUP, PULLDOWN FLOATING.
Maybe one of you can add some of the puzzle pieces

fotogordon
Автор

The words you created look very useful to anyone using Mecrisp Forth on the Pico. It is unfortunate you don't have them documented. Otherwise nice video.

lenreinhart
Автор

Curious about your word 'many'. Forced me to learn ZeptoForth internals. I came up with :
many ( -- )
BEGIN
input input# @ 5 - evaluate
key? UNTIL
;

Very handy when using a XE-703S Oscilloscope Multimeter when away from the lab. Belated thanks getting me started in Forth.

terrywillis
Автор

This is very exiting! I've got to have a go.

noscreadur
Автор

Hi, is it possible to reduce baud rate communication ? for example 38400 bauds (not 115200), thanks very much !

_Est
Автор

thank you for the video, i loaded mecrisp-stellaris-pico.uf2 it runs, and after word "reset" i became the same message as shown in the video. but the words .pins and .inputs are not there !??? normal forth commands like 3 2 * . runs very well. If there a differnt .uf2 file wird more words? i dont know the next steps....

herrmanngroteloh
Автор

I understood everything from 0:00 - 0:35, but then from 0:35 I have a questions. Do I need that extra module to execute forth programs on the pico, or is that for the benefit of the interactive Forth session? If I'm looking to purchase one, what do I need to search for generally? Just an FTDI module?

Also, 5:08 Is it difficult to get that terminal setup?

NoahNobody
Автор

Where can I find the file FL.FTH mentioned in RP2040.FTH ?

theelmonk
Автор

hello, can I use that forth version for own projects or it is a licensed version and if so which one ? (no commercial use but public share)

francoisp
Автор

Is it possible to use 2nd RP core? You're experienced Forther, can you make a video about multiprocessing in Forth?

alexloktionoff
Автор

Thank you for the video. Where do I find the file with the .pins and other words please? I downloaded 2.5.9 and there is no such file in the entire unpacked list of files.

seancharles