MSP430 FR6989 LaunchPad

The MSP430 FR6989 LaunchPad is based on the MSP430FR6989 running at 16 MHz, and it provides 128 Kbytes of FRAM, and an LCD display. The FRAM can be used as SRAM, so uLisp uses it for the workspace. The FRAM is also used for save-image and load-image:

FR6989.jpg

The MSP430 version of uLisp contains a command to allow you to write text to the LCD display; see below.

The SD card interface is not currently supported on the MSP430 boards.

LEDs

The MSP430 FR5994 LaunchPad has red and green LEDs connected to the digital pins 43 and 44 respectively, which you can flash alternately with the following program:

(defun blink (x)
  (pinmode 43 t)
  (pinmode 44 t)
  (digitalwrite 43 x)
  (digitalwrite 44 (not x))
  (delay 1000)
  (blink (not x)))

Run it by typing:

(blink t)

Push buttons

The MSP430 FR5994 LaunchPad has push buttons connected to the digital pins 45 and 46; you can print their status with the following program:

(defun buttons ()
  (pinmode 45 2)
  (pinmode 46 2)
  (loop 
   (print
    (list (digitalread 45) (digitalread 46)))
   (delay 500)))

LCD display

You can print text and digits to the LCD display using the additional uLisp command with-lcd. It takes a single variable which is used to refer to the LCD display character stream, like with-sd-card. You can then use any of the printing commands, such as princ, write-byte, and write-string, to write to the display.

For example, to display the text Hello execute:

(with-lcd (str) (terpri str) (princ "uLISP" str))

The (terpri) command writes a newline character, which clears the display and resets the print position to the leftmost character position.

Stopwatch

Here's a simple stopwatch program that counts up on the LCD display, in seconds:

(defun stopwatch ()
  (let ((time 0))
    (loop
      (for-millis (1000)
        (let ((s (princ-to-string time)))
          (with-lcd (str)
            (terpri str)
            (dotimes (n (- 6 (length s))) (princ #\Space str))
            (princ s str)))
        (incf time)))))