Event log data is a unique source of information for security, audit, compliance and troubleshooting purposes. An event logger enables you to view the log of a series of events. This can be done not only at the time of occurrence of the events but also any time later. The event logger provides an accurate time and date at which a particular event has occurred, which is essential for many applications.
In this event logger article, we also demonstrate the use of a DS1307 real-time clock (RTC) chip, switches and an LCD module. The RTC chip provides time components of hours, minutes and seconds in addition to the year, month and day.
In this project, pressing a switch is regarded as an event. When the event occurs, it is recorded in memory locations of the microcontroller. This information from the microcontroller can be retrieved and seen on the LCD module and HyperTerminal.
Circuit and working of Event Logger
Fig. 1 shows the circuit of RTC-based event logger. It comprises regulator 7805 (IC1), microcontroller P89V51RD2 (IC2), RS232 interface MAX232 (IC4), RTC chip DS1307 (IC3), LCD module and a few discrete components.
Microcontroller. The P89V51RD2 is an 8-bit 80C51 microcontroller with 64kB Flash and 1024 bytes of data RAM. It has three 16-bit timers/counters, programmable watchdog timer, eight interrupt sources with four priority levels, serial peripheral interface (SPI) and enhanced UART, programmable counter array with PWM and capture/compare functions, and four 8-bit input/output (I/O) ports. It also has an on-chip oscillator and clock circuitry, which is operated at up to 40MHz crystal. It supports 12 clocks per machine cycle (default) and 6 clocks per machine cycle modes, which can be selected via software. The Flash program memory supports both parallel programming and serial programming.
Real-time clock chip. DS1307 is a serial RTC chip with calendar function. This chip also incorporates 56 bytes of non-volatile RAM. Data and address are transferred serially through I2C bi-directional bus, which obviates the need for a large number of interface lines. In this chip, the clock operates in either 24-hour or 12-hour format with AM/PM indicator. In calendar mode, end of the month is automatically adjusted for months with less than 31 days and leap year compensation. The memory map of DS1307 is shown in Table I.