Rainbow Electronics DS1678 User Manual

r
www.maxim-ic.com
DS1678
Real-Time Event Recorde
FEATURES
§ Real-time clock (RTC)/calendar in binary-
coded decimal (BCD) format counts seconds, minutes, hours, date, month, day of the week, and year with leap-year compensation and is year 2000-compliant
§ Logs up to 1025 consecutive events in read-
§ The event trigger is user-programmable and
can be triggered by the falling edge, rising edge, or rising and falling edges of the
INT pin
§ Event count register provides data on the
number of events that have been logged in the current event logging mission
§ Programmable real-time clock alarm
§ 32-byte, battery-backed, NV RAM for data
storage
§ Two-wire serial interface allows for a simple
connection to your system
§ Three resolution options are available to trade
off accuracy versus maximum time between events
§ Underwriters Laboratory (UL) recognized
PIN ASSIGNMENT
1
X1
2
X2
3
V
BAT
GND
4
8-Pin DIP (300-mil)
8-Pin SOIC (208-mil)
Package dimension information can be found at:
http://www.maxim-ic.com/TechSupport/PackInfo.htm
Vcc
8 7
INT
6
SCL
5
SDA
PIN DESCRIPTION
V
BAT
X1 - Crystal Input X2 - Crystal Output
INT - Interrupt Input/Output
GND - Ground SDA - 2-wire Input/Output SCL - 2-wire Clock Input V
CC
- Battery Supply
- +5V Supply
TYPICAL OPERATING CIRCUIT
ORDERING INFORMATION
DS1678 8-Pin DIP (300-mil) DS1678S 8-Pin SOIC (208-mil)
1 of 26 100101
DS1678
DESCRIPTION
The DS1678 Real-Time Clock Event Recorder records the time and date of a non-periodic, asynchronous event each time the INT pin is activated. The device records the seconds, minutes, hours, date, day of the week, month, year, and century when the first event occurs. Subsequent events trigger the recording of the 16-bit elapsed time counter (ETC) into the 2048 bytes of event log memory. This allows for up to 1025 events to be logged.
The event count register contains the total number of events that have been logged in the current event­logging mission. The event count register also allows the user to determine if the data in the event log memory has rolled over.
Three resolution options allow users to maximize the event log resolution while providing an adequate maximum time between events without using extra memory locations based on the specific characteristics of the event being logged. The seconds resolution provides the time of an event down to the second while allowing up to 18.2 hours between events without using extra memory locations. The minutes resolution provides the time of an event down to the minute while allowing up to 45.5 days between events without using extra memory locations. The hours resolution provides the time of an event down to the hour in which it occurred, while allowing up to 7.5 years between events without using extra memory locations. Based on the expected frequency of events, the correct setting can be easily selected to maximize the resolution and memory utilization.
The event can be triggered in three different ways depending on how the user programs the trigger select (TRx) bits in the control register. The event can be triggered by a falling edge on the INT pin only, a
rising edge only, or it can be triggered by rising and falling edges. Triggering with both the rising and falling edges allows for monitoring when something is turned on/off and how long it is in either state.
The RTC provides seconds, minutes, hours, day, date, month, and year information with leap-year compensation, year 2000-compliance, and also provides an alarm interrupt. The 2-wire interface allows the RTC to function as a stand alone RTC in the system.
The programmable alarm trip points in the RTC will allow a flag to be set in the control register when the specified time in the alarm trip point register is reached. The flag is readable via the 2-wire interface
during an event logging mission or, when the DS1678 is not in a mission, the
INT pin will become an
output and generate an alarm interrupt if the value in the RTC equals the value in the RTC alarm register and the duration interval select (DISx) bits are both set to zeros.
The DS1678 operates as a slave device on the 2-wire serial bus. Access is obtained by implementing a START condition and providing a device identification code followed by a register address. All data is transferred to and from the DS1678 most significant bit (MSB) first. The address counter will automatically increment so that subsequent registers can be accessed sequentially until a STOP condition is executed. When V
falls below 1.25 x V
CC
the device automatically write protects itself, terminates
BAT
any access in progress and resets the device address counter. Inputs to the device via the 2-wire bus will not be recognized at this time to prevent erroneous data from being written to the device from an out of tolerance system. When VCC falls below V
the device switches into a low-current battery backup
BAT
mode. Upon power-up, the device switches from battery power to VCC when VCC is greater than
+ 0.2V and recognizes inputs from the system when VCC is greater than 1.25 x V
V
BAT
by releasing
BAT
control of the write protection on the 2-wire bus.
2 of 26
DS1678
The block diagram in Figure 1 shows the main elements of the RTC event recorder. The device has four major components: 1) 64-bit RTC and control block, 2) 32-byte user NV RAM, 3) 2048 bytes of event log memory (1024 events), and 4) 2-wire serial interface.
3 of 26
DS1678 BLOCK DIAGRAM Figure 1
A
R
2
C
T
A
R
32.768 kHz
DS1678
INT
SCL SDA
V
C
V
BA
GND
X
OSCILLATOR
ND DIVIDE
CONTROL
LOGIC
2-WIRE SERIAL
INTERFACE
POWER
CONTROL
X1
DDRESS
REGISTE
RTC
USER
RAM
DATA LOG
RAM PORT
DATA LOG NV SRAM
SIGNAL DESCRIPTIONS
The following paragraphs describe the function of each pin.
VCC – VCC is a +5V input supply. Communication with the DS1678 can take place only when VCC is connected to a +5V supply.
Battery input for standard lithium cell or other energy source. All functions of the DS1678 with
V
BAT
the exception of the serial interface circuitry are powered by V powered by VCC when VCC > V
. If a battery or other energy source is not used, V
BAT
connected directly to ground. UL recognized to ensure against reverse charging current when used in conjunction with a lithium battery.
See “Conditions of Acceptability” at http://www.maxim-ic.com/TechSupport/QA/ntrl.htm.
GND – Ground.
SCL (2-Wire Serial Clock Input) – The SCL pin is the serial clock input for the 2-wire synchronous
communications channel. The SCL pin is an open drain input, which requires an external pull-up resistor.
SDA (2-Wire Input/Output) – The SDA pin is the data input/output (I/O) signal for the 2-wire synchronous communications channel. The SDA pin is an open drain I/O, which requires an external pull-up resistor.
when VCC < V
BAT
. All functions are
BAT
should be
BAT
4 of 26
DS1678
INT (Interrupt Input/Output) – The INT pin is an I/O that will be activated by an external device to
signify an event has occurred and should be logged. Once the pin is activated, the event will be recorded in the event log memory and the event counter register will be incremented by one.
The INT pin can be activated in three different ways depending on how the user programs the TRx bits. The event can be triggered by a falling edge on the INT pin only, a rising edge only, or it can be
triggered by both the rising and falling edges. By logging both the rising and falling edges as events, the time when something is turned on and turned off can be determined and the amount of time that the external system was in either state.
This assumes that the external system always starts logging data in a known state. For example, if a light switch is being monitored and the switch is always in the off position before a mission is started, the first event would be turning the lights on. The next event would have to be to turn the lights off. The time between the events would be the amount of time the lights were in the on state. The time from turning the lights off until the next event, which would be to turn the lights back on again, would be the amount of time the lights were off.
The INT pin can also be used as an output when the DS1678 is not in an event logging mission. The INT pin will become an output and generate an alarm interrupt if the DISx bits are both set to zero and the
RTC reaches the preset value in the alarm register. The INT output remains low as long as the status bit causing the interrupt is present and the DISx bits are both set to zero.
The INT pin is an open-drain input/output with a weak internal pull-down resistor to prevent the pin from floating if the signal connected to the pin is tri-stated. Without the resistor, the input would float and potentially log phantom events. With the pull-down resistor, the pin can be transitioned to a low state
causing an event to be recorded if the INT pin was being held high by an outside signal that becomes tri­stated.
X1, X2 – Connections for a standard 32.768kHz quartz crystal, Daiwa part number DT-26S or equivalent. For greatest accuracy, the DS1678 must be used with a crystal that has a specified load capacitance of 12.5pF. There is no need for external capacitors or resistors. Note: X1 and X2 are very high impedance nodes. It is recommended that they and the crystal be guard-ringed with ground and that high frequency signals be kept away from the crystal area. For more information on crystal selection and crystal layout considerations, please consult Application Note 58, “Crystal Considerations with Dallas Real-Time Clocks.”
RECOMMENDED LAYOUT FOR CRYSTAL
5 of 26
DS1678
CLOCK ACCURACY
The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match between the capacitive load of the oscillator circuit and the capacitive load for which the crystal was trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External circuit noise coupled into the oscillator circuit may result in the clock running fast. See Application Note 58, “Crystal Considerations with Dallas Real-Time Clocks” for detailed information.
MEMORY
The memory map in Figure 2a shows the general organization of the DS1678. As can be seen in the figure, the device memory is in one contiguous segment with a data port to access the event log memory. Since the 2-wire bus only has the capability to use one byte addressing, the DS1678 utilizes the data port to access the 2048 bytes of event log memory. The address that the next data will be written to is stored in the address pointer registers LSB (3Fh) and MSB (40h). These will be helpful in recovering all of the data if a rollover occurs. The address pointer will point to the oldest event in the memory after a rollover. This is the memory location in event log memory that would be over written by the next event. Read the data from this point to the end of the memory and the start time stamp, including the 2-byte ETC from last event. Working backward from the value in the start time stamp, subtract the value in the ETC from last event to get the time the last event in the memory occurred. Then subtract the values in each of the 2-byte memory locations for elapsed time between events in order to recover the time the previous event occurred.
The value in the ETC register LSB (3Dh) and MSB (3Eh) is the value in the actual ETC. This is the time from the last event recorded until logging was stopped. Since a new event has not occurred, this data has not been stored in the event memory yet.
The data port is made up of three bytes. The first byte (41h) is the event log memory address LSB, the second byte (42h) is the event log memory address MSB, and the third byte (43h) is the event log memory data byte. To access data via the data port, the LSB of the event log memory address is written into 41h, the main memory address pointer will automatically increment to 42h where the event log memory address MSB data will be written. The next transfer will indicate a read command with a 1 in the R/
W bit of the 2-wire address byte. The data from the event log memory location corresponding to
the address written into main memory locations 41h and 42h will be available in location 43h to be read. Any address greater than 43h will read back 00h and will not be able to be written. For address above 43h, the address pointer will increment until it reaches FFh then rollover to 00h.
The event log memory address pointer in main memory locations 41h and 42h will be auto-incremented to the next higher event log memory address, while the pointer for the main memory will remain at location 43h. This will allow the event log memory to be read continuously without having to write the next desired event log memory location prior to each data read. The even address locations in the event log memory will correspond to the LSB of the elapsed time between events and the odd memory locations will correspond to the MSB of the elapsed time between events. For more information about how the data is stored in the event log memory, see Figure 2b.
When the event log memory address pointer gets to the last address location (07FFh), the automatic incrementing will stop. A new starting address will then have to be written into the event log memory pointer bytes (41h & 42h) in order to begin reading additional data. The event log memory addresses that can be put into the pointer (41h & 42h) are 0000h to 07FFh. The five MSB of the address are ignored.
6 of 26
DS1678
Entering a value greater than 07FFh will result in the address location associated with the value of the lowest 11 bits of the address. The RTC and control registers (See Figure 2a for more detail.) are located in the main memory between addresses 00h and 0Fh. The user NV RAM resides in locations 10h through 2Fh. The event logging memory data port is located at locations 41h, 42h, and 43h. Memory locations 44h and up are reserved for future extensions and will read 00h.
The end user can write only to the RTC and control registers and the user NV RAM. The rest of the memory map is read-only from the end user’s perspective. During an event log mission, all of the memory is read only. A write will terminate the mission. If there is an event being recorded when the mission is terminated, the event will finish being recorded before the mission will be stopped and the values in the MIP and ME bits will not change to 0’s until the mission has completed.
During an event log mission, memory locations 30h and above are not accessible to the user to avoid data collisions from a user read and an event being logged at the same time. If the user tries to read a location with an address greater than 2Fh during a mission, the value returned will be 00h.
7 of 26
DS1678 RTC AND CONTROL PAGE Figure 2a
ADDRESS BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 FUNCTION
00 0 10 SECONDS SECONDS 01 0 10 MINUTES MINUTES 02
03 0 0 0 0 0 DAY OF WEEK 04 0 0 10 DATE DATE 05 0 0 0 10 MO MONTH 06 10 YEAR YEAR 07 10 CENTURY CENTURY 08 MS 10 SECONDS ALARM SECONDS ALARM 09 MM 10 MINUTES ALARM MINUTES ALARM
0A MH 12/24
0B MD 0 0 0 0 DAY-OF-WEEK ALARM 0C 0D
0E ME CLR DIS1 DIS0 RO TR1 TR0 COE Control
0F 0
10 11 12
2F 30 0 10 SECONDS SECONDS 31 0 10 MINUTES MINUTES
32
33 0 0 0 0 0 DAY-OF-WEEK 34 0 0 10 DATE DATE 35 0 0 0 10 MO MONTH 36 10 YEAR YEAR 37 10 CENTURY CENTURY 38 Event 0 Elapsed Time from last Event Counter LSB
39 Event 0 Elapsed Time from last Event Counter MSB 3A Low byte 3B Medium Byte 3C High Byte 3D Low Byte
3E High Byte
3F Low Address Byte
40 High Address Byte
41 Low Address Byte
42 High Address Byte
43 Data Byte
44
FF
0 12/24
MEM
CLR
0 12/24
AM/PM
10 HR
AM/PM
10 HR
MIP CM LOBAT ROF 0 ALMF
AM/PM
10 HR
10 HR
10 HR HOUR ALARM
(reads 00h) Reserved
Byte 1 Byte 2 Byte 3
Byte 32
10 HR
(reads 00h) Reserved
HOUR
RTC
RTC
Alarm
Status
User-
Programmable
NV Memory
HOURS
Time Stamp
And
Elapsed Time
Counter
Event Count
Elapsed Time
Counter (ETC)
Address
Pointer
Data Log
RAM
Port
DS1678
8 of 26
Loading...
+ 18 hidden pages