To use this file copy and paste this:
// #URL-lib "http://pin1.org/forthlib/flb/I2C/BV4218.fth" 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 simple demonstration thst will check the keypad and
// then add 2 numbers together. It has been designed for a 2 x 16 line
// display but should work with lareger displays.
// The technique used here is to extend the BV4218 library with a SID
// of 102 and then only make the wotd GO public.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// REQUIRES:
// #URL-lib "http://pin1.org/forthlib/flb/General/soft1.flb"
// #URL-lib "http://pin1.org/forthlib/flb/General/pinsel.flb" sid=100
// #URL-Lib "http://pin1.org/forthlib/flb/I2C/i2c.flb" sid=101
// #URL-inc "http://pin1.org/forthlib/flb/I2C/BV4218.flb" sid=102
// CONSTANTS:
// none
Full Contents of File
: l2-dl2  5  ms  ; 
: lh-dlh  5  ms  ; 
: l2n  &c0  +  LCDcmd  5  ms  ; 
: msg1s"  BV4128  Demo"  stype2  ;
: msg2s"  Display  &  Keypad"  stype2  ;
: msg3s"  Enter  2  values"  stype2  ;
: msg4s"  #  is  enter  key"  stype2  ;
: key-wait
    begin
        key?  abort"  terminal  key  pressed"
        kn   
        1  ms   
    until
    kg       
;
: keypadset?
    lc  s"  Press  the  #  key"  stype2
    kc   
    key-wait
    11  =
;       
: setkeypad
    keypadset?  invert
    if
        lc  s"  keys  need  seting" 
        1000  ms
        key-map-l
    then 
;       
: get-number
    0         
    begin
        key-wait   
        dup  11  =  if  drop  escape  then 
        dup  ln       
        swap  10  *       
        +                 
    again
;       
: signon
    66  lcd-init       
    0  blight       
    lc  msg1  l2-d  msg2   
    2000  ms
;
: <0>go
    signon
    setkeypad     
    lc  msg3  l2-d  msg4  2000  ms 
   
    lc  s"  First  Value"  stype2 
    l2-d  s"  *  "  stype2  get-number 
   
    lh-d   
    s"  Second  Value"  stype2 
    6  l2n   
    s"  *  "  stype2  get-number   
    12  l2n 
    s"  =  "  stype2  +  ln   
;