Real-Time Clock
The CT1820 has a real-time clock (RTC) that can be used to measure calendar date and time. The
RTCWrite
command is used set the RTC's date and time, and the
RTCRead
command is used to read the
RTC's current date and time.
RTCRead( )
Variable = RTCRead( address )
v
ariable
: The variable to which the result will be stored
a
ddress
: RTC's register address
The following details the format of the data retrieved from the RTC.
Address
BIT7
BIT6
BIT5
BIT4
BIT3 BIT2 BIT1 BIT0
Feature & Range
0
0
Seconds (10
1
)
Seconds (10
0
)
Seconds (0~59)
1
0
Minutes (10
1
)
Minutes (10
0
)
Minutes (0~59)
2
0
12/24 AM/PM Hours (10
1
)
Hours (10
0
)
Hours (0~23)
3
0
0
0
0
0
Day of the week
1~7
(1=Sun. ~ 7=Sat.)
4
0
0
Day (10
1
)
Day (10
0
)
Day (1~31)
5
Century
0
0
Month (10
1
)
Month (10
0
)
Month (1~12)
6
Year (10
1
)
Year (10
0
)
Year (0 ~ 99)
Address 0 stores the number of seconds in the RTC's current time. The data is stored as binary coded
decimal (BCD), so the first 4 bits store the 10
1
digit while the lower 4 bits store the 10
0
digit
Therefore, if address 0 stores the value 0001 0001
2
, then then the number of seconds is 11, not 17.
Displaying the value in hexadecimal, is one way to show the value in decimal as illustrated in the
example below.
A = RTCRead(0)
Debug Hex2 A,Cr
Comfile Technology, Inc
CT1820 User's Manual
35 Of 93
Содержание CUTOUCH CT1820
Страница 4: ...Chapter 1 Overview Comfile Technology Inc CT1820 User s Manual 4 Of 93 ...
Страница 7: ...The CT1820 s Appearance Comfile Technology Inc CT1820 User s Manual 7 Of 93 ...
Страница 8: ...Comfile Technology Inc CT1820 User s Manual 8 Of 93 ...
Страница 9: ...Comfile Technology Inc CT1820 User s Manual 9 Of 93 ...
Страница 12: ...Comfile Technology Inc CT1820 User s Manual 12 Of 93 ...
Страница 17: ...Comfile Technology Inc CT1820 User s Manual 17 Of 93 ...
Страница 19: ...Chapter 2 I O Comfile Technology Inc CT1820 User s Manual 19 Of 93 ...
Страница 29: ...Comfile Technology Inc CT1820 User s Manual 29 Of 93 ...
Страница 32: ...Chapter 3 Command Reference Comfile Technology Inc CT1820 User s Manual 32 Of 93 ...
Страница 41: ...Chapter 4 Touch Input Comfile Technology Inc CT1820 User s Manual 41 Of 93 ...
Страница 52: ...Chapter 5 ModPort I O Expansion Comfile Technology Inc CT1820 User s Manual 52 Of 93 ...
Страница 61: ...Chapter 6 Sample Programs Comfile Technology Inc CT1820 User s Manual 61 Of 93 ...
Страница 87: ...Chapter 7 Panel Mounting Comfile Technology Inc CT1820 User s Manual 87 Of 93 ...
Страница 88: ...Dimensions Comfile Technology Inc CT1820 User s Manual 88 Of 93 ...
Страница 89: ...Comfile Technology Inc CT1820 User s Manual 89 Of 93 ...
Страница 90: ...Panel Cutout Comfile Technology Inc CT1820 User s Manual 90 Of 93 ...