LED programming language

For my LED sign project I made a new programming language called LED to simplify the creation of LED sign content.

The programming language is mixture of BASIC and Assembler made up of a few keywords, some variables, user definable characters/graphics and a display buffer which is automatically scanned and put on the sign’s display.

Variables available: letters A to Z each containing a value from 0 to 255 (8 bits) assign with:

  • LET var value

Loop constructs:

  • DO
  • ….
  • WHILE var

Condictional execution:

  • IF var
  • ….
  • ENDIF

Display synchronization:

  • WAIT num

Subroutines:

  • CALL label

Real time clock functions:

  • SECONDS num
  • MINUTES num
  • HOURS num
  • DATE num
  • MONTH num
  • YEAR num
  • TIMEAT var
  • DATEAT var
  • ONTIME label
  • ONDATE label

User defined characters/graphics (32 available character codes)

  • UDG code (0-31) followed by 6 bytes data in hex or decimal

Output function:

  • PRINTAT var string
  • OFFSET var

Movement functions:

  • SCROLL_UP
  • SCROLL_DOWN
  • SCROLL_LEFT
  • SCROLL_RIGHT

Logic functions:

  • AND var var
  • OR var var
  • XOR var var

Arithmetic functions:

  • ADD var var
  • SUB var var
  • INC var
  • DEC var

Display memory manipulation:

  • PEEK var address
  • POKE var address

Nested loops and IF/ENDIF are possible.

Labels are words directly followed by a colon:

  • my_subroutine:

Comments can be placed after // like

PRINTAT X “Hello world!”  // emit some text

 

Some sample code:

LET A 10   // assign 10 to variable A

PRINTAT A “Offset 10 pixels from the left”

WAIT 100  // wait for 100 screen refreshes

LET D 60   // assign 60 to D

DO  // start loop

SCROLL_LEFT  // move display left

WAIT 1  // wait for screen refresh

CALL mysubroutine  // call a subroutine

WHILE D // until D is zero

END

mysubroutine:

DEC D  // decrement D

RETURN

The tokenizer to create a binary for uploading to the sign is available in C and Java.

Leave a Reply

Your email address will not be published. Required fields are marked *