Accessing the RTC

140 views
Skip to first unread message

Charley Jones

unread,
Jul 17, 2019, 1:02:44 PM7/17/19
to uKenbak-1
Are there a concise set of institutions for accessing and using the RTC?

Mark Wilson

unread,
Jul 17, 2019, 3:13:26 PM7/17/19
to uken...@googlegroups.com


Load an index (see below) into register A. 
Set A's high bit to write the value of register B to the RTC, clear A's high bit to read the RTC value into register B.
Execute the 0360 NOOP/System Extension instruction to perform the write/read.
The RTC values (the hour, minute etc) are BCD

Indices are
000: Seconds (00..59)
001: Minutes (00..59)
002: Hours (00..23) (always 24-hr)
003: Day (01..07)
004: Date (01..31)
005: Month (01..12)
006: Year (00..99)
007: Control

Charley Jones

unread,
Oct 9, 2019, 5:24:12 PM10/9/19
to uKenbak-1
Der: RTFM!  (To Myself!)

I think it's time to update my rom...

"Clocks", these use System extensions to try to do something useful with the
Kenbak-uino.  Note that they all display the time in 12-hour format with no
AM-PM indicator:
---Count Clock:
Alternates between showing the hours and the minutes.  The Control LEDs are
turned off.  The hours are displayed thus
  P_ HHH HHH
The number of H's is the hour, plus 6 if P is lit.  Thus (where '*' denotes
a lit LED & '_' unlit)
  -- --* *** is 4 O'Clock
  *- --- *** is 9 O'Clock etc
The minutes are displayed thus
  B_ MMM MMM
The number of M's is the minutes times 10.  If the leftmost lit M is blinking,
it means +5 minutes.  B is always blinking.  Thus (where '!' denotes a
blinking LED)
  !- --* *** is 40 minutes after the hour
  !- --- !** is 25 minutes after the hour
This is the easiest clock to actually read the time.
---BCD Clock
Scrolls back and forth between showing the hours and the minutes in BCD. The
minutes display has the leftmost (b7) LED blinking.  The Control LEDs are
turned off. Thus
  -- --- *-- is 4 O'Clock
  -- -*- -*- is 12 O'Clock
  !- *-- --* is 21 minutes after the hour
  !* -*- *-* is 55 minutes after the hour
---Binary Clock
Shows the time in binary.  The minutes are shown on the Data LEDs with the
leftmost (b7) LED blinking.  The hours are shown on the Conrol LEDs.  Thus
  !- -*- *-*  * - - * is 9:21
  !- **- ***  * * - - is 12:55
---Set Clock
This sets the time: the hours (BCD, 24-hour format) are in A, the minutes
(BCD) are in B.

Michael Uhlmann

unread,
Feb 20, 2020, 10:26:00 AM2/20/20
to uKenbak-1

IMG_1527.JPG

the time is set in 24h format, can it also displayed in 24h? I would like the BCD-clock shows the 24h time on my added display
Michael

Mark Wilson

unread,
Feb 20, 2020, 1:38:40 PM2/20/20
to uKenbak-1
Nice looking build!  What does the 7-segment display do?

To show in 24-hour mode you'd need to change the BCD clock program.
This is assembled in Programs::AssembleBCDClock in Programs.cpp in the sketch.  My guess is removing these three lines (269-271) would do it:

op2(SUAc, 12) // A -=12
op2(0272, REG_A_IDX) // skip if b7 clear
op2(LDAa, lbl(Display)) // reload A (hr)

But I'm away from my Kenbak at the moment :-)
Ah, you would also need to alter the bin-BCD lookup table at the end.
Change
def(HrBCDTab)
   equ(0x12) // 12

to
def(HrBCDTab)
   equ(0x00) // 00

And extend
equ(0x11) // 11

to
equ(0x11) // 11
equ(0x12)
equ(0x13)
equ(0x14)
equ(0x15)
equ(0x16)
equ(0x17)
equ(0x18)
equ(0x19)
equ(0x20)
equ(0x21)
equ(0x22)
equ(0x23)
That table was an easy shortcut at the time but now it's looking pretty gross (24 bytes!). Should be done in code.
I might investigate further this weekend, unless you're keen,

M

Mark Wilson

unread,
Feb 20, 2020, 2:10:53 PM2/20/20
to uKenbak-1
Wait, forget that.  The changes should be even simpler, almost trivial since the hour comes from the RTC in already BCD form!
Details to follow.  I should do some work...
 


 

Mark Wilson

unread,
Feb 21, 2020, 4:03:04 AM2/21/20
to uKenbak-1
OK, done.  See attached txt file with two versions of the 24-hour mode version of
void Programs::AssembleBCDClock(byte* pMem)

The first version is just the original but showing the hour in 24h BCD format.
As requested by Michael, the second version is 24h but the LED which blinks when showing the minutes is RUN rather than Bit7.
To pick a different control LED, see the equ() at label BlinkLEDMask, right at the end.
The file includes binary versions too.

I won't update the github sketch, too messy, but I'll eventually add the text file as an addendum.
Let me know how it goes.

cheers and goodnight,
Mark


 
 
24hourBCDclocks.txt

Michael Uhlmann

unread,
Feb 24, 2020, 3:21:25 AM2/24/20
to uKenbak-1

Thanks to Mark for helping me to realise my wishes.
Now the BCD Clock shows the hour in 24h-format and the address-LED lights when displaying hours and the run-LED blinks when displaying minutes.
Also the time is shown on my added 2-digits hex-display
regards Michael
09:03 clock

IMG_1529.JPG

IMG_1530.JPG



Reply all
Reply to author
Forward
0 new messages