To use this file copy and paste this:
// #URL-lib "http://pin1.org/forthlib/flb/General/rtc.flb" into BV Terminal 3
or here to download.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// RTC (Real Time Clock) The RTC is built into the BV511, other
// LPC range of processors may also have a RTC but may not have
// the 32kHz crystal to drive it. In this case it is driven from
// the CPU crystal, hence there are two methods of starting the clock
// on the BV511, once the clock is started it will keep going provided
// there is a battery in place.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// HISTORY:
// March 2008 * rtc.dow added
// REQUIRES:
// #URL-lib "http://pin1.org/forthlib/flb/General/soft1.flb"
//
// CONSTANTS:
// RTC constants, not all of these are used for
// words in this module.
&e0024004 constant CTC
&e0024008 constant CCR
&e002400c constant CIIR
&e0024010 constant AMR
&e0024014 constant CTIME0
&e0024018 constant CTIME1
&e002401c constant CTIME2
&e0024020 constant SEC
&e0024024 constant MINUTE
&e0024028 constant HOUR
&e002402c constant DOM
&e0024030 constant DOW
&e0024034 constant DOY
&e0024038 constant MONTH
&e002403c constant YEAR
&e0024060 constant ALSEC
&e0024064 constant ALMIN
&e0024068 constant ALHOUR
&e002406c constant ALDOM
&e0024070 constant ALDOW
&e0024074 constant ALDOY
&e0024078 constant ALMON
&e002407c constant ALYEAR
&e0024080 constant PREINT
&e0024084 constant PREFRAC
Full Contents of File
&e0024004  constant  CTC
&e0024008  constant  CCR
&e002400c  constant  CIIR
&e0024010  constant  AMR
&e0024014  constant  CTIME0
&e0024018  constant  CTIME1
&e002401c  constant  CTIME2
&e0024020  constant  SEC
&e0024024  constant  MINUTE
&e0024028  constant  HOUR
&e002402c  constant  DOM
&e0024030  constant  DOW
&e0024034  constant  DOY
&e0024038  constant  MONTH
&e002403c  constant  YEAR
&e0024060  constant  ALSEC
&e0024064  constant  ALMIN
&e0024068  constant  ALHOUR
&e002406c  constant  ALDOM
&e0024070  constant  ALDOW
&e0024074  constant  ALDOY
&e0024078  constant  ALMON
&e002407c  constant  ALYEAR
&e0024080  constant  PREINT
&e0024084  constant  PREFRAC
: set&11  ccr  !  ;
: 1set
pclk                       
32768  u
preint  !
prefrac  !
1  CCR  !             
;
: TICKctc  @  ;
: date
dom  @  <#  #  #  #>  stype  47  emit
month  @  <#  #  #  #>  stype  47  emit
year  @  <#  #  #  #>  stype 
space
hour  @  <#  #  #  #>  stype  58  emit
minute  @  <#  #  #  #>  stype  58  emit
sec  @  <#  #  #  #>  stype
space
;
: <0>rtc.startset  ;   
: <0>trc.tick  tick  ;
: <0>rtc.settime  SEC  !  MINUTE  !  HOUR  !  ;
: <0>rtc.setdate  DOM  !  MONTH  !  YEAR  !  ;
: <0>rtc.date.  date  ;
: <0>rtc.date  year  @  month  @  dom  @  ;
: <0>rtc.time  hour  @  minute  @  sec  @  ;
: <0>rtc.clock?  tick  5  ms  tick  <>  ; 
: <0>rtc.dow  DOW  ;