Since reading the Hack-A-Day article on AmForth I knew I had to try running
Forth on an Arduino. Thanks to the good folks on this mailing list I
quickly got AmForth up and running on an Arduino Uno board and started to
look around for a project to use this technology on. I hadn't used Forth in
years but have a fondness for it that is hard to explain. I had previously
used Forth at JPL for testing of the Galileo spacecraft data system, at
Rolm for testing PBX's and PBX components and a little at Sun Microsystems
which used Forth as a bootloader for most of their Solaris based computers.

I decided to use AmForth to build a device driver and graphics library for
a Sainsmart 3.2" LCD display that I previously used on another project (see
the Contemplator article in Nuts and Volts magazine Dec 2012). In the hope
this code might be useful to the Forth community I have made the code
freely available here:

http://www.craigandheather.net/misc/Lindley_AmForth_LCD_Driver.zip

You are welcome to use this code anyway you want. If you use it for a cool
project I would like to hear about it. My email address is: cal...@gmail.com
.

This code runs only an an Arduino Uno but could be easily modified to run
on other Arduino's. To use the this LCD display with an Arduino Uno
requires soldering 24 wires between the boards. Also, because the 16 bit
interface used between the boards requires every I/O pin the Arduino Uno
has, the touch screen controller and the memory card interface on the LCD
display are unavailable.

The code consists of the following files four Forth files:

ssd1289.frt
   This is a device driver for the display which uses the ssd1289 LCD
controller chip

ssd1289Graphics.frt
  This is the graphics library with functions for drawing: pixels,
horizontal lines, vertical lines,
  regular lines, rectangles, filled rectangles, circles and filled circles

utils.frt
  This file contains various functions for case statements, random numbers,
sin function and various
  color space conversion and color palette functions.

demo.frt
  This file contains various demos of the graphics functions.
  Run the "demo" word to see all of the graphic examples

You must have postpone.frt and marker.frt loaded before attempting to load
the above files. Also, the files must be loaded in the order shown.

This code works well except for flickering when doing a lot of display
updates. I will be looking into this issue and will update the zip file
with any changes I make.

NOTE: my Forth skills are a bit rusty so some of the code is sub optimal.
If any of you rewrite the code, please send me the changes.

Enjoy,

Craig Lindley


-- 
Craig Lindley

If you’re one in a million, there are now seven thousand people exactly
like you.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to