This article describes a self-contained computer with its own display and keyboard, based on an ATmega328, that you can program in Lisp. You can use it to run programs that interface to components such as LEDs and push-buttons via the I/O pins, read the analogue inputs, and operate external devices via the I2C and SPI interfaces. It has a small monochrome OLED display that gives 8 lines of 21 characters per line, and a miniature PS/2 keyboard:
Tiny Lisp Computer – Specification
Display: 21 characters x 8 lines.
Memory available: 316 Lisp cells (1264 bytes).
EEPROM: 256 Lisp cells (1K bytes).
Language: u Lisp, a subset of Common Lisp, with 122 Lisp functions and special forms. For a full definition see u Lisp Language Reference.
Types supported: list, symbol, and integer.
An integer is a sequence of digits, optionally prefixed with “+” or “-“. Integers can be between -32768 and 32767. You can enter numbers in hexadecimal, octal, or binary with the notations #x2A, #o52, or #b101010, all of which represent 42.
User-defined symbol names can have up to three characters consisting of a-z and 0-9. Any sequence that isn’t an integer can be used as a symbol; so, for example, 12a is a valid symbol.
There is one namespace for functions and variables; in other words, you cannot use the same name for a function and a variable.
Includes a mark and sweep garbage collector. Garbage collection takes under 1 msec.
- Analogue input using analog read: A0 to A5 (14 to 19)
- Analogue output using analog write: 3, 9, 10, 11
- Digital input and output using pin mode, digital read, and digital write: 0, 1, 3, 9 to 13, A0 to A5 (14 to 19)
- I2C using with-i2c and restart-i2c: A4 and A5
- SPI using with-spi: 11, 12, 13
As on an Arduino Uno, pin 13 is connected to an LED.
The computer is programmed in u Lisp, my compact Lisp interpreter for the Arduino. This allows you to control the I/O ports directly, access I2C and SPI peripherals, and write small programs to automate functions. You can also save programs to EEPROM so they are retained when the power is disconnected, and they can be configured to run automatically on restart.
are retained when the power is disconnected, and they can be configured to run automatically on restart.
Read More: Tiny Lisp Computer