i2c rtc interfacing with lpc2129 arm7 tyro

Not rated 9,744

Circuit Image

The I2C (Inter-IC) bus is a bi-directional two-wire serial bus that facilitates communication between integrated circuits (ICs). It is a synchronous protocol that enables a master device to initiate communication with a slave device, allowing data exchange between them. The DS1307 Serial Real-Time Clock is a low-power device that features a full binary-coded decimal (BCD) clock/calendar and 56 bytes of non-volatile SRAM. Address and data are transferred serially via the two-wire, bi-directional bus. The clock/calendar provides information on seconds, minutes, hours, day, date, month, and year. It automatically adjusts the end-of-month date for months with fewer than 31 days and accounts for leap years. The clock can operate in either a 24-hour or 12-hour format with an AM/PM indicator. The I2C protocol is a Master-Slave configuration, where the master device controls the clock line (SCL), dictating the timing of all transfers on the bus. Data transfer cannot occur without clock manipulation. The I2C bus supports multiple devices, each identified by a unique address, which can function as either a transmitter or receiver depending on the device's purpose. The controller is designed to manage the DS1307 RTC device through the I2C protocol, with the I2C controller acting as the master and the RTC as the slave. The read operation involves sending control signals, including address and data bits, accompanied by appropriate clock signals. To read the date and time using the I2C RTC on the LPC2129 Tyro Board, the wiring is straightforward. The RTC simplifies software development by handling calendar functions, including leap year adjustments. The DS1307 is an 8-pin device utilizing the I2C interface. In the LPC2129 TYRO Kit, two RTC lines are managed by I2C enabled drivers, with the serial clock (SCL) on P0.2 and the serial data (SDA) on P0.3, connected to the DS1307 IC. Date and time are read from the LPC2129 Tyro Kit via these I2C lines. To compile the associated C code, the KEIL software must be properly configured, and a project with the correct settings must be established. The C file should be added to the project to compile and generate a HEX file. In debugging mode, the port output can be checked without the LPC2129 Tyro Board. The LPC2129 Tyro Board requires a +3.3V power supply, with the RTC battery device connected. It is essential to ensure that the battery device is properly installed. A serial cable connects the microcontroller to a PC, where Hyper Terminal can be used to display values from the RTC. The Hyper Terminal will show the data received from the RTC battery via I2C. To modify the time value in the RTC battery, the SW3 switch must be turned on, allowing new time values to be written through Hyper Terminal. After inputting the desired values, turning off SW3 will initiate the RTC battery with the new time, which will be displayed in the Hyper Terminal.

The I2C bus operates effectively for communication between various devices, allowing for a structured and efficient exchange of data. The DS1307 RTC is particularly advantageous in applications requiring accurate timekeeping and calendar functions. The integration of the DS1307 with the LPC2129 Tyro Board highlights the versatility of I2C in embedded systems, enabling seamless communication and control. The design ensures that the master device can easily manage the slave device, facilitating real-time clock operations with minimal overhead. The use of Hyper Terminal for monitoring and controlling the RTC adds an interactive element, allowing for real-time adjustments and feedback during development and debugging phases. This setup is ideal for projects that necessitate precise timekeeping and can be expanded to include additional I2C devices as needed, enhancing the overall functionality of the system. The simplicity of wiring and the robust nature of the I2C protocol make it a suitable choice for a wide range of applications in electronics and embedded system design.The I2C (Inter-IC) bus is a bi-directional two-wire serial bus that provides a communication link between integrated circuits (ICs). I2C is a synchronous protocol that allows a master device to initiate communication with a slave device.

Data is exchanged between these devices. The DS1307 Serial Real-Time Clock is a low-power; full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially via a 2-wire, bi-directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator. Fig. 1 shows how to interface the EEPROM with microcontroller through I2C. I2C is a Master-Slave protocol. I2C has a clock pulse along with the data. The master device controls the clock line, SCL. This line dictates the timing of all transfers on the I2C bus. No data will be transferred unless the clock is manipulated. I2c bus supports many devices, each device is recognized by a unique address ”whether it`s a micro-controller, LCD Driver, memory or keyboard interface and can operate as transmitter or receiver based on the functioning of the device.

The controller designed controls the RTC ds1307 device through I2C protocol. The I2C Controller here acts as a master device and controls RTC ds1307 which acts as a slave. The read operation is accomplished by sending a set of control signals including the address and/or data bits. The control signals must be accompanied with proper clock signals. We now want to read date & time by using I2C - RTC in LPC2129 Tyro Board. Wiring up an I2C based RTC to the I2C port is relatively simple. The RTC also makes the software easier as it takes care of all calendar functions; accounting for leap years etc.

The DS1307 (RTC) Real Time Clock IC (an I2C real time clock) is an 8 pin device using an I2C interface. In LPC2129 TYRO Kit, 2 nos. of RTC lines are controlled by I2C Enabled drivers. I2C Lines serial clock SCL (P0. 2), serial data SDA (P0. 3) connected to the I2C based serial RTC ds1307 IC. The date & times are read in LPC2129 Tyro Kit by using these SDA & SCL I2C lines. To compile the above C code you need the KEIL software. They must be properly set up and a project with correct settings must be created in order to compile the code.

To compile the above code, the C file must be added to the project. In Keil, you want to develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without LPC2129 Tyro Board. Give +3. 3V power supply to LPC2129 Tyro Board; the RTC Battery device is connected with the Tyro Board. First check the entire Battery device fixed properly. A serial cable is connected between the microcontroller and PC. In PC, open the Hyper Terminal for displaying the values from RTC. Now, the Hyper Terminal shows the received data from RTC Battery through I2C. If you want to change the time value from RTC Battery then you just Turn ON the switch, sw3. Now, you can write any new time values into the RTC by using Hyper Terminal. Then Turn OFF switch, sw3. Now the RTC Battery start the new time value & it display in Hyper Terminal. The Hyper Terminal is working b 🔗 External reference