Skip to content

Example code on how to connect a HD44780 or compatible LCD display to an amForth powered device

License

Notifications You must be signed in to change notification settings

ralfdoering/forthlcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

forthlcd

Example code on how to connect a HD44780 or compatible LCD display to an amForth powered device

This is my first attempt on writing Forth code to interface an HD44780 based LCD to an Arduino running AmForth. For now, the pin setup is hardwired to the scheme shown below, but this will be changed in a future version. The code is tested with AmForth 5.7, the Forth kernel is build with the following dict_appl.inc:

; this dictionary contains optional words
; they may be moved to the core dictionary if needed

.include "dict/compiler2.inc" ; additional words for the compiler
.include "words/applturnkey.asm"

;; provide .s for interactive debugging
.include "words/dot-s.asm"

;; the following are needed to get the LCD code running
.include "words/edefer.asm"
.include "words/ms.asm"

Origin

The base ideas for the forth code came from an article at http://www.mikrocontroller.net. I just adapted their assembler code to Forth.

Hardware setup

The LCD will work in 4bit mode, with the following connections:

Display Pin Atmega Pin Arduino Name
D7 PD7 Digital 7
D6 PD6 Digital 6
D5 PD5 Digital 5
D4 PD4 Digital 4
Enable (E) PD3 Digital 3
RS PD2 Digital 2

About

Example code on how to connect a HD44780 or compatible LCD display to an amForth powered device

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages