M68HC11
REFERENCE MANUAL
ON-CHIP MEMORY
MOTOROLA
4-19
cy, the designer must decide how to arrive at this accuracy. One approach is to use a
very inexpensive sensor and calibrate it at the factory. The combination of on-chip EE-
PROM and an on-chip analog-to-digital (A/D) converter is ideally suited to this task
without requiring any expensive external circuitry. The thermostat could be completely
assembled, and calibration information could be determined and stored in the EE-
PROM during final test of the assembled unit. The software required for this calibration
could be part of the on-chip ROM program, or it could be loaded from a test fixture via
the special bootstrap mode. The bootstrap mode approach offers the advantage that
the calibration routines need not occupy any space in the limited internal ROM.
There are two main approaches to calibration of inexpensive sensors. The choice of
the best approach depends primarily on the characteristics of the sensor but also de-
pends upon the degree of system accuracy required in the end application. If a sensor
is basically linear but has wide variation in absolute offset, a gain-offset approach may
be a good choice. This technique requires calibration at two standard levels from
which a gain (slope) and offset are determined. The gain and offset values are then
stored in EEPROM. An actual level is calculated by applying these values algebraical-
ly to an A/D input level. Although this technique requires some calculations during cal-
ibration and during use, it uses very little EEPROM space. If a sensor is non-linear, a
table-lookup approach may be required. An actual level is determined by using the A/
D reading as an index into the calibration lookup table. During use, this method is very
simple and fast, but the lookup table requires more EEPROM, and the calibration pro-
cess requires more calibration points than the gain-offset method.
4.4.4 Using EEPROM during Product Development
During product development, the EEPROM can be used for storage of data and limit-
ed-sized programs. If errors are discovered, they can be corrected even more easily
than a program in an EPROM. In cases in which there is external memory, such as an
EPROM in a system under development, it would be a good idea to store the main pro-
gram loop in the on-chip EEPROM. This approach allows routines in the external
EPROM to be checked one at a time without reprogramming the external EPROM. If
errors are discovered, a substitute corrected routine could be programmed into the
EEPROM to check the corrections before erasing and reprogramming the external
EPROM.
4.4.5 Logging Data
Data logging can involve several types of data. One traditional data type could be tem-
peratures measured at specific times of day over a period of weeks or months. Other
data types could include historical data, such as the number of times a device has
been exposed to illegal operating conditions or the total accumulated time a device
has been used. This type information can be useful for monitoring product reliability.
When such a device is returned to the factory for repair, the historical data can be read
out of the EEPROM. Even if batteries and other power sources failed, this information
could be valid.
In this context, logging means to make a semi-permanent record of data not requiring
power or other normal operating conditions to remain valid. In many cases, there is