Shop OBEX P1 Docs P2 Docs Learn Events
displaying a digital tem on a PMLCDL from a ds1620 — Parallax Forums

displaying a digital tem on a PMLCDL from a ds1620

aj_ax24aj_ax24 Posts: 16
edited 2005-03-31 22:58 in BASIC Stamp
i have a 3-1/2" lcd digital panel meter and am trying to configure a digital readout of the temp from my ds1620.· also how could i chang the following code to display Fahrenheit?


' setpoints at -5.5 and +7.5 degrees C
' P13=chip select
'··· high activates the DS1620 to receive data
' P14=serial data clock
' P15=serial SPI data in and out
'
' configure DS1620 for standalone mode
high 13
· shiftout 15,14,lsbfirst,[noparse][[/noparse]12,0]
low 13
pause 10· ' let it write (be sure to allow time!)
'
' set the lower threshold= -5.5 deg C
high 13
· shiftout 15,14,lsbfirst,[noparse][[/noparse]2,-11\9]· ' lower threshold=-11/2=-5.5 deg C
·············· '· the twos complement number is sent correctly as 9 bits
low 13
pause 10· ' let it write
'
·
' set the upper threshold= +7.5 deg C
high 13
· shiftout 15,14,lsbfirst,[noparse][[/noparse]1,15\9]· ' upper threshold=15/2=7.5 deg C
low 13
pause 10
··
·

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-31 22:58
    The ds1620 is a celcius device as you have figured out. After you receive the temperature in celcius: multiply the number by 9, then divide it by 5 and finally add 32, this final number is the temperature in Fahrenheit.

    <EDIT>
    If you look at the data table on page 3 of http://rocky.digikey.com/WebLib/Dallas/Dallas%20Web%20Data/DS1620.pdf·you'll see the last bit is the 1/2 C value, this is called fixed format. You'll need to do a signed divide by two to take this out to get a final number in Fahrenheit (signed divide by two (also known as arithmetic shift right) preserves the leftmost bit, keeping a negative number in 2's compliment·negative). This should be done before doing the above operations.
    </EDIT>

    Post Edited (Paul Baker) : 3/31/2005 11:06:49 PM GMT
Sign In or Register to comment.