RTC

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
RTC GETTIME
RTC SETTIME year, month, day, hour, minute, second
RTC SETREG reg, value
RTC GETREG reg, var

Description:

RTC GETTIME will get the current date/time from a PCF8563, DS1307, DS3231 or DS3232 real time clock and set the internal MMBasic clock accordingly. 
The date/time can then be retrieved with the DATE$ and TIME$ functions.

RTC SETTIME will set the time in the clock chip. 'hour' must use 24 hour notation. 
On the Micromite Plus the RTC SETTIME command will also accept a single string argument in the format of dd/mm/yy hh:mm. 
This means the date/time could be entered by the user using a GUI FORMATBOX with the DATETIME2 format.


The RTC SETREG and GETREG commands can be used to set or read the contents of registers within the chip. 
'reg' is the register's number, 
'value' is the number to store in the register and 
var' is a variable that will receive the number read from the register. 
These commands are not necessary for normal operation but they can be used to manipulate special features of the chip (alarms, output signals, etc). 
They are also useful for storing temporary information in the chip's battery backed RAM.
These chips are I2C devices and must be connected to the two I2C pins with appropriate pullup resistors. 
If the I2C bus is already open the RTC command will use the current settings, otherwise it will temporarily open the connection with a speed of 100 kHz.

 

Last edited: 29 September, 2020