The DS1672.h.h include file provides both high- and low-level support for the DS1672 32-bit counter real-time clock chip.
The DS1672 incorporates is a 32-bit counter and power-monitoring functions. The 32-bit counter is designed to count seconds and can be used to derive time-of-day, week, month, month, and
year by using a software algorithm. A precision, temperature-compensated reference and
comparator circuit monitors the status of VCC. When an out-of-tolerance condition occurs, an
internal power-fail signal is generated that forces the reset to the active state. When VCC returns to an in-tolerance condition, the reset signal is kept in the active state for a period of time to allow the power supply and processor to stabilize.
Insert the following directive in your code to make these new commands available:
#include<DS1672.h>
Here follows a list of the commands..
DS1672_Enable(flag)
• enables the clock when flag is TRUE,
• disables the clock when flag is FALSE
DS1672_ResetClock
• resets clock completely to manufacturer’s original condition,
• set clock to zero.
DS1672_SetClock( seconds as long )
• sets the entire clock to the specified number of seconds.
DS1672_ReadClock( seconds )
• reads the entire clock in number of seconds.
DS1672_ReadControl
• a function that reads the control register,
• returns a byte value
DS1672_SetControl ( value )
• a function that sets the control register,
• requires byte value
DS1672_SetTrickleCharger ( value )
• a function that sets the register,
• requires byte value
- A note on Trickle Charge for VBAT. See the datasheet for the specifics of this capability.
- The trickle charger is controlled by the trickle charge register. A simplified schematic in the datasheet shows the basic components of the trickle charger. The trickle charge select (TCS) bit (bits 4–7) controls the selection of the trickle charger. In order to prevent accidental enabling, only a pattern on 1010 will enable the trickle charger. All other patterns will disable the trickle charger. The DS1672 powers up with the trickle charger disabled. The diode select (DS) bits (bits 2, 3) select whether or not a diode is connected between VCC and VBACKUP. If DS is 01, no diode is selected or if DS is 10, a diode is selected. The RS bits (bits 0, 1) select whether a resistor is connected between VCC and VBACKUP and what the value of the resistor is.
Warning: The resistor value of 250Ω must not be selected whenever VCC is greater than 3.63V
DS1672_ClearOscillatorStopFlag
• a method that sets the clears the oscillator,
• does not require a parameter.
DS1672_OscillatorStopFlagStatus
• a function that returns the Boolean status of the oscillator status.
• returns byte value.
DS1672_Write(address, value)
• writes to the internal registers or RAM,
• registers: 0x00 to 0x05,
• writing beyond this wraps around to the register space again, so be careful with multibyte writes
DS1672_Read(address, value)
• reads from the internal registers or RAM,
• see the notes, above.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The DS1672 32-Bit Counter Real-Time Clock
The DS1672.h.h include file provides both high- and low-level support for the DS1672 32-bit counter real-time clock chip.
The DS1672 incorporates is a 32-bit counter and power-monitoring functions. The 32-bit counter is designed to count seconds and can be used to derive time-of-day, week, month, month, and
year by using a software algorithm. A precision, temperature-compensated reference and
comparator circuit monitors the status of VCC. When an out-of-tolerance condition occurs, an
internal power-fail signal is generated that forces the reset to the active state. When VCC returns to an in-tolerance condition, the reset signal is kept in the active state for a period of time to allow the power supply and processor to stabilize.
Insert the following directive in your code to make these new commands available:
Here follows a list of the commands..
The driver code can be found here: download
Documentation can found here: download
Example code for a Serial Terminal can be found here: download
Example code for an LCD can be found here: download