User Tools

Site Tools

한국어

cubloc:rtcwrite:index

RTCWrite

RTCWrite address, data

address RTC chip’s address
data the variable or constant to store

This command writes a new data value to the specified address of the RTC chip.

In other RTC chips, clock inaccuracies can occur due to temperature changes. The RTC chips, which work properly at room temperature, begin to tick abnormally as their crystals oscillations are affected by temperature. The DS3231 is an RTC chip that avoids such problems. It has a thermistor (i.e., a temperature sensor) along with a 32 KHz crystal. The oscillation frequency is adapted based on the temperature sensed by the thermistor. As a result, the crystal oscillations don’t fluctuate and the clock keeps better time.

But be aware that although the DS3231 keeps great time under varying temperatures, it is still not 100% perfect and should be verified for time critical applications.

#include "CB405RT"  ' Use "#include" instead of the "Const Device" statement.
Dim i As Integer
Wait 100
RTCwrite 0,&h20     ' Sec
RTCwrite 1,&h59     ' Min
RTCwrite 2,&h23     ' Hour 24h
RTCwrite 3,&h7      ' day 1-7, 1=Sun, 2=Mon, 3=Tue, 4=Wed, 5=Thu, 6=FRI, 7=SAT
RTCwrite 4,&h31     ' Date
RTCwrite 5,&h12     ' Month
RTCwrite 6,&h08     ' Year

CB405RT-Related Commands

cubloc/rtcwrite/index.txt · Last modified: 2016/04/14 11:07 (external edit)