The RetroMax Real Time Clock

The RetroMax (version 1.4a+) has an on-board Real Time Clock (RTC). This is a Maxim Integrated (was at one time Dallas Semiconductor) DS3231M. Although the core microcontroller of the RetroMax has RTC capability, the DS3231M offers some additional features.

The accuracy of the DS3231M is ±5ppm (±0.432 Second/Day) from -45°C to +85°C The DS3231M has two programmable alarms and a 1Hz/32.768kHz output. There is also an internal temperature sensor with ±3°C accuracy.

The I2C bus of the RetroMax can be scanned for devices by sending out the device address sequentially and verifying that the device has responded to the address. In other words, code can say “Hey device #20” and then look for an answer back.

If the RetroMax sends out a device address and then looks at the MMBasic built-in variable called MM.I2C for a value of 0, then that device has said “hello” back when it was addressed. Very simple code below will scan the bus from address &H08 to address &H77 looking for devices. The address search range is limited to &H08 – &H77 by the RetroMax firmware. Output printed to serial console.

The DS3231M RTC of the RetroMax is located on I2C bus #1 (PB8 and PB9). The RetroMax has three I2C buses.

Code for setting time and date for the RetroMax RTC. Also, read of DS3231M temperature.