How does a CMOS battery store information on it? I know it stores information such as the time, date, passwords and drive configuration, but how? How can a battery store data?
The CMOS battery does not store data. The CMOS battery ensures that the CMOS chip, which does store data, has power. CMOS memory requires power to retain data, so the battery is necessary when no external power is supplied to the computer.
This is why a jumper is usually removed from the motherboard to reset the CMOS, as doing so interrupts power to the CMOS chip long enough to clear the data.
A sign of impending CMOS battery failure is when the computer's real-time clock begins to lose track of time when the system is off and not powered by another power source.
On many newer computers, the BIOS configuration data is stored in flash memory, and the battery serves solely to maintain the real-time clock. In such systems, it is called the "RTC battery" (an example is on page 29 of the HP Pavilion dv6z-3000 Select Edition service manual). RTC battery failure in such systems will cause the clock to lose track of time when the system is disconnected from power, but will not result in loss of BIOS settings.
The battery itself does not store the info. The battery is used to keep a small amount of memory (static ram to be exact) running so that the settings are not lost. Additionally, the battery keeps a clock running so that the time and date are correct when the computer is turned on again.
Interesting side note - when running on the battery, the clock in not very accurate and the time can drift.
CMOS battery does not store data, it's a BATTERY. The battery provides power for the
SRAM chips that actually hold the memory.
Incidentally, there is no such thing as a
CMOS battery. The battery that powers the
CMOS is just a regular battery that happens to power
CMOS stands for "Complementary Metal-Oxide Semiconductor" and it refers to the construction of the chips.
This is how it looks like in a modern computer:
- if the external power is cut out and you switch the CMOS memory jumper, the CMOS memory will be cut out of power (and the CMOS memory will reset its contents, as CMOS memory is a volatile memory)
- BIOS data is in a non-volatile memory so even if external power is cut out and the CMOS battery will fail, the memory will hold BIOS data
- although BIOS memory is read only, it can be erased (usually by using a higher than normal voltage). This happens when you upgrade your BIOS to a newer version
- the 5V battery also powers the RTC clock
- in a modern computer, all of the chips (excluding the battery - my mistake on the drawing) are incorporated in the southbridge
- SRAM == Static RAM, SDRAM = Synchronous Dynamic RAM
As for the question: the CMOS battery ensures that the BIOS configuration is stored in CMOS memory.
The question has more or less been answered, but it could stand a bit of explanation.
The CMOS is effectively no different from regular RAM. It stores the information, but only so long as there is a source of power available to it. Once the power is removed, the contents fade.
Unlike regular RAM, the CMOS is small (physically and in capacity), and draws much less power. As such, a regular button-cell is sufficient to keep its contents for a significant amount of time.
That said, the CMOS does not use the battery all the time. When there is power from the PSU, the CMOS uses that to keep its contents intact, thus further prolonging the CMOS battery’s life. If the power is cut, a capacitor allows it to retain its contents for a moment until the battery is switched in.
Also, while the date/time, and a few other values are preserved with the battery, many (even most) of the settings are actually written to the flash section of the CMOS which are retained in the event that the CMOS battery dies. This makes sense because certain values like the date and time are transient/dynamic and must be kept active while other settings are static and don’t change frequently (if at all), so they can simply be written to long-term storage like a tiny, CMOS version of a hard-drive. That’s why when the CMOS battery dies and there is a power-failure, you will notice that only some of the settings have reverted to the defaults.
Usually what a BIOS manufacturer will do is to write non-critical settings to non-volatile memory which need to specifically be reset to defaults with the BIOS’s “load defaults” function (removing the battery for a while won’t do it), and leave only critical settings in volatile memory. Therefore, even if all power is removed, settings like floppy configuration, onboard audio settings, and such will be retained, but settings that prevent the system from working whatsoever, like memory timings and CPU overclocking can be reset to working values by simply removing the battery for a while.
Because of this segregation, the number of memory cells that need a constant source of electricity can be reduced greatly, allowing the battery to last for years.
(You will note this behavior in other devices as well. For example, after a power-out, a VCR will need its clock to be set (hence the infamous flashing
12:00 of yore). However, many VCRs could retain their other settings such as language, cable/antenna, tape-speed, etc. Some VCRs could even retain their programs since the program does not really change.
My mother uses a timer (Figure 1) to automatically turn the porch lights on and off a couple of times per day. You program it by inserting a couple of little plastic tabs that flick the switch on and off. If it is pulled out of the outlet, its clock stops ticking and it stops knowing what time it is, but the programs remain unaffected. It is the same with the timer on an oil heater (Figure 2) which uses switches/buttons instead of tabs. On the other hand, she uses a purely digital timer (Figure 3) for the indoor lights when she brings the garden in for the winter, and it loses everything when disconnected.)
Figure 1: Analog timer
Figure 2: Oil-heater timer
Figure 3: Digital timer