RAM vs EEPROM

The BASIC Stamp's EEPROM can hold 2048 bytes, or 2 KB, of information. Part of the storage space, starting at address 2047 and growing toward address 0, is used to hold the PBASIC program. The unused space which remains can be used to store data, which builds from address 0 toward address 2047.

EEPROM is different from RAM (random access memory) variable storage in several respects:

• RAM is volatile memory, meaning that the memory contents are lost when power is removed

• EEPROM is non-volatile. The contents are maintained when the power is turned off.

• EEPROM takes more time to store a value, sometimes up to several milliseconds

• EEPROM can accept a finite number of write cycles, around 10 million writes. RAM has unlimited read/write capabilities

• The primary function of the EEPROM is to store programs; data is stored in the leftover space

For the BASIC Stamp 2 module, the maximum number of writes to its EEPROM is 10 million. That sounds like a lot, but when you are using EEPROM for data storage, it's important to make some rough calculations to see if the limit will be exceeded.

For example, consider a program that writes to a location in EEPROM once per second. How many days would it take to exceed 10 million writes?

1 write/sec * 60 sec/min * 60 min/hour * 24 hours/day = 86,400 writes/day

10,000,000 writes / 86,400 writes/day = 116 days

At one write per second, it would take nearly 116 days of continuous operation to exceed 10 million writes. Our Experiment 5 program writes to EEPROM once every 2.5 seconds, so we will not exceed the 10 million writes for over 290 days, or nearly ten months. Even though this is quite a long time, we can extend the functional life of the EEPROM even more by utilizing the following techniques. First, write to different parts of the EEPROM, instead of using the same locations over and over again. Second, only write samples when the wind turbine is actually turning.

So, here's the plan for sampling the four waveforms:

• Loop through each A/D channel, from CH3 to CH0

o CH3 = phase 3, CH2 = phase 2, CH1 = phase 1, and CH0 = rectified output

• Wait and synch up with the positive cycle of phase 3 (arbitrarily chosen)

• Quickly take 10 samples of the waveform (ch3, ch2, chi, or cho)

o Store each sample in variable storage (RAM) as it is obtained

• Transfer the 10 samples to EEPROM

• Repeat for the next A/D channel

This results in four individual sample groups that, taken together, we'll call "banks", stored in EEPROM. The next section shows how the banks are arranged.

Getting Started With Solar

Getting Started With Solar

Do we really want the one thing that gives us its resources unconditionally to suffer even more than it is suffering now? Nature, is a part of our being from the earliest human days. We respect Nature and it gives us its bounty, but in the recent past greedy money hungry corporations have made us all so destructive, so wasteful.

Get My Free Ebook


Post a comment