To use this file copy and paste this:
// #URL-lib "http://pin1.org/forthlib/flb/I2C/BV4218.flb" into BV Terminal 3
or here to download.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// BV4218 LCD + Keypad circuit board
// the same routines can be used for the BV4208 LCD, IC and
// the BV4207 keypad chip. This is a library file that can be
// extended using your own code. This file is intended as a library
// but can be used on its own for debugging purposes
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// HISTORY:
// Nov 2008 * changed deva to device
// * added new bvsys.flb library
// Dec 2008 * removed most delays following new 1.a version
// REQUIRES:
// #URL-lib "http://pin1.org/forthlib/flb/General/soft1.flb" sid=0
// #URL-lib "http://pin1.org/forthlib/flb/General/pinsel.flb" sid=101
// #URL-Lib "http://pin1.org/forthlib/flb/I2C/i2c.flb" sid=103
// #URL-Lib "http://pin1.org/forthlib/flb/I2C/bvsys.flb"
// CONSTANTS:
// device variable is in bvsys.lib
Full Contents of File
: LCDcmd  device  s  1  sb  sb    p  ; 
: LCDdata  device  s  2  sb  ;         
: LCDemit  device  s  2  sb  sb  p  ; 
: 4218-default  66  bv-init  ;
: stype2
        LCDdata                 
        addr  255  +         
        addr                     
        do
                i  c@  0= 
                if 
                        leave
                else
                        i  c@  sb         
                then
        next       
        p                 
        addr  length  for    next 
; 
: lc1  LCDcmd  2  ms  ;         
: lh2  LCDcmd    ;       
: l2&c0  LCDcmd  ;       
: ln  <#  #s  #>  stype2  ; 
: lco&e  LCDcmd  ; 
: lcf&c  LCDcmd  ; 
: blight  device  s  3  sb  sb  p  ; 
: start-m
        device  s  6  sb  device  1+  rs  rl  p         
        device  s  &91  sb  sb           
        string  dup  length  +  string
        do
                i  c@  sb         
        loop
        0  sb               
        p                     
;               
: kndevice  s  &10  sb  device  1+  rs  rl  p  ; 
: kg  device  s  &11  sb  device  1+  rs  rl  p  ;   
: kg#  device  s  &11  sb  device  1+  rs 
            1-  for  rn  next  rl  p  ;
: kd    device  s  &13  sb  device  1+  rs  rl  p  ; 
: kc    device  s  &14  sb  p  ;   
: ks  device  s  &15  sb  device  1+  rs  rl  p  ;   
: db@device  s  &90  sb  2  sb  device  1+  rs  rl  p  ; 
: db!device  s  &91  sb  2  sb  sb  p  ; 
: kbufdevice  s  &18  sb  device  1+  rs  15  for  rn  ph.  next  rl  ph.  p  ; 
: kmapdevice  s  &12  sb  device  1+  rs  rl  p  ;   
: key-map-t
        cr  ."  press  keys  in  turn  1,2,  etc."
        12  0 
        do
                cr  ."  press  key  "  i  .  space
                begin  50  ms  kn  until   
                kg           
                kmap  +   
                device  s  &91  sb  sb  i  sb  p     
                300  ms           
        loop
;               
: key-map-l
        4218-default  -1  <>  if  ."  Cant  start  4218"  abort  then
        lc  s"  press  keys  in"  stype2
        l2  s"  turn  1,2,  etc."  stype2
        2000  ms
        12  0
        do
                lc       
                s"  press  key  "  stype2  i  ln 
                begin  50  ms  kn  until   
                kg           
                kmap  +   
                device  s  &91  sb  sb  i  sb  p     
                300  ms           
        loop
        lc  s"  Keys  set"  stype2
;