Applied Sensors - problem with ds1620
NGarland
Posts: 10
I'm trying to use the BS2+BOE to read the temp from a DS1620.· I get back a reading but it seems WAY too high to be room temperature·(68C!).· This is after dividing the return byte by 2 (due to the LSB being 0.5C).· At first I thought maybe the value was coming back in fahrenheit as the room I'm in is about 68-70F, but the reading only fluctuates in multiples of 4 (again, after dividing by 2).· I believe I have the circuit wired correctly as I have verified the command signal sent to the DS1620 ( and the format of the signal received) using an optascope. The DS1620 is configured for CPU, and continuous and 1-shot conversions report the same reading.· Below is the code I'm using (should be the same as what's in the Applied Sensors text).· Any suggestions would be appreciated!
Thanks!
-N
' {$STAMP BS2}
' {$PBASIC 2.5}
x········ VAR···· Byte
degC····· VAR···· Byte
OUTS=%0000000000000000
···· 'fedcba0987654321
DIRS=%1111111111111111
FREQOUT 0, 20, 3800
HIGH 13
SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]238]
LOW 13
DO
· HIGH 13
· SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]170]
· SHIFTIN 15, 14, LSBPRE, [noparse][[/noparse]x]
· LOW 13
· degC = x / 2
· DEBUG ? degC
· PAUSE 100
LOOP
Thanks!
-N
' {$STAMP BS2}
' {$PBASIC 2.5}
x········ VAR···· Byte
degC····· VAR···· Byte
OUTS=%0000000000000000
···· 'fedcba0987654321
DIRS=%1111111111111111
FREQOUT 0, 20, 3800
HIGH 13
SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]238]
LOW 13
DO
· HIGH 13
· SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]170]
· SHIFTIN 15, 14, LSBPRE, [noparse][[/noparse]x]
· LOW 13
· degC = x / 2
· DEBUG ? degC
· PAUSE 100
LOOP
Comments
I don't know if it makes any difference to the DS1620, but the sample program pauses one full second (PAUSE 1000) between conversions, and your program only pauses .1 of a second (PAUSE 100).
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
HIGH 13 ' Tells the DS1620 that a command is coming.
SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]12,2] ' Command to set DS1620 configuration 2.
LOW 13 ' Completes the command cycle.
Be sure there is a 0.1 uF capacitor across the power supply on the breadboard.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv123.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I reduced the Pause duration to 100 because I was seeing steps of (exactly) 4 degrees when cooling or heating the outside of the IC (with a fan·or finger, respectively) and I wanted to make sure I was sampling often enough to see a gradual change.· No luck - the output always steps in increments of 4 (after dividing by 2).
As for programing the CPU mode, I've done that several times, trying to get an accurate value using both CPU mode 2 and 3 (continuous and 1-shot).· I've also tried setting the mode just prior to loading the temp read program (meaning I didn't power down the BOE inbetween setting the mode and running the program).· But yes, I have cycled power after programming the mode
Theres also a .1uf cap connecting pin 8 to Vss.· I noticed that the·N&V article that was referenced does not have a cap in the initial circuit and removing it from my circuit did not change the result for me.· For what its worth, the wiring on my breadboard is exactly the same as figure 1-5 in the applies sensors text.
One other piece of information - I'm using a BOE rev B and a wall adapter (9v, 300ma).· The circuit is connected to Vdd (not Vin).
I'll be reading through the N&V article this weekend to see if I can figure the problem out, but any additional thoughts/suggestions on the problem would be appreciated.
Thanks!
-N
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Byte
degC VAR Byte
OUTS=%0000000000000000
'fedcba0987654321
DIRS=%1111111111111111
FREQOUT 0, 20, 3800
HIGH 13
SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]238]
LOW 13
Here:
DO
HIGH 13
SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]170]
SHIFTIN 15, 14, LSBPRE, [noparse][[/noparse]x]
LOW 13
degC = x / 2
DEBUG ? degC
PAUSE 1000
GOTO here
LOOP
Does anyone familiar with the DS1620 know of a good way to test if the·IC is damaged?
Thanks!
-N
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks again!
-N
' {$STAMP BS2}
' {$PBASIC 2.5}
x········ VAR···· Word
y········ VAR···· Byte
degC····· VAR···· Word
pDQ······ PIN···· 15
pCLK····· PIN···· 14
pRST····· PIN···· 13
OUTS=%0000000000000000
···· 'fedcba0987654321
DIRS=%1111111111111111
FREQOUT 0, 20, 3800
HIGH pRST
SHIFTOUT pDQ, pCLK, LSBFIRST, [noparse][[/noparse]238]
LOW pRST
PAUSE 1000
HIGH pRST
SHIFTOUT pDQ, pCLK, LSBFIRST, [noparse][[/noparse]172]
SHIFTIN pDQ, pCLK, LSBPRE, [noparse][[/noparse]y]
LOW pRST
DEBUG BIN ? y
DO
· x =· %0000000000000000
· HIGH pRST
· SHIFTOUT pDQ, pCLK, LSBFIRST, [noparse][[/noparse]170]
· SHIFTIN pDQ, pCLK, LSBPRE, [noparse][[/noparse]x\9]
· LOW pRST
· GOSUB NORMALIZE
· DEBUG "DegC=", SDEC degC, ", ", BIN x.BIT8, BIN8 x.BYTE0, CR
· PAUSE 1000
LOOP
NORMALIZE:
· IF (x.BIT8 = 0) THEN
··· degC = x /2
· ELSE
··· degC = x | $FF00
··· degC = -(ABS degC/2)
· ENDIF
· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
-N
www.emesys.com/OL2d1620.htm#thermostat
Once it is in free running thermostat mode 0, you can take the Stamp out of the circuit and observe the on-off output on one of the thermostat pins, e.g., DS1620 pin 7, which goes high when the DS1620 detects a temperature above the programmed threshold.
Experiment with the threshold and see if it agrees with your observation that the chip thinks the temperatures are really cold! I don't see anything wrong with your program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Another interesting tidbit:
I've been busy this last·week and haven't had time to play with the board until today.· We're having a bit of a heat wave in the NW and the outside temp is about 10-15F warmer than when I made the original post about the problem I was having with the ds1620.· The original temp readings I was getting were -60C to -48C (once I thought to look at the signed bit).· When I initially plugged it in again today, after sitting idle for·about 6·days, the readings ranged from 0C to 8C (still incorrect but at least its closer to correct!).
Wacky.
-N
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
My last words shall be - "NOT YET!!!"
Have you had any success yet?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
My last words shall be - "NOT YET!!!"
Thanks!
-N
-N
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I will have to order me one up as well. It's not too surprising that you can get a bad chip, but it sure is frustrating to find out when your new to microcontrollers, and to the tempurature chip.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
My last words shall be - "NOT YET!!!"