SlideShare a Scribd company logo
Inter-integrated Circuit (I2
C)
Protocol and
DS1307 RTC Interfacing
Presented by:-Bhargav Kakadiya (140070110006)
The I2
C Protocol
• Developed by Philips in late 1980s
• Version 1.0 published in 1992
– Supports standard (100 Kbps) and fast (400 Kbps) mode
• Version 2.0 published in 1998
– High-speed mode (3.4 Mbps) added
• Classifies devices into slave and master
• Allows multiple masters to be attached to the same bus
• The master device uses either a 7-bit or 10-bit address to specify
the slave device as its partner of data communication.
• Supports bi-directional data transfer
• Allows multiple masters (microcontrollers) to share the same
peripheral devices
I2
C Signal Level
• Float high and driven low
• Use the SCL signal to carry clock signal to synchronize
data transfer
• Use the SDA signal to carry data and address
• The SDA and SCL pins of I2
C devices (masters and
slaves) are open-drain and need external pull up
resistors.
• The resistors 2.2 KΩ and 1 K Ω are recommended for
100 Kbps and 400 Kbps baud rate.
+VDD
RP
RP
CLK1
OUT
CLK1
IN
Data1
OUT
Data1
IN
CLK2
OUT
CLK2
IN
Data2
OUT
Data2
IN
Device1 Device2
SDA line
SCL line
Figure 11.1Connecting standard- andfast-mode devices to theI2Cbus
Signal Components
• I2
C data transfer consists of 5 signal
components:
– Start (S)
– Stop (P)
– Repeated Start (R)
– Data
– Acknowledge (A)
SDA
SCL
Figure 11.2 I2C Start condition
Start Condition
• Used to indicate that a device would like to
transfer data on the I2
C bus
• Represented by the SDA line going low when
the clock (SCL) signal is high
• Will initialize the I2
C bus
SDA
SCL
Figure 11.3 Stop (P) condition
Stop Condition
• A condition that a device wants to release the I2
C bus
• Is represented by the SDA signal going high when the
SCL signal is high
• Once the stop condition is complete, both the SCL and
SDA signals are high. This is the idle bus.
SDA
SCL
Figure 11.4Restart condition
start condtion
data transfer restart
condition
Repeated Start (R) Condition
• A Start signal generated without first generating a Stop
condition to terminate the communication
• Used by the master to communicate with another slave
or change data transfer direction without releasing the
bus
• Also referred to as Restart condition
SDA
SCL
Figure 11.5 I2
Cbus dataelements
Note. Data bit is always stable when clock (SCL) is high
Data
• It represents the transfer of eight bits of information.
• Data on the SDA line is considered valid only when the SCL signal
is high.
• When the SCL signal is low, the data is allowed to change.
• The eight-bit data may be a control code, an address, or data.
SDA
SCL
Figure11.6 ACKcondition
SDA
SCL
Figure11.7 NACKcondition
Acknowledge (ACK) Condition
• Data transfer needs to be acknowledged either positively (A) or
negatively (NACK).
• A device acknowledges a byte it receives positively by bringing the
SDA line low during the ninth clock pulse of SCL.
• If the device allows the SDA line to float high, it is transmitting a
negative acknowledge (NACK).
Synchronization (1 of 2)
• All masters generate their clocks on the SCL line to transfer
messages on the I2C bus.
• A defined clock is needed for the bit-by-bit arbitration procedure to
take place.
• Most microcontrollers generate the SCL clock by counting down a
programmable reload value using the instruction clock signal.
• Clock synchronization occurs when multiple masters attempt to
drive the I2C bus and before the arbitration scheme can decide
which master is the winner.
• Clock synchronization is performed using the wired-AND connection
of I2C interfaces to the SCL line.
• The high-to-low transition on the SCL line causes the devices
concerned (masters) to start counting off their low period.
Synchronization (2 of 2)
• A master device that is counting off their low period will hold the SCL
line low until the counter is count down to 0. At this point, the device
will release the SCL line to high.
• If there are other devices holding the SCL low, then the SCL line will
remain low until all master devices have counted down to 0. At this
point, the SCL line will go high and all devices will start to count
high.
• The SCL line will be held low by the device with the longest low
period.
• By the same reasoning, the high period of the SCL signal is
determined by the device with the shortest high period.
wait
state
start counting
high period
counter
reset
CLK1
CLK2
SCL
Figure 11.8 Clock synchronization during the
arbitrationprocedure
Handshaking
• The clock synchronization mechanism can be used as a
handshake in data transfer.
• Slave device can hold the SCL line low after completion
of one byte transfer (9 bits).
• Slave halts the bus until it gets ready for the next
operation and then release the SCL line.
master 1 loses arbitration
Data 1 ≠ SDA
SCL
Data1
Data2
SDA
Figure 11.9 Arbitration procedure of two masters
Arbitration
• In the event two or more master devices attempt to begin a transfer at the
same time, an arbitration scheme is employed to force one or more masters
to give up the bus.
• The master devices continue to transmit data until one master attempts to
send a high while the other transmits a low.
• Since the SDA bus has open drain, the master device that attempts to send
a high will detect a low. At this point, it will stop driving the bus.
• The arbitration process does not slow down the winning master’s transfer
and no data gets lost.
A6 A5 A4 A3 A2 A1 A0 R/W
Figure 11.13a 7-bit I2C address
1 1 1 1 0 A9 A8 R/W A7 A6 A5 A4 A3 A2 A1 A0
Figure 11.13b 10-bit I2C address
I2
C Addressing Methods
• I2
C protocol allows master devices to use either the 7-bit and 10-bit
address to specify the slave device for data communication.
• The 7-bit addressing uses the upper 7 bits of the address byte for
address and the least significant bit to specify the data transfer
direction. The format is shown in Figure 11.13.
• The 10-bit addressing uses two bytes to carry the address
information.
– The bit 0 of the high byte is used to indicate the data transfer direction.
– The upper 7 bits have the pattern of 1111 0xx with xx representing the
most significant two address bits of the slave.
– The second byte carries the lower 8 address bits.
S Slave address R/W A Data A Data A/A P
data transferred
(n bytes + acknowledge)
'0' (write)
from master to slave
from slave to master
A = acknowledge (SDA low)
A = not acknowledge (SDA high)
S = start condition
P = stop condition
Figure 11.10 A master-transmitter addressing a slave receiver with a 7-bit address.
The transfer direction is not changed.
Data Transfer Format (7-bit Addressing) (1 of 2)
• Master transmitter to slave receiver – shown in Figure 11.10
• Master reads slave immediately after the first byte (address byte) –
shown in Figure 11.11
• Combined format. A master may transfer some data to the slave and
then generate a restart condition to read data from the slave or
send/read data to/from other slave-- shown in Figure 11.12.
S Slave address R/W A Data Data P
data transferred
(n bytes + acknowledge)
'1' (read)
Figure 11.11 A master reads a slave immediately after the first byte
AA
S Slave address R/W A Data Data
read or
write
Figure 11.12 Combined format
A/A R Slave address R/W A/A P
(n bytes +
ack.)
repeated
start
read or
write
A
(n bytes +
ack.)*
direction of
transfer may
change at this
point
* not shaded because
transfer direction of data
and acknowledge bits
depends on R/W bits
Data Transfer Format (7-bit Addressing) (2 of 2)
TWI
TWBR
TWBR selects the division factor for the bit rate generator. The bit
rate generator is a frequency divider which generates the SCL clock
frequency in the Master modes.
TWBR = Value of the TWI Bit Rate Register
TWPS = Value of the prescaler bits in the TWI Status Register
TWSR
Bits [7:3] – TWS: TWI Status
These five bits reflect the status of the TWI logic and the Two-wire Serial Bus. The
different status codes are described later in this section. Note that the value read from
TWSR contains both the 5-bit status value and the 2-bit prescaler value. The application
designer should mask the prescaler bits to zero when checking the Status bits. This
makes status checking independent of prescaler setting. This approach is used in this
datasheet, unless otherwise noted.
Bit 2 – Reserved Bit
This bit is reserved and will always read as zero.
Bits [1:0] – TWPS: TWI Prescaler Bits
These bits can be read and written, and control the bit rate prescaler.
TWCR
Bit 7 – TWINT: TWI Interrupt Flag
This bit is set by hardware when the TWI has finished its current job and expects
application software response. If the I-bit in SREG and TWIE in TWCR are set, the
MCU will jump to the TWI Interrupt Vector. While the TWINT Flag is set, the SCL
low period is stretched.
Bit 6 – TWEA: TWI Enable Acknowledge Bit
The TWEA bit controls the generation of the acknowledge pulse. If the TWEA bit is
written to one, the ACK pulse is generated
Bit 5 – TWSTA: TWI START Condition Bit
The application writes the TWSTA bit to one when it desires to become a master on
the Two wire Serial Bus. The TWI hardware checks if the bus is available, and
generates a START condition on the bus if it is free.
Bit 4 – TWSTO: TWI STOP Condition Bit
Writing the TWSTO bit to one in Master mode will generate a STOP condition on the
Two-wire Serial Bus. When the STOP condition is executed on the bus, the TWSTO
bit is cleared automatically.
Bit 3 – TWWC: TWI Write Collision Flag
The TWWC bit is set when attempting to write to the TWI Data Register –
TWDR when TWINT is low. This flag is cleared by writing the TWDR Register
when TWINT is high.
• Bit 2 – TWEN: TWI Enable Bit
The TWEN bit enables TWI operation and activates the TWI interface. When
TWEN is written to one, the TWI takes control over the I/O pins connected to
the SCL and SDA pins, enabling the slew-rate limiters and spike filters. If this bit
is written to zero, the TWI is switched off and all TWI transmissions are
terminated, regardless of any ongoing operation.
• Bit 1 – Reserved Bit
This bit is a reserved bit and will always read as zero.
• Bit 0 – TWIE: TWI Interrupt Enable
When this bit is written to one, and the I-bit in SREG is set, the TWI interrupt
request will be activated for as long as the TWINT Flag is high.
TWDR
These eight bits contain the next data byte to be transmitted, or the
latest data byte received on the Two-wire Serial Bus.
In Transmit mode, TWDR contains the next byte to be transmitted.
In Receive mode, the TWDR contains the last byte received.
TWAR
These seven bits constitute the slave address of the TWI unit.
The TWAR should be loaded with the 7-bit slave address (in the
seven most significant bits of TWAR) to which the TWI will
respond when programmed as a slave transmitter or receiver. In
multimaster systems, TWAR must be set in masters which can be
addressed as slaves by other masters.
1X1
2X2
3VBAT
4GND
8
7
6
5 SDA
SCL
SQWOUT
VCC
DS1307
Oscillator
and divider
X1 X2
square
wave out
SQWOUT
power
control
VCC
VBAT
GND
serial bus
interface
SCL
SDA
control
logic
address
register
RTC
RAM
(56x8)
Figure 11.27 DS1307 pin assignment and block diagram
The Serial Real-Time Clock DS1307
• Uses BCD format to represent the clock and calendar information
• Has 56 bytes to store critical information
• Clock calendar provides seconds, minutes, hours, day, date, month, and year information
• Operates in either the 24-hour or 12-hour format with AM/PM indicator
• Has built-in power sense circuit that detects power failure and automatically switches to the
battery supply
• The SQW output frequency may be 1 Hz, 4 KHz, 8 KHz, and 32 KHz.
$00
$07
$08
$3F
seconds
minutes
hours
day
date
month
year
control
RAM
56 x 8
Figure 11.28 DS1307 address map
$01
$02
$03
$04
$05
$06
CH 10 seconds seconds
10 minutes0
0
minutes
hours12
24
10 HR
A/P
10 HR
0 0 0 0 0 day
0 0
0 0 0
10 date
10
month
date
month
year10 year
out sqwe0 0 0 0 RS1 RS0
Figure 11.29 Contents of RTC registers
Bit 7 Bit 0
- Bit 6 of the hours register selects whether the 12-hour or 24-hour
mode is used.
- Bit 5 of the hours register selects whether the current time is AM or
PM if 12-hour mode is selected.
DS1307 Address Map
Interfacing with ATMega32
Table11.7 Squarewaveoutputfrequency
RS1 RS0 SQWoutputfrequency
0
0
1
1
0
1
0
1
1 Hz
4.096 KHz
8.192 KHz
32.768 KHz
DS1307 Control Register
• Bit 7 controls the output level of the SQWOUT pin when
the square output is disabled.
• The SQWE bit enables/disables the SQWOUT pin
output.
• Bits 1 and 0 select the output frequency of the SQWOUT
pin.
DS1307 Write Operation
DS1307 Read Operation
THANK YOU

More Related Content

What's hot

The I2C Interface
The I2C InterfaceThe I2C Interface
The I2C Interface
Corrado Santoro
 
Advance Peripheral Bus
Advance Peripheral Bus Advance Peripheral Bus
Advance Peripheral Bus
SIVA NAGENDRA REDDY
 
SPI Protocol
SPI ProtocolSPI Protocol
SPI Protocol
Anurag Tomar
 
I2 c protocol
I2 c protocolI2 c protocol
I2 c protocol
Azad Mishra
 
Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
Emertxe Information Technologies Pvt Ltd
 
I2C
I2CI2C
axi protocol
axi protocolaxi protocol
axi protocol
Azad Mishra
 
I2C-Bus Design and Verification Specs
I2C-Bus Design and Verification SpecsI2C-Bus Design and Verification Specs
I2C-Bus Design and Verification Specs
Mostafa Khamis
 
8251 USART
8251 USART8251 USART
8251 USART
ShivamSood22
 
Uart
UartUart
Master synchronous serial port (mssp)
Master synchronous serial port (mssp)Master synchronous serial port (mssp)
Master synchronous serial port (mssp)
babak danyal
 
I2C introduction
I2C introductionI2C introduction
I2C introduction
SUNODH GARLAPATI
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
Azad Mishra
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
Chirag Parikh
 
Serial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System ProtocolSerial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System Protocol
Aditya Porwal
 
SPI introduction(Serial Peripheral Interface)
SPI introduction(Serial Peripheral Interface)SPI introduction(Serial Peripheral Interface)
SPI introduction(Serial Peripheral Interface)
SUNODH GARLAPATI
 
Amba axi 29 3_2015
Amba axi 29 3_2015Amba axi 29 3_2015
Amba axi 29 3_2015
kiemnhatminh
 
AHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptxAHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptx
GuckChick
 

What's hot (20)

The I2C Interface
The I2C InterfaceThe I2C Interface
The I2C Interface
 
Advance Peripheral Bus
Advance Peripheral Bus Advance Peripheral Bus
Advance Peripheral Bus
 
SPI Protocol
SPI ProtocolSPI Protocol
SPI Protocol
 
I2 c protocol
I2 c protocolI2 c protocol
I2 c protocol
 
Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
 
I2C
I2CI2C
I2C
 
axi protocol
axi protocolaxi protocol
axi protocol
 
I2C-Bus Design and Verification Specs
I2C-Bus Design and Verification SpecsI2C-Bus Design and Verification Specs
I2C-Bus Design and Verification Specs
 
8251 USART
8251 USART8251 USART
8251 USART
 
Uart
UartUart
Uart
 
Master synchronous serial port (mssp)
Master synchronous serial port (mssp)Master synchronous serial port (mssp)
Master synchronous serial port (mssp)
 
I2C introduction
I2C introductionI2C introduction
I2C introduction
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
 
Serial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System ProtocolSerial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System Protocol
 
SPI introduction(Serial Peripheral Interface)
SPI introduction(Serial Peripheral Interface)SPI introduction(Serial Peripheral Interface)
SPI introduction(Serial Peripheral Interface)
 
Amba axi 29 3_2015
Amba axi 29 3_2015Amba axi 29 3_2015
Amba axi 29 3_2015
 
I2 c
I2 cI2 c
I2 c
 
AHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptxAHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptx
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 

Viewers also liked

I2 c bus
I2 c busI2 c bus
I2c buses
I2c busesI2c buses
I2c buses
Naveen Dubey
 
4 Digit Security Keypad
4 Digit Security Keypad4 Digit Security Keypad
4 Digit Security Keypad
Nestlé
 
137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)
Karteek Irukulla
 
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDLDesigning of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Jay Baxi
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
Anurag Tomar
 
RTC Interfacing and Programming
RTC Interfacing and ProgrammingRTC Interfacing and Programming
RTC Interfacing and Programming
Devashish Raval
 
Audio devices and applications
Audio devices and applicationsAudio devices and applications
Audio devices and applications
Devashish Raval
 
Fortune Talent Solutions Landing Page
Fortune Talent Solutions Landing PageFortune Talent Solutions Landing Page
Fortune Talent Solutions Landing PageJames Druman
 
the windows opereting system
the windows opereting systemthe windows opereting system
the windows opereting system
Юсуф Сатторов
 
Database assistant performance appraisal
Database assistant performance appraisalDatabase assistant performance appraisal
Database assistant performance appraisal
martinbilly11
 
Catálogo de-productos-fashion-woman-s.a
Catálogo de-productos-fashion-woman-s.aCatálogo de-productos-fashion-woman-s.a
Catálogo de-productos-fashion-woman-s.a
Jezee Llanque
 
Farmasötik Yardımcı Maddelerin Toksisitesi
Farmasötik Yardımcı Maddelerin ToksisitesiFarmasötik Yardımcı Maddelerin Toksisitesi
Farmasötik Yardımcı Maddelerin Toksisitesi
Burde Suheyla SUNAR
 
Stewart Kane CV 2016
Stewart Kane CV 2016Stewart Kane CV 2016
Stewart Kane CV 2016Stewart Kane
 
Bilangan Bulat
Bilangan BulatBilangan Bulat
Bilangan Bulat
Andike96
 

Viewers also liked (17)

I2 c bus
I2 c busI2 c bus
I2 c bus
 
I2c buses
I2c busesI2c buses
I2c buses
 
4 Digit Security Keypad
4 Digit Security Keypad4 Digit Security Keypad
4 Digit Security Keypad
 
137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)
 
Designing of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDLDesigning of fifo and serial peripheral interface protocol using Verilog HDL
Designing of fifo and serial peripheral interface protocol using Verilog HDL
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
 
RTC Interfacing and Programming
RTC Interfacing and ProgrammingRTC Interfacing and Programming
RTC Interfacing and Programming
 
Audio devices and applications
Audio devices and applicationsAudio devices and applications
Audio devices and applications
 
Fortune Talent Solutions Landing Page
Fortune Talent Solutions Landing PageFortune Talent Solutions Landing Page
Fortune Talent Solutions Landing Page
 
the windows opereting system
the windows opereting systemthe windows opereting system
the windows opereting system
 
Database assistant performance appraisal
Database assistant performance appraisalDatabase assistant performance appraisal
Database assistant performance appraisal
 
Catálogo de-productos-fashion-woman-s.a
Catálogo de-productos-fashion-woman-s.aCatálogo de-productos-fashion-woman-s.a
Catálogo de-productos-fashion-woman-s.a
 
Fresher Pitch Deck PUBLIC
Fresher Pitch Deck PUBLICFresher Pitch Deck PUBLIC
Fresher Pitch Deck PUBLIC
 
Farmasötik Yardımcı Maddelerin Toksisitesi
Farmasötik Yardımcı Maddelerin ToksisitesiFarmasötik Yardımcı Maddelerin Toksisitesi
Farmasötik Yardımcı Maddelerin Toksisitesi
 
Stewart Kane CV 2016
Stewart Kane CV 2016Stewart Kane CV 2016
Stewart Kane CV 2016
 
Bilangan Bulat
Bilangan BulatBilangan Bulat
Bilangan Bulat
 
Pratibha_Kakarla
Pratibha_KakarlaPratibha_Kakarla
Pratibha_Kakarla
 

Similar to I2C protocol and DS1307 RTC interfacing

COM_BASIC.pptx
COM_BASIC.pptxCOM_BASIC.pptx
COM_BASIC.pptx
BhagvatShukla
 
Implementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGAImplementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGA
IJERA Editor
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systems
Raghunath reddy
 
USART - 8251 / usart-8251A Pallav Shukla
USART - 8251 / usart-8251A Pallav ShuklaUSART - 8251 / usart-8251A Pallav Shukla
USART - 8251 / usart-8251A Pallav Shukla
Pallav Shukla
 
I2C PRESENTATION.PPT
I2C PRESENTATION.PPTI2C PRESENTATION.PPT
I2C PRESENTATION.PPT
venkatesh405785
 
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD CoverterUniversal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Tejas Shetye
 
Dalls02950 1
Dalls02950 1Dalls02950 1
Dalls02950 1
S BW
 
Seminar on serial communication
Seminar on serial communicationSeminar on serial communication
Seminar on serial communicationSamarth Patel
 
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Mohamed Abdallah
 
Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)Chiu-Hao Chen (Ted)
 
Design of dual master i2 c bus controller
Design of dual master i2 c bus controllerDesign of dual master i2 c bus controller
Design of dual master i2 c bus controller
eSAT Publishing House
 
Adc and dac
Adc and dacAdc and dac
Adc and dac
nitugatkal
 
Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....
ANKUSH445845
 
serial-200505101453.pdf
serial-200505101453.pdfserial-200505101453.pdf
serial-200505101453.pdf
KiranG731731
 
Serial Communication
Serial CommunicationSerial Communication
Serial Communication
UshaRani289
 
8051 serialp port
8051 serialp port8051 serialp port
8051 serialp port
Teju Kotti
 
Peripherals and interfacing
Peripherals  and interfacingPeripherals  and interfacing
Peripherals and interfacing
RAMPRAKASHT1
 
Universal Serial Communication Interface
Universal Serial Communication InterfaceUniversal Serial Communication Interface
Universal Serial Communication Interface
Sandesh Agrawal
 

Similar to I2C protocol and DS1307 RTC interfacing (20)

COM_BASIC.pptx
COM_BASIC.pptxCOM_BASIC.pptx
COM_BASIC.pptx
 
Implementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGAImplementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGA
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systems
 
USART - 8251 / usart-8251A Pallav Shukla
USART - 8251 / usart-8251A Pallav ShuklaUSART - 8251 / usart-8251A Pallav Shukla
USART - 8251 / usart-8251A Pallav Shukla
 
I2C PRESENTATION.PPT
I2C PRESENTATION.PPTI2C PRESENTATION.PPT
I2C PRESENTATION.PPT
 
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD CoverterUniversal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
 
Dalls02950 1
Dalls02950 1Dalls02950 1
Dalls02950 1
 
Seminar on serial communication
Seminar on serial communicationSeminar on serial communication
Seminar on serial communication
 
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication Protocols
 
Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)
 
Lpc2148 i2c
Lpc2148 i2cLpc2148 i2c
Lpc2148 i2c
 
Design of dual master i2 c bus controller
Design of dual master i2 c bus controllerDesign of dual master i2 c bus controller
Design of dual master i2 c bus controller
 
I2C
I2CI2C
I2C
 
Adc and dac
Adc and dacAdc and dac
Adc and dac
 
Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....
 
serial-200505101453.pdf
serial-200505101453.pdfserial-200505101453.pdf
serial-200505101453.pdf
 
Serial Communication
Serial CommunicationSerial Communication
Serial Communication
 
8051 serialp port
8051 serialp port8051 serialp port
8051 serialp port
 
Peripherals and interfacing
Peripherals  and interfacingPeripherals  and interfacing
Peripherals and interfacing
 
Universal Serial Communication Interface
Universal Serial Communication InterfaceUniversal Serial Communication Interface
Universal Serial Communication Interface
 

Recently uploaded

Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 

Recently uploaded (20)

Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 

I2C protocol and DS1307 RTC interfacing

  • 1. Inter-integrated Circuit (I2 C) Protocol and DS1307 RTC Interfacing Presented by:-Bhargav Kakadiya (140070110006)
  • 2. The I2 C Protocol • Developed by Philips in late 1980s • Version 1.0 published in 1992 – Supports standard (100 Kbps) and fast (400 Kbps) mode • Version 2.0 published in 1998 – High-speed mode (3.4 Mbps) added • Classifies devices into slave and master • Allows multiple masters to be attached to the same bus • The master device uses either a 7-bit or 10-bit address to specify the slave device as its partner of data communication. • Supports bi-directional data transfer • Allows multiple masters (microcontrollers) to share the same peripheral devices
  • 3. I2 C Signal Level • Float high and driven low • Use the SCL signal to carry clock signal to synchronize data transfer • Use the SDA signal to carry data and address • The SDA and SCL pins of I2 C devices (masters and slaves) are open-drain and need external pull up resistors. • The resistors 2.2 KΩ and 1 K Ω are recommended for 100 Kbps and 400 Kbps baud rate.
  • 5. Signal Components • I2 C data transfer consists of 5 signal components: – Start (S) – Stop (P) – Repeated Start (R) – Data – Acknowledge (A)
  • 6. SDA SCL Figure 11.2 I2C Start condition Start Condition • Used to indicate that a device would like to transfer data on the I2 C bus • Represented by the SDA line going low when the clock (SCL) signal is high • Will initialize the I2 C bus
  • 7. SDA SCL Figure 11.3 Stop (P) condition Stop Condition • A condition that a device wants to release the I2 C bus • Is represented by the SDA signal going high when the SCL signal is high • Once the stop condition is complete, both the SCL and SDA signals are high. This is the idle bus.
  • 8. SDA SCL Figure 11.4Restart condition start condtion data transfer restart condition Repeated Start (R) Condition • A Start signal generated without first generating a Stop condition to terminate the communication • Used by the master to communicate with another slave or change data transfer direction without releasing the bus • Also referred to as Restart condition
  • 9. SDA SCL Figure 11.5 I2 Cbus dataelements Note. Data bit is always stable when clock (SCL) is high Data • It represents the transfer of eight bits of information. • Data on the SDA line is considered valid only when the SCL signal is high. • When the SCL signal is low, the data is allowed to change. • The eight-bit data may be a control code, an address, or data.
  • 10. SDA SCL Figure11.6 ACKcondition SDA SCL Figure11.7 NACKcondition Acknowledge (ACK) Condition • Data transfer needs to be acknowledged either positively (A) or negatively (NACK). • A device acknowledges a byte it receives positively by bringing the SDA line low during the ninth clock pulse of SCL. • If the device allows the SDA line to float high, it is transmitting a negative acknowledge (NACK).
  • 11. Synchronization (1 of 2) • All masters generate their clocks on the SCL line to transfer messages on the I2C bus. • A defined clock is needed for the bit-by-bit arbitration procedure to take place. • Most microcontrollers generate the SCL clock by counting down a programmable reload value using the instruction clock signal. • Clock synchronization occurs when multiple masters attempt to drive the I2C bus and before the arbitration scheme can decide which master is the winner. • Clock synchronization is performed using the wired-AND connection of I2C interfaces to the SCL line. • The high-to-low transition on the SCL line causes the devices concerned (masters) to start counting off their low period.
  • 12. Synchronization (2 of 2) • A master device that is counting off their low period will hold the SCL line low until the counter is count down to 0. At this point, the device will release the SCL line to high. • If there are other devices holding the SCL low, then the SCL line will remain low until all master devices have counted down to 0. At this point, the SCL line will go high and all devices will start to count high. • The SCL line will be held low by the device with the longest low period. • By the same reasoning, the high period of the SCL signal is determined by the device with the shortest high period.
  • 13. wait state start counting high period counter reset CLK1 CLK2 SCL Figure 11.8 Clock synchronization during the arbitrationprocedure Handshaking • The clock synchronization mechanism can be used as a handshake in data transfer. • Slave device can hold the SCL line low after completion of one byte transfer (9 bits). • Slave halts the bus until it gets ready for the next operation and then release the SCL line.
  • 14. master 1 loses arbitration Data 1 ≠ SDA SCL Data1 Data2 SDA Figure 11.9 Arbitration procedure of two masters Arbitration • In the event two or more master devices attempt to begin a transfer at the same time, an arbitration scheme is employed to force one or more masters to give up the bus. • The master devices continue to transmit data until one master attempts to send a high while the other transmits a low. • Since the SDA bus has open drain, the master device that attempts to send a high will detect a low. At this point, it will stop driving the bus. • The arbitration process does not slow down the winning master’s transfer and no data gets lost.
  • 15. A6 A5 A4 A3 A2 A1 A0 R/W Figure 11.13a 7-bit I2C address 1 1 1 1 0 A9 A8 R/W A7 A6 A5 A4 A3 A2 A1 A0 Figure 11.13b 10-bit I2C address I2 C Addressing Methods • I2 C protocol allows master devices to use either the 7-bit and 10-bit address to specify the slave device for data communication. • The 7-bit addressing uses the upper 7 bits of the address byte for address and the least significant bit to specify the data transfer direction. The format is shown in Figure 11.13. • The 10-bit addressing uses two bytes to carry the address information. – The bit 0 of the high byte is used to indicate the data transfer direction. – The upper 7 bits have the pattern of 1111 0xx with xx representing the most significant two address bits of the slave. – The second byte carries the lower 8 address bits.
  • 16. S Slave address R/W A Data A Data A/A P data transferred (n bytes + acknowledge) '0' (write) from master to slave from slave to master A = acknowledge (SDA low) A = not acknowledge (SDA high) S = start condition P = stop condition Figure 11.10 A master-transmitter addressing a slave receiver with a 7-bit address. The transfer direction is not changed. Data Transfer Format (7-bit Addressing) (1 of 2) • Master transmitter to slave receiver – shown in Figure 11.10 • Master reads slave immediately after the first byte (address byte) – shown in Figure 11.11 • Combined format. A master may transfer some data to the slave and then generate a restart condition to read data from the slave or send/read data to/from other slave-- shown in Figure 11.12.
  • 17. S Slave address R/W A Data Data P data transferred (n bytes + acknowledge) '1' (read) Figure 11.11 A master reads a slave immediately after the first byte AA S Slave address R/W A Data Data read or write Figure 11.12 Combined format A/A R Slave address R/W A/A P (n bytes + ack.) repeated start read or write A (n bytes + ack.)* direction of transfer may change at this point * not shaded because transfer direction of data and acknowledge bits depends on R/W bits Data Transfer Format (7-bit Addressing) (2 of 2)
  • 18. TWI
  • 19. TWBR TWBR selects the division factor for the bit rate generator. The bit rate generator is a frequency divider which generates the SCL clock frequency in the Master modes. TWBR = Value of the TWI Bit Rate Register TWPS = Value of the prescaler bits in the TWI Status Register
  • 20. TWSR Bits [7:3] – TWS: TWI Status These five bits reflect the status of the TWI logic and the Two-wire Serial Bus. The different status codes are described later in this section. Note that the value read from TWSR contains both the 5-bit status value and the 2-bit prescaler value. The application designer should mask the prescaler bits to zero when checking the Status bits. This makes status checking independent of prescaler setting. This approach is used in this datasheet, unless otherwise noted. Bit 2 – Reserved Bit This bit is reserved and will always read as zero. Bits [1:0] – TWPS: TWI Prescaler Bits These bits can be read and written, and control the bit rate prescaler.
  • 21. TWCR Bit 7 – TWINT: TWI Interrupt Flag This bit is set by hardware when the TWI has finished its current job and expects application software response. If the I-bit in SREG and TWIE in TWCR are set, the MCU will jump to the TWI Interrupt Vector. While the TWINT Flag is set, the SCL low period is stretched. Bit 6 – TWEA: TWI Enable Acknowledge Bit The TWEA bit controls the generation of the acknowledge pulse. If the TWEA bit is written to one, the ACK pulse is generated Bit 5 – TWSTA: TWI START Condition Bit The application writes the TWSTA bit to one when it desires to become a master on the Two wire Serial Bus. The TWI hardware checks if the bus is available, and generates a START condition on the bus if it is free. Bit 4 – TWSTO: TWI STOP Condition Bit Writing the TWSTO bit to one in Master mode will generate a STOP condition on the Two-wire Serial Bus. When the STOP condition is executed on the bus, the TWSTO bit is cleared automatically.
  • 22. Bit 3 – TWWC: TWI Write Collision Flag The TWWC bit is set when attempting to write to the TWI Data Register – TWDR when TWINT is low. This flag is cleared by writing the TWDR Register when TWINT is high. • Bit 2 – TWEN: TWI Enable Bit The TWEN bit enables TWI operation and activates the TWI interface. When TWEN is written to one, the TWI takes control over the I/O pins connected to the SCL and SDA pins, enabling the slew-rate limiters and spike filters. If this bit is written to zero, the TWI is switched off and all TWI transmissions are terminated, regardless of any ongoing operation. • Bit 1 – Reserved Bit This bit is a reserved bit and will always read as zero. • Bit 0 – TWIE: TWI Interrupt Enable When this bit is written to one, and the I-bit in SREG is set, the TWI interrupt request will be activated for as long as the TWINT Flag is high.
  • 23. TWDR These eight bits contain the next data byte to be transmitted, or the latest data byte received on the Two-wire Serial Bus. In Transmit mode, TWDR contains the next byte to be transmitted. In Receive mode, the TWDR contains the last byte received.
  • 24. TWAR These seven bits constitute the slave address of the TWI unit. The TWAR should be loaded with the 7-bit slave address (in the seven most significant bits of TWAR) to which the TWI will respond when programmed as a slave transmitter or receiver. In multimaster systems, TWAR must be set in masters which can be addressed as slaves by other masters.
  • 25. 1X1 2X2 3VBAT 4GND 8 7 6 5 SDA SCL SQWOUT VCC DS1307 Oscillator and divider X1 X2 square wave out SQWOUT power control VCC VBAT GND serial bus interface SCL SDA control logic address register RTC RAM (56x8) Figure 11.27 DS1307 pin assignment and block diagram The Serial Real-Time Clock DS1307 • Uses BCD format to represent the clock and calendar information • Has 56 bytes to store critical information • Clock calendar provides seconds, minutes, hours, day, date, month, and year information • Operates in either the 24-hour or 12-hour format with AM/PM indicator • Has built-in power sense circuit that detects power failure and automatically switches to the battery supply • The SQW output frequency may be 1 Hz, 4 KHz, 8 KHz, and 32 KHz.
  • 26. $00 $07 $08 $3F seconds minutes hours day date month year control RAM 56 x 8 Figure 11.28 DS1307 address map $01 $02 $03 $04 $05 $06 CH 10 seconds seconds 10 minutes0 0 minutes hours12 24 10 HR A/P 10 HR 0 0 0 0 0 day 0 0 0 0 0 10 date 10 month date month year10 year out sqwe0 0 0 0 RS1 RS0 Figure 11.29 Contents of RTC registers Bit 7 Bit 0 - Bit 6 of the hours register selects whether the 12-hour or 24-hour mode is used. - Bit 5 of the hours register selects whether the current time is AM or PM if 12-hour mode is selected. DS1307 Address Map
  • 28. Table11.7 Squarewaveoutputfrequency RS1 RS0 SQWoutputfrequency 0 0 1 1 0 1 0 1 1 Hz 4.096 KHz 8.192 KHz 32.768 KHz DS1307 Control Register • Bit 7 controls the output level of the SQWOUT pin when the square output is disabled. • The SQWE bit enables/disables the SQWOUT pin output. • Bits 1 and 0 select the output frequency of the SQWOUT pin.