^23 - The Real Time Clock Port

This port is a read only value of the current time or date from the timeclock on the device. You can retrieve hours, minutes, seconds, date, day of week, or year.
The value is in Binary Coded Decimal(BCD), a hexadecimal value that is the same as visually as the decimal. Ex. 11 is displayed as 0x11 even though technically that would be decimal 17.

When working with BCD values SUB #6 whenever decimal tens digit increases to convert to decimal.

Syntax

LDA ^23,x
Where x is the subport you want to retrieve.

^23 Real Time Clock subports

SubPort

Description

^23,0

Seconds

^23,1

Minutes

^23,2

Hours

^23,3

Date

^23,4

Month

^23,5

Day of the week (Sunday-Saturday)

^23,6

Year (last two digits)

Examples

Task1()
{
Name="check time and send preset"
start(a=200,p=1)
LDA ^23,5         //Check current day of the week
CMP #1            //Is it Sunday?
BRZ Weekend       //Then branch to labelweekend
CMP #7            //Is it Saturday?
BRZ Weekend       //Then branch to labelweekend. If not assume weekday
LDA ^23,2         //Read current time in hours
BRZ Midnight
CMP #0x01
BRZ OneAm
CMP #0x02
BRZ TwoAm
CMP #0x03
BRZ ThreeAm
CMP #0x04
BRZ FourAm
CMP #0x05
BRZ FiveAm
CMP #0x06
BRZ SixAm
CMP #0x07
BRZ SevenAm
CMP #0x08
BRZ EightAm
CMP #0x09
BRZ NineAm
CMP #0x10
BRZ TenAm
...
}

Examples

Working with BCD.

Task1()
{
Name="convert BCD to decimal"
LDA ^23,1           //Read current minute
CMP #11             //Is it less than 11?
BRC StoreDecimal
SUB #6              //Remove a-f of the hex values
CMP #21             //Is it less than 21?
BRC StoreDecimal
SUB #6              //Remove a-f of the hex values
CMP #31             //Is it less than 31?
BRC StoreDecimal
SUB #6              //Remove a-f of the hex values
CMP #41             //Is it less than 41?
BRC StoreDecimal
SUB #6              //Remove a-f of the hex values
CMP #51             //Is it less than 51?
BRC StoreDecimal
SUB #6              //Remove a-f of the hex values
StoreDecimal:
    STA ~10         //Store the decimal minute value into memory.
    Null
}