To use this file copy and paste this:
// #URL-lib "http://pin1.org/forthlib/flb/I2C/bv4237.flb" into BV Terminal 3
or here to download.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// BV4237
// This is an unusual device in that it has 3 I2C devices on the PCB
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// 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
&90 constant temperature
&d0 constant rt-clock
Full Contents of File
&90  constant  temperature
&d0  constant  rt-clock
: a1  device  s  1  sb  sb  p  ;   
: a2  device  s  2  sb   
                start  2  *  sb
                device  1+  rs
                rn  &100  *  rl  +  p
;
: a2x  device  s  2  sb  0  sb 
                device  1+  rs
                cr
                4  for
                        rn  &100  *  rn  +  .
                next       
                rn  &100  *  rl  +  .  p
;
: a3  device  s  3  sb  sb  p  ; 
: a4  device  s  4  sb  sb  p  ; 
: a5  device  s  5  sb  sb  p  ; 
: a6  device  s  6  sb  sb  p  ; 
                     
: a11  device  s  &11  sb  sb  p  ; 
: a12  device  s  &12  sb  sb  p  ; 
: a13  device  s  &13  sb  sb  p  ; 
: a14  device  s  &14  sb  sb  p  ; 
: a15  device  s  &15  sb  sb  p  ; 
: a16  device  s  &16  sb  sb  p  ; 
: a17  device  s  &17  sb  sb  p  ; 
: a18  device  s  &18  sb  sb  p  ; 
: a19  device  s  &19  sb  sb  p  ; 
: 4237-default&62  bv-init  i2cfull  ;
: adc-all 
        4237-default  0=  if  ."  4237  cant  start  "  abort  then
        begin
                key?  if  abort  then
                a2x
                500  ms
        again
;
: jj
        4237-default  0=  if  ."  4237  cant  start  "  abort  then
        255  a19
        7  a11
;
       
: get-temp
        temperature  s  0  sb  temperature  1+  rs  rn  rl  p
;
: temp.
        get-temp
        swap  .  [char]  .  emit
        &80  =  if  48  else  53  then 
        emit
;
         
: rtc-pd
        rt-clock  s  &0c  sb  0  sb  p 
;
: rtc.
        rt-clock  s  1  sb  rt-clock  1+  rs  rn  rn  rl  p
        ph.  ."  :"  ph.  ."  :"  ph.
;
: rt-settime
        rt-clock  s  0  sb 
        0  sb  secs  sb  mins  sb  hrs  sb  p 
;
: rt-setdate
        rt-clock  s  4  sb 
        dow  sb  date  sb  month  sb  year  sb  p
;