CURRENT ISSUE

Contests

bottom corner

FEATURE ARTICLE



Issue #216 July 2008

Second Place Microchip 2007 Design Contest
’Net-Enabled Alarm Clock

by DJ Delorie

Start | System Overview | Network | Display | MP3 | ADC | Memory | Power | Software | Time | Alarms | GUI | Remote Protocols | Construction & Packaging | Smart Combinations | Sources & PDF

MEMORY

The alarm clock has five different types of memory. In addition to the 64 KB of flash memory and 8 KB of RAM in the PIC24FJ64, there is a small buffer in the MP3 decoder (it holds only one MP3 frame at a time) and 8 KB of RAM in the Ethernet chip. However, I needed somewhere to store the alarm settings, fonts, images, and other data. I chose a 24LC512 EEPROM, which holds 64 KB of data. The design allows for two EEPROMs, in case I need more room for MP3s, but so far I’ve needed only one. These EEPROMs live on the I2C bus.

There’s a table of contents at the beginning of the memory, which holds the size and location of each block of data in the chip. There’s a block for each font, a block for alarm settings, a block for each music source, a block for URLs, and more.

Because the EEPROM is 64 KB, addresses are 2 bytes, which is convenient. In addition to providing data to the various routines in the clock, the EEPROM module listens on a TCP port for remote management. The protocol is simple. The remote program can simply read or write blocks of data to the EEPROM. This allows an arbitrary range of remote management software, from downloading fonts to alarm settings (see Table 1).

Write Read Meaning
52
-
"R" to start a read command
04 00
-
Read from address 0x0004
04
-
Read 4 bytes
-
80 00
The configuration data is at address 0x0008
-
05 00
...and is 5 bytes long
57
-
"W" to start a write command
80 00
-
Write to address 0x0080
01
-
Write 1 byte
FC
-
The new timezone-signed, it's-4 (EST summertime)
00
Read a NUL when the write cycle is complete
Table 1— The remote protocol can be used to locate the configuration block in the EEPROM and write a new time-zone offset. The remote application can access the entire EEPROM contents, but it must break reads and writes into 256-byte chunks.

Previous | Next                *| Subscription Deals |*

 


bottom corner