I2C Application Note #3
Controlling the DS1721 Digital Thermometer Chip.
This I2C Application Note demonstrates how to connect and use the Dallas DS1721 Digital Thermometer and Thermostat

This Application Note is currently

Check back periodically for new information.


Introduction: The DS1721 is an inexpensive (~$3.00 in singles), 8-pin digital IC. It is capable of reporting a temperature in the -10°C to +85°C range with ±1.0°C accuracy. Outside this range, the device can provide accuracy of ±2.0°C from -55°C to +125°C. The temperature is reported in a 9-12 bit word, yielding increments as low as 0.0625°C. The DS1721 can be used as a thermostat as well, with the user able to set high and low temperature limits and the device reporting when either of these limits has been reached.

In this application note, we will connect a DS1721 to the OOPic's I2C Port and write a program to show the temperature.

Theory of Operation:
Programming: The DS1721 has 3 address line that allows addressing of up to eight on the same I2C bus. The Base I2C address of the DS1721 is 72.
Code Listing
Dim Thermo As New oi2c
Dim Display As New oDio16

Sub main()
  Call SetUp
  do
    Display = Thermo           'Display the DS1721 Temperature
  loop
End Sub

Sub SetUp()
  Display.IOGroup = 1          'Set the display to drive i/o lines
  Display.Direction = cvOutput '8-15 & 24-31

  'Set the DS1721's I2C address
  Thermo.Node = 73
  
  'DS1721 Expects to be sent &h51 to get it going.
  Thermo.Width = cv8bit        'Control Info is 1-byte
  Thermo.Mode = cv7bit         'I2C mode is 7-Bit Addressing
  Thermo = &h51                'Send the DS1721 &h51

  'Set up the I2C parameters to read the temperature.
  Thermo.Width = cv16bit       'Temperature Info is 2-bytes
  Thermo.Mode = cv10bit        'I2C mode is 10-Bit Addressing
  Thermo.Location = &hAA       'The Temperature location is &hAA
  Thermo.NoInc = cvTrue        'Don't increment the Location.
End Sub

    Send mail and comments to: Savage Innovations.