The address map of DS12887
- This has total of 128 bytes of RAM space with addresses 00-7Fh.
- The first 10 i.e. 00-09 are kept aside for RTC values of time, calendar and alarm data.
- The next 4 are control and status registers.
- The next 114 bytes from address 0E-7F are available for data storage.
- Register C and D are read only.
- The D7 of register A is read only.
- The high order bits of seconds byte are read only.
Address map
0 – 00h
|
Seconds
|
1 – 01h
|
Seconds alarm
|
2 – 02h
|
Minutes
|
3 – 03h
|
Minutes alarm
|
4 – 04h
|
Hours
|
5 – 05h
|
Hours alarm
|
6 – 06h
|
Day of week
|
7 – 07h
|
Day of month
|
8 – 08h
|
Month
|
9 – 09h
|
Year
|
10 – 0Ah
|
Register A
|
11 – 0Bh
|
Register B
|
12 – 0Ch
|
Register C
|
13 – 0Dh
|
Register D
|
Register A
UIP
|
DV2
|
DV1
|
DV0
|
RS3
|
RS2
|
RS1
|
RS0
|
UIP update in progress. This is a read only bit.
DV2 – 0
DV1 – 1
DV0 – 0
Will turn the oscillator on.
RS3,RS2,RS1,RS0 provides 14 different frequencies at the
SQW pin.
Value of register a will remain as..
0
|
0
|
1
|
0
|
0
|
0
|
0
|
0
|
A = 20h
Register B
SET
|
PIE
|
AIE
|
UIE
|
SQWE
|
DM
|
24/12
|
DSE
|
SET
|
SET =0; clock is counting once per
second and times and dates are updated.
SET =1; update is inhibited(during
initialization we must set SET=1)
|
PIE
|
Periodic interrupt enable
|
AIE
|
Alarm interrupt enable. The AIE=1
will allow the IRQ to be asserted, when all 3 bytes of time equals alarm
bytes. In short will raise an interrupt when time equals alarm time.
|
UIE
|
Don’t know so see the datasheet.
|
SQWE
|
Square wave enable.
|
DM
|
Data mode.
DM=0; for BCD data format.
DM=1; for binary(hex) data format.
|
24/12
|
1 for 24 hour mode
0 for 12 hour mode
|
DSE
|
Daylight saving enable.
1 enables daylight saving(first Sunday in april and last Sunday
in October)
0 disables daylight saving
|
So we will keep
the setting BCD data format. 24 hrs time, and daylight saving on.
Giving us the value of register.
1
|
0
|
0
|
0
|
0
|
0
|
1
|
1
|
B = 83h.
RTC DS12887 address location for time, calendar and
alarm.
Address Location
|
Function
|
Decimal range
|
Binary(hex)
|
BCD
|
0
|
Seconds
|
0-59
|
00-3B
|
00-59
|
1
|
Seconds alarm
|
0-59
|
00-3B
|
00-59
|
2
|
Minutes
|
0-59
|
00-3B
|
00-59
|
3
|
Minutes alarm
|
0-59
|
00-3B
|
00-59
|
4
|
Hours, 12 hour mode
|
1-12
|
01-0C AM
|
01-12 AM
|
|
Hours, 12 hour mode
|
1-12
|
81-8C PM
|
81-92 PM
|
|
Hours, 24 hour mode
|
0-23
|
0-17
|
0-23
|
5
|
Hours alarm, 12 hour
|
1-12
|
01-0C AM
|
01-12 AM
|
|
Hours alarm, 12 hour
|
1-12
|
81-8C PM
|
81-92 PM
|
|
Hours alarm, 24 hour
|
0-23
|
0-17
|
0-23
|
6
|
Days of the week SUN=1
|
1-7
|
01-07
|
01-07
|
7
|
Day of the month
|
1-31
|
01-1F
|
01-31
|
8
|
Month
|
1-12
|
01-0C
|
01-12
|
9
|
Year
|
0-99
|
00-63
|
00-99
|
one needs to remember above tables to write a program for RTC interfacing with 8051.
No comments:
Post a Comment