User Tools

Site Tools



RTCRead( )

variable = RTCRead( address )

variable variable to store the result (Byte type)
address RTC’s address

If you see the address table of RTC chip (DS3231) below, you will notice that the time data are stored from addresses 0 through 6. The rest of the addresses are related to the alarm and RTC chipsetting; thus, we recommend those interested to refer to the DS3231 databook.

RTCRead command literally reads data from the RTC chip.

To use CB405RT, in the beginning of the program, one must replace Const Device = CB405 with #Include “CB405RT”.

#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
 i = RTCread(0)
 Debug Goxy,1,1,Hex2 i, " Sec"
 i = RTCread(1)
 Debug Goxy,1,2,Hex2 i, " Min"
 i = RTCread(2) And &h3f
 Debug Goxy,1,3,Hex2 i, " Hour"
 i = RTCread(3)
 Debug Goxy,1,4,Hex2 i, " Day"
 i = RTCread(4)
 Debug Goxy,1,5,Hex2 i, " Date"
 i = RTCread(5)
 Debug Goxy,1,6,Hex2 i, " Month"
 i = RTCread(6)
 Debug Goxy,1,7,Hex2 i, " Year"
 Wait 500

When the above example program is executed, the following debug window will appear

CB405RT-Related Commands

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