18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Clocks and Calendars<br />

Figure 10-1. Pinout of the DS1286 Watchdog Timekeeper.<br />

<strong>The</strong> DS1286 contains a series of registers that store time, date, alarm, and configuration<br />

information. You can read the current time and date from the DS1286 in hundredths of<br />

seconds, seconds, minutes, hours, day of the week, date of the month, and year. Months of<br />

different lengths and even leap years are handled automatically. Clock accuracy is better<br />

than ±1 minute per month at 25 degrees Celsius.<br />

Figure 10-2 shows the pin connections for a DS1286 in a BASIC-52 system. To accommodate<br />

its crystal and power source, the DS1286 a 28-pin encapsulated DIP, just like the one<br />

used by Dallas’ NVRAMs.<br />

<strong>The</strong> pinout and wiring are similar to that for static RAM. <strong>The</strong> chip’s access time is 150<br />

nanoseconds, which is well within the 8052-BASIC’s timing requirements. <strong>The</strong> eight data<br />

lines (DQ0-DQ7) connect to the data bus. <strong>The</strong> chip has just six address inputs (A0-A5), which<br />

are all it needs to access its 64 bytes. <strong>The</strong> clock/calendar uses 14 bytes, and 50 bytes of<br />

nonvolatile RAM are available for any use. <strong>The</strong> chip is shown addressed at A000h, but you<br />

can use any unused chip-enable. <strong>The</strong> chip’s WE and OE inputs are driven by RDANY and<br />

WRITE.<br />

<strong>The</strong> DS1286 has two interrupt outputs, INTA and INTB. You can program one of these to<br />

toggle or pulse whenever the time and/or day match stored values. <strong>The</strong> other can generate<br />

an interrupt if the DS1286’s watchdog register isn’t accessed periodically. You can use this<br />

feature to automatically reset a system if a program crash causes the program to stop<br />

<strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong> 175

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!