27220 Parallax Inc, 27220 Datasheet - Page 174

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
an intelligent device and, once programmed, is capable of stand-alone operation
using the THi, TLo, and TCom control outputs.
The connections to the DS1620 are similar to other synchronous serial devices, with
the exception of the 1K resistor in the DQ line. Do not leave this out; the DQ pin of
the DS1620 is bi-directional so it could – under the right conditions – be an output
and in the opposite state of the BASIC Stamp pin that it connects to. This condition
could lead to damage to one device or the other. The 1K resistor limits the current
between the BASIC Stamp and the DS1620 to a safe level should a programming
error occur.
The DS1620 requires initialization before use. In active applications like this, the
DS1620 is configured for free running with a CPU. After the configuration data is sent
to the DS1620, a delay of 10 milliseconds is required so that the configuration can be
written to the DS1620’s internal EEPROM (this delay is required after any write to the
EEPROM). After the delay, the DS1620 is instructed to start continuous conversions.
This will ensure a current temperature reading when the BASIC Stamp requests it.
The DS1620 requires about one second to complete a temperature conversion, so
access to new temperature should be no more frequent than every second.
To retrieve the current temperature, the Read Temperature ($AA) command byte is
sent to the DS1620. Then the latest conversion value is read back. The data returned
is nine bits wide, and holds the temperature in half-degrees Celsius units. Bit8
indicates the sign of the temperature. If negative (sign bit is 1), the other eight bits
hold the two’s-complement value of the temperature.
The sign bit is extended to the upper byte of tempIn to allow positive or negative
values in the equations that follow. This is required because the BASIC Stamp stores
negative values in 16-bit two’s complement format, but only nine bits are returned
from the DS1620. You see how the sign gets properly extended with the following
test program:
With a full (signed) 16-bit value in tempIn, the Celsius temperature is calculated by
multiplying tempIn by five. If the current temperature was 22.5 degrees C, tC
would now hold 225.
DEBUG BIN8 -0, CR,
BIN8 -1
' %00000000 (positive)
' %11111111 (negative)

Related parts for 27220