28123 Parallax Inc, 28123 Datasheet - Page 207

TEXT WHAT'S A MICROCONTROLLER

28123

Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28123

Style
Book
Title
What's a Microcontroller?
Contents
Whats a Microcontroller? Text
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
Lead Free Status / RoHS Status
Not applicable / Not applicable
Using the EEPROM for data storage can be very useful for remote applications. One
example of a remote application would be a temperature monitor placed in a truck that
hauls frozen food. A second example is a weather monitoring station. One of the pieces
of data a weather station might store for later retrieval is light levels.
Since we are using a photoresistor to measure light levels, this activity introduces a
technique for storing measured light levels to, and retrieving them back from the
EEPROM. In this activity, you will run one PBASIC example program that stores a
series of light measurements in the BASIC Stamp module’s EEPROM. After that
program is finished, you will run a second program that retrieves the values from
EEPROM and displays them in the Debug Terminal.
Programming Long Term Data Storage
The
used to retrieve those values.
The syntax for the
For example, if you want to write the value 195 to address 7 in the EEPROM, you could
use the command:
Word values can be anywhere between 0 and 65565 while byte values can only contain
numbers between 0 and 255. A word value takes the space of two bytes. If you want to
write a word size value to EEPROM, you have to use the optional
careful though. Since a word takes two bytes, you have to skip one of the byte size
addresses in EEPROM before you can write another word. Let’s say you need to save
WRITE
WRITE Location, {WORD} Data Item
WRITE 7, 195
2048 bytes = 2 KB. You can use 2048 bytes to store 2048 different numbers, each of
which can store a value between 0 and 255.
The upper-case ‘B’ stands for bytes. A lower-case ‘b’ stands for bits. This can make a big
difference because 2048 Kb means that 2048 different numbers, but each number is limited
to a value of either 0 or 1.
Although both the upper case ‘K’ and the lower-case ‘k’ are called kilo, they are slightly
different. The upper-case ‘K’ is used to indicate a binary kilobyte, which is 1 × 2
When referring to exactly 2000 bytes, you can use the lower-case k, which stands for kilo
(1 X 10
command is used to store values in the EEPROM, and the
3
= 1000) in the metric system.
WRITE
command is:
Word
READ
modifier. Be
command is
10
= 1024.

Related parts for 28123