English
Language : 

AN1759 Datasheet, PDF (13/24 Pages) Freescale Semiconductor, Inc – Add a Non-Volatile Clock to the MC68HC705J1A
Freescale Semiconductor, Inc.
Application Note
MC68HC705J1A Software Interface
MC68HC705J1A Software Interface
AN1759
I/O driving or manipulation is the process of toggling I/O pins with
software instructions to create a certain hardware peripheral. The HC05
CPU provides special instructions specifically to manipulate single
I/O pins.
Five subroutines were created to provide an easy application
programming interface (API). These routines are:
• START_SER — Sends out a start condition on the bus
• STOP_SER — Sends out a stop condition on the bus
• TXD — The master takes the contents of AccA and transmits it
MSB first to the DS1307. The master also checks for
acknowledgement from the DS1307.
• RXD — After the master addresses the DS1307 with its
identification code and the read bit, the DS1307 transmits a byte
of data back to the master. This routine reads that byte and puts it
into AccA. The master also generates an acknowledgment back to
the DS1307.
• RXD_LAST — This routine is just like RXD but it is used for the
last byte read from the DS1307. It does not generate an
acknowledgment back to the DS1307.
The flowcharts for the DS1620 serial I/O drivers are shown in
Flowcharts for the Test Interface. These routines were written
especially for the DS1307 and may not be able to properly drive other
MCU peripherals with 2-wire serial buses.
A typical application would use the SQW/OUT pin on the DS1307. When
configuring this pin for a 1-Hz signal, feed the signal to the IRQ pin of an
MCU. An interrupt routine can be created to read the contents of the
DS1307 every time a 1-Hz signal hits the IRQ pin. This should take
minimal CPU bandwidth and provide the user an easy way to retrieve
time and date information.
The main test routine was written to verify the bus interface between the
DS1307 and the J1A. It writes a known date and time into the DS1307
13
For More Information On This Product,
Go to: www.freescale.com