PicForth Quick Start Guide for Windows Users
A quick and painless way to get PicForth running under Windows
What is PicForth?
PicForth is a Forth compiler for Microchip's PIC16F87x microcontrollers. If
you've been programming PIC's in assembly and are now contemplating using
a high-level language to increase your productivity, PicForth is an excellent
choice. PicForth is open source, works well on Unix/Linux and on Windows
(and possibly a few others), compiles well optimized code, and gives
you lots of control. Among its virtues are two different cooperative
schedulers for multi-tasking, and an in-line assembler so you can fine tune
the critical parts of your application.
PicForth is written by Samuel Tardieu, and distributed under the terms of
- Download all of the following into a temporary directory:
- Install Gforth - Just run gforth-0.5.0.exe and accept all the defaults. It takes less than a minute.
- Rename the files "Makefile" and "COPYING" in "C:\Program Files\gforth" to "Makefile.gforth" and "COPYING.gforth", respectively. Then extract all the files from the picforth-1.2.4.tar.gz file (or whatever version
you got) into "C:\Program Files\gforth" . WinZip can do this. Probably some others
can too. If your browser added an extra ".tar" to the end of the file name,
(mine did) remove it or WinZip will get confused.
- Extract the file "Unix2dos.exe" from the UDDU.ZIP file that you downloaded into "C:\Program Files\gforth". WinZip
or any other unzipper will do the trick.
- Copy pfcompile.bat and blinkytest.fs into "C:\Program Files\gforth".
Take It For A Test Drive
You should now have a "blinkytest.hex" file ready to write to whatever
PIC16F87x series PIC that you happen to have handy. All it does is blink an
LED attached to PORTA bit 0, so it's very easy to breadboard it if you want
to see the program run in a real PIC.
- Open a dos prompt and make "C:\Program Files\gforth" the current directory.
- Type "pfcompile blinkytest" and press Enter.
Where To From Here?
That's all it takes to get to the point where you can turn PicForth source
files into programmed PICs (assuming you have a working PIC programmer). What remains, of course, is learning how to
write those source files. That is beyond the scope of this document, which
is only meant to help you get PicForth running under Windows with minimum fuss.
A good place to start is to take a look at the blinkytest.fs file to see what
a very simple PicForth program looks like. Blinking an LED is the PIC
equivalent of "Hello world!". After that, try these resources:
- Using PIC Forth
- This is a very brief and to-the-point intro to PIC Forth. This is a very good
place to begin.
- PicForth Wiki - Some good stuff here. The Argument Passing document is a good one to read early in your PicForth explorations.
- PicForth mailing list - Low traffic, but active. Very good signal to noise ratio.
- The documentation files (picforth.pdf and picforth.html) that come
with PicForth. PicForth is also supplied with a number of libraries and example programs to help you get started.
- General Forth books and documentation, including the Gforth
documentation. The PicForth documentation does not teach Forth programming in general. So unless you're already familiar with Forth, you'll need some outside information to really get going. If you can find a copy, Leo Brodie's "Starting Forth" book remains one of the best choices for learning Forth. It's out of print, but used ones are sometimes available through Amazon or Ebay.
| home | resume |