I have a meager understanding of this subject so bear with me. I've been trying to get a Basic stamp to talk to a 1wire maxim DS1822 temperature sensor with no success. With a huge number of trials I always get the same data back from the sensor. (several different sensors, wirings, temperatures at sensor) See below for output of data bits and program listing.
I keep checking one more theory per day. Its got me pissed, I'm going to crack this nut if it kills me. Today's theory, "Maybe the command to tell the DS1822 sensor to resample temp. isn't working " It would be this command: 'Send Convert Temperature command OWOUT OWpin, OWFERst, [SkipROM, ConverT]
If the sensor never resamples, it would explain why I always get the same data IF they come factory preset here.
OK, for the bit head types out there. How does one check if a sensor is receiving and acting on a bit level command? I must be getting data from the unit as its a non random string of 0 and 1.
Karl
Data sheet:
- Output of stamp program
1
1
1010000
101
1001011
1111111
11111111
111100
1000000
1110000
11111100
- program listing
' File...... ds1920.bsp ' Purpose... Measuring of Temperature with DS1920 iButton ' Author.... Claus Kuehnel ' Started... 2001-08-11 'CHOPPED UP FOR DIAGNOSIS 1 26 10
' '{$STAMP BS2px} 'specifies a BS2p ' -----[ Constants ]------------------------------------------ ' OWpin CON 15 '1-wire device pin
OWFERst CON %0001 'Front-End Reset OWBERst CON %0010 'Back-End reset OWBitMode CON %0100 SkipROM CON $CC 'Skip ROM Command ReadScratch CON $BE 'Read Scratch Pad ConverT CON $44 'Convert Temperature ' -----[ Variables ]------------------------------------------ ' temp VAR Word 'Temperature Value CRem1 VAR Byte CRem2 VAR Byte CRem3 VAR Byte CRem4 VAR Byte CRem5 VAR Byte CRem6 VAR Byte CRem7 VAR Byte CRem8 VAR Byte CRem9 VAR Byte
' -----[ Initialization ]------------------------------------- ' init: PAUSE 1000 'open debug window
' -----[ Main Code ]------------------------------------------ ' Start: 'Send Convert Temperature command OWOUT OWpin, OWFERst, [SkipROM, ConverT]
DEBUG CLS CheckForDone: 'Wait until conversion is done PAUSE 2 OWIN OWpin, OWBitMode, [Temp] DEBUG CR, BIN temp 'conversion time IF Temp = 0 THEN CheckForDone 'Send Read Scratch Pad command OWOUT OWpin, OWFERst, [SkipROM, ReadScratch] OWIN OWpin, OWBERst, [CRem1,CRem2,CRem3,CRem4,CRem4,CRem5,CRem6,CRem7,CRem8,CRem9]
DEBUG CR, BIN Temp DEBUG CR, BIN CRem1 DEBUG CR, BIN CRem2 DEBUG CR, BIN CRem3 DEBUG CR, BIN CRem4 DEBUG CR, BIN CRem5 DEBUG CR, BIN CRem6 DEBUG CR, BIN CRem7 DEBUG CR, BIN CRem8 DEBUG CR, BIN CRem9
PAUSE 5000 'next measurement in 5 sec GOTO Start