DS1216E-3 [MAXIM]
Real Time Clock, Non-Volatile, 0 Timer(s), CMOS, PDIP28, 0.600 INCH, SOCKET TYPE, DIP-28;![DS1216E-3](http://pdffile.icpdf.com/pdf2/p00224/img/icpdf/DS1216E-3_1309597_icpdf.jpg)
型号: | DS1216E-3 |
厂家: | ![]() |
描述: | Real Time Clock, Non-Volatile, 0 Timer(s), CMOS, PDIP28, 0.600 INCH, SOCKET TYPE, DIP-28 光电二极管 外围集成电路 |
文件: | 总6页 (文件大小:64K) |
中文: | 中文翻译 | 下载: | 下载PDF数据表文档文件 |
![](http://public.icpdf.com/style/img/ads.jpg)
Application Note 509
Using the SmartWatch/Phantom
Clocks with a Microcontroller
www.maxim-ic.com
PIN ASSIGNMENT
RST 1
28 VCC
27 WE
2
3
26 VCC
B
4
25
5
6
24
23
7
22 OE
21
[A2]
8
9
20 CE
[A0] 10
DQ0 11
19
18
12
13
17
16
GND 14
15
DS1216B/C/D/E
28-Pin Intelligent Socket
DESCRIPTION
The Phantom clocks and SmartWatch sockets provide battery-backed NV SRAM or NV SRAM control,
respectively, and add timekeeping information. The timekeeping data is accessed without using any of the
SRAM data space. Access of the timekeeping data is accomplished by writing a unique 64-bit sequence
to the controller. The controller then inhibits access to the SRAM for the next 64 reads or writes.
In this example, a DS1216C, DS1216E, DS1243Y, or DS1244Y is connected to a DS2250. The DS2250
microcontroller is compatible with the industry standard 8051 architecture. Larger densities could be
supported by using bank-switching techniques. Some memory expansion techniques are discussed in
Application Note 81, “Memory Expansion with the High-Speed Microcontroller Family.”
A SmartWatch/Phantom Clock schematic of the circuit is shown on page 2. Software is shown on page 3.
1 of 6
052802
1
2
3
4
5
6
U5
KS
VCC
18
17
22
21
13
23
SQW
IRQ
DS/RD
19 IRQb
1
RD
C4
0.1uF
GND
CS_RTCb
VBAUX PWR
RCLR
CS
ALE
WR
AD7
NC
4
5
6
7
8
9
AD0
AD1
AD2
AD3
AD4
AD5
AD0
AD1
AD2
AD3
AD4
AD5
AD6
ALE_RTC 14
D
C
B
A
WR_RTC
AD7
15
11
2
D
C
B
A
C1
22pF
C2
22pF
X1
3
10 AD6
NC
11.0592MHz
DS1687-5(24)
U1
RST
X1
EA
Note: Populate U5, U10 or U11 only.
U5 -- Multiplexed Bus RTC interfaced with non-multiplexed uP
U11 -- SmartWatch/Phantom Clock
RST
17
37
20
4
24 PSEN
35
PSEN
X2
ALE
VCC
22 ALE
40 A8
38 A9
36 A10
34 A11
32 A12
30 A13
28 A14
26 A15
19 RXD
21 TXD
23 IRQb
25
U2
P0
VCC
U12 -- Nonvolatile Timekeeping NV RAM
AD0
AD1
AD2
AD3
AD4
AD5
AD6
AD7
2
4
6
P0.0(AD0)
P0.1(AD1)
P0.2(AD2)
P0.3(AD3)
P0.4(AD4)
P0.5(AD5)
P0.6(AD6)
P0.7(AD7)
P1.0
P2.0 (A8)
P2.1 (A9)
P2.2 (A10)
P2.3 (A11)
P2.4 (A12)
P2.5 (A13)
P2.6 (A14)
P2.7 (A15)
P3.0(RXD)
P3.1(TXD)
P3.2(INT0)
P3.3(INT1)
P3.4(T0)
C3
0.1uF
6
8
U4A
P1
P2
P3
P4
P5
P6
P7
RDb 1
U4C
10
12
14
16
18
1
3
5
7
9
8
3
9
11
13
15
17
2
8
DS/RD
10
SN74HC32D (14)
SN74HC32D (14)
19 PQ
P=Q
U7A
1
/RST
DQ
CLK
SCL
SDA
3
5
7
A0
2
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
Q0
Q1
Q2
Q3
Q4
Q5
Q6
Q7
G
U8A
1
2
SN74HC04D (14)
27
29
31 WRb
33 RDb
9
3
WR_RTC
U7B
11
13
15
12
14
16
18
1
P3.5(T1)
P3.6(WR)
P3.7(RD)
SN74HC11D (14)
U4D
CON1
A16
U4B
1
6
2
7
3
8
4
9
5
WRb4
5
U6A
DS2250T32-12(40)
RP1
1
6
12
13
TX
3
CS_RTCb
11
3
4
ALE_RTC
SN74HC688DW (20)
2
A0
SN74HC32D (14)
RX
AD0
V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
A14
2
7
3
5
GND
1
4
SN74HC688DW (20)
VCC
1
C2+
C2-
SN74HC573DW (20)
C10
10uF
DS232A(16)
VCC
VCC
+
22
24
C6
0.1uF
RDb
OE
WE
C7
0.1uF
C8
0.1uF
WRb 29
C13
D2
U13
LM340T5
10uF
J1
VCC
-
+
1
3
Vin
Vout
PSEN
C16
22uF
C17
0.1uF
C18
C14
22uF
C15
22uF
VCC
9V AC
0.01uF
BRIDGE
R2
4.7K
D1
Title
1N914
R1
Q1
2N2907
RSTb
2
D3
2
1
Size
B
Number 4401 S. Beltwood Parkway
Dallas TX 75244-3292
Revision
A
1K ohm
RST
Seperate address/data bus processor to muxbus interface / SmartWatch
23-May-2002 Shee1t of 1
C:\Data\Designlab\PhantomDemo\PhantomDemDora.dwdnb By:
Date:
File:
LED0
1
2
3
4
5
6
AN509
DS1216/DS1244 CODE
/************************************************************************/
/* ds1216an.c - access DS1216 or DS1244 using Phantomdemo circuit
*/
/************************************************************************/
/* For SmartWatch/ROM sockets, input D (input) is connected to A0,
/* the Q (output) is connected to D7 (data bit 7 of the data bus) and
*/
*/
/* /WE connected to A2. On the SmartWatch/RAM sockets, DQ is connected */
/* to D0, and /WE is connected to /WR. For both, /OE is connected to
/* /RD and /CE is connected to A15. Access requires use of XBYTE
*/
*/
/* function. All other SRAM/ROM address and Data pins are connected to */
/* their respective processor pins. The example is intended to show
/* how to access the clock only. Not all memory configurations will
/* work with this setup. Note that SmartWatch sockets must be mapped
/* to data, not program memory space. Program memory fetches would
*/
*/
*/
*/
/* interrupt the access protocol sequence. If /RST is connected to an */
/* address, the /RST bit must always be written to a 1. Otherwise, */
/* access to the clock will be lost. This program is for example only */
/* is not supported by Dallas Semiconductor MAXIM */
/************************************************************************/
#include <stdio.h>
#include <DS5000.h>
#include <absacc.h>
/* Prototypes for I/O functions
/* Register declarations for DS5000 */
/* needed to define xdata addresses */
*/
/************************* bit definitions ******************************/
/***************************** Defines **********************************/
/************************* Global Variables *****************************/
uchar mode = 0, yr = 0x01, mn=0x03, dt=0x30, dy=0x26, hr=0x14, min=0x15, sec=0x16;
#define RDADDR
#define WRADDR
XBYTE[0x0000]
XBYTE[0x0000]
/* I/O is on D0 for SmartWatch/RAM */
#define RDADDRROM XBYTE[0x0004]
/* /WE is on A2 for SmartWatch/ROM */
/* D (data input) on A0 for /ROM */
#define WR1ADDR
#define WR0ADDR
XBYTE[0x0001]
XBYTE[0x0000]
/*********************** Function Prototypes ****************************/
void ds1216_wr();
void ds1216_rd();
void test();
void ds1216_close();
void ds1216_open();
void entry();
uchar rbyte();
void wbyte(uchar);
void ds1216_open()
/* ----- send open protocol to RTC on 1216 ------- */
{
uchar a = 0xc5, inc;
ds1216_close();
for(inc = 0; inc < 4; inc++)
{
wbyte(a);
/* send out the pattern byte */
a = a ^ 0xff;
wbyte(a);
a = (a >> 4) | (a << 4);
/* generate next pattern byte */
/* send out the pattern byte */
/* generate next pattern byte */
}
/* repeat until 8 bytes sent */
}
void ds1216_close()
{
uchar i;
/* ----- make sure clock is not in access mode ----- */
/* read from the part at least 64 times to make sure */
for (i=0; i<9; i++) /* the clock is not being accessed */
2 of 5
AN509
{
}
rbyte();
}
uchar rbyte()
{
/* ------ read one byte from the clock and return ------- */
uchar savbyte = 0, getbyte;
uchar i;
for (i = 0; i < 8; i++)
{
if(mode)
{
/* ROM: /WE is on A2, and must be high to read */
/* data bit output (Q) is in D0 */
/* RAM: /WE is on /WR (DS5000) */
getbyte = RDADDRROM & 1;
}
else
{
getbyte = RDADDR & 1;
/* DQ is D0 */
}
getbyte <<= i;
savbyte |= getbyte;
/* make room for the data bit */
/* and save it */
}
return savbyte;
}
void wbyte(uchar dat) /*---------------------------------------------*/
{
/* This routine writes eight serial bits to the part */
int
inc, x;
for (inc = 0; inc < 8; inc++)
{
if(mode)
{
/* ROM: /WE (A2) /CE and /OE toggle low to write */
if(dat & 0x01)
x = WR1ADDR;
/* data bit input (D) is in A0 */
/* A0 (D) is high, A2 (WE) and OE
are low */
low */
else
x = WR0ADDR;
/* A0 (D) is low, A2 (WE) and OE are
dat >>= 1;
}
else
{
/* RAM: /WE and /CE toggle low to write */
WRADDR = (dat & 1);
dat >>= 1;
/* write DQ0 */
}
}
}
void ds1216_rd() /* -------- read RTC on 1216 ---------- */
{
int
inc;
ds1216_close();
ds1216_open();
/* make sure RTC is not already in access mode */
/* now send the protocol to open the RTC */
printf("\n");
for(inc = 0; inc < 8; inc++)
{
printf("%bx ", rbyte());
}
printf("\n");
3 of 5
AN509
}
void ds1216_wr() /* -------- write time/date info to 1216 RTC ------ */
{
ds1216_close();
ds1216_open();
/* make sure RTC is not already in access mode */
/* now send the protocol to open the RTC */
wbyte(0);
/* 100th seconds */
wbyte(sec); /* seconds */
wbyte(min); /* minutes */
wbyte(hr); /* hrs */
wbyte(dy); /* day */
wbyte(dt); /* date */
wbyte(mn); /* month */
wbyte(yr); /* year */
}
void entry()
{
/* -------- time/date info to load into the clock ------- */
printf("\nEnter the year (0-99): ");
scanf("%bx", &yr);
printf("\nEnter the month (1-12): ");
scanf("%bx", &mn);
printf("\nEnter the date (1-31): ");
scanf("%bx", &dt);
printf("\nEnter the day (1-7): ");
scanf("%bx", &dy);
dy = dy | 0x10;
/* make sure _RST bit is high */
printf("\nEnter the hour (1-24): ");
scanf("%bx", &hr);
/* hr = hr & 0x3f;
/* force clock to 24 hour mode */
printf("\nEnter the minute (0-59): ");
scanf("%bx", &min);
printf("\nEnter the second (0-59): ");
scanf("%bx", &sec);
}
void test()
{
/* ------- loop read and display once per second ------- */
int
prv_sec = 0x99, inc;
while(!RI) /* Read & Display Clock Registers */
{
ds1216_close();
ds1216_open();
rbyte();
sec = rbyte();
min = rbyte();
hr = rbyte();
dy = rbyte();
dt = rbyte();
mn = rbyte();
yr = rbyte();
/* throw away fractional seconds */
/* get the time from RTC on DS2250t */
if(sec != prv_sec)
{
/* display every time seconds change */
Mon Dte Day Hr:Mn:Sec");
printf("\n Yr
printf("\n %02.bX
%02.bX
%02.bX
%02.bX", yr, mn, dt, dy);
printf("
%02.bX:%02.bX:%02.bX", hr, min, sec);
}
prv_sec = sec;
}
RI = 0; /* Swallow keypress to exit loop */
}
4 of 5
AN509
int main(void)
/*-------------------------------------------------------*/
{
uchar M;
/* on entry, the clock could be open for access. This could happen if power
goes away right after the 64-bit pattern match is complete. On power
up, the next 64 bits would be directed to the clock instead of RAM.
To keep from writing garbage to the clock, the first 64 RAM accesses
should be reads. */
ds1216_close();
/* make sure that we are not already in the clock */
while(1)
{
printf("DS1216 Demo build 109 Mode = ");
if(mode)
printf("ROM");
else
printf("RAM");
printf("\n(T)oggle RAM/ROM mode (I)nit clock (R)ead clock (L)oop
read");
printf("\n:");
M = _getkey();
printf("%c",M);
switch(M)
{
case 'I':
case 'i':
entry();
ds1216_wr();
break;
break;
case 'L':
case 'l':
test();
case 'R':
case 'r':
ds1216_rd();
break;
case 'T':
case 't':
printf("\n1=ROM, 0=RAM: ");
scanf("%bx", &mode);
break;
}
}
}
5 of 5
相关型号:
![](http://pdffile.icpdf.com/pdf2/p00231/img/page/DS1216F-3_1356140_files/DS1216F-3_1356140_1.jpg)
![](http://pdffile.icpdf.com/pdf2/p00231/img/page/DS1216F-3_1356140_files/DS1216F-3_1356140_2.jpg)
DS1216F-3
Real Time Clock, Non-Volatile, 0 Timer(s), CMOS, PDIP32, 0.600 INCH, SOCKET TYPE, DIP-32
MAXIM
©2020 ICPDF网 联系我们和版权申明