Stamp 2 & DS1620

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
Shing
Posts: 34
Joined: Tue Feb 18, 2003 1:01 am
Location: Dublin, Ireland
Contact:

Stamp 2 & DS1620

Post by Shing »

Hi,<p> I am trying to interface the Stamp 2 with the DS1620 Thermometer. I'm using the circuit diagram and the code described by the StampWorks Experiment #28: Measuring Temperature.<p> Unfortunately, the temperature being sent via serial cable to the Debug Terminal Window in the Basic Stamp Editor keeps jumping from 0 degrees to 21 degrees and back again repeatedly.<p> I'm assuming that the 21 degrees is the correct reading but I don't know why it periodically jumps back to 0 degrees. I have rewired the circuit many, many times so I don't think it's an error there. The Stamp 2 is on the Development Board and the DS1620 is on a breadboard.<p> Any enlightenment would be greatly appreciated.<p>Regards,
Wai Shing
dyarker
Posts: 1919
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: Stamp 2 & DS1620

Post by dyarker »

Bottom of page 3 of spec sheet for DS1620.
(http://rocky.digikey.com/WebLib/Dallas/ ... DS1620.pdf)<p>The result is from DS1620 is 9 bits. In 8 bit mode the value is sent in first byte, second byte has 7 zero bits and sign bit. Sign bit is zero for positive temps. So:
21 0 ...1 second ... 21 0<p>Always check the spec sheet!
Dale Y
Shing
Posts: 34
Joined: Tue Feb 18, 2003 1:01 am
Location: Dublin, Ireland
Contact:

Re: Stamp 2 & DS1620

Post by Shing »

But doesn't the following command in the code shift in all 9 bits into a variable in one go?<p>SHIFTIN DQ, Clock, LSBPRE, [tempIn\9]<p>The calculations are then made on that variable. And then that variable is printed once to the debug terminal.<p>Does the debug terminal only display 8 bits at a time at maximum hence briefly disregarding the sign bit?<p>Regards,
Wai Shing<p>[ February 16, 2005: Message edited by: Shing ]</p>
dyarker
Posts: 1919
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: Stamp 2 & DS1620

Post by dyarker »

If you're not pulling the DS1620 RSTnot pin low after nine data bits, then the DS1620 is in 8 bit mode; then the next time the Stamp does SHIFTIN it gets the 7 zero bits and the sign bit.
Dale Y
Shing
Posts: 34
Joined: Tue Feb 18, 2003 1:01 am
Location: Dublin, Ireland
Contact:

Re: Stamp 2 & DS1620

Post by Shing »

But I am pulling the RSTnot pin low after shifting the 9 bits in.<p>So the 9 bits should be stored in a variable on the Stamp 2. I still don't understand why it prints out the temperature and then a zero for each<p>DEBUG SDEC tempC, " C ", CR<p>command.<p>Regards,
Wai Shing
dyarker
Posts: 1919
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: Stamp 2 & DS1620

Post by dyarker »

Is CLK high, low, or continuous after 9 bits?
Dale Y
Shing
Posts: 34
Joined: Tue Feb 18, 2003 1:01 am
Location: Dublin, Ireland
Contact:

Re: Stamp 2 & DS1620

Post by Shing »

RSTnot is pulled low after the 9 bits are sent. I don't know what the state of the CLK is. How do I find out?<p>Regards,
Wai Shing
dyarker
Posts: 1919
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: Stamp 2 & DS1620

Post by dyarker »

CLK/CONVnot is sent by the stamp isn't it?
Dale Y
Shing
Posts: 34
Joined: Tue Feb 18, 2003 1:01 am
Location: Dublin, Ireland
Contact:

Re: Stamp 2 & DS1620

Post by Shing »

Found the problem. Circuit was built on breadboard and noise was corrupting readings.<p>Thanks for your help and sorry for wasting your time.<p>Regards,
Wai Shing
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Stamp 2 & DS1620

Post by philba »

let me guess - you weren't using a bypass cap...<p>Phil
Post Reply

Who is online

Users browsing this forum: No registered users and 149 guests