Sorry, I try to read the data sheet and I did not understand,
no array of orders
no examples
please use the DS1621 or DS1631 from Dallas it is very similar. but to use it you have only to follow the example and the data sheet is very clear !
following haw I use it as thermostat:
'JP duval use of DS1621 thermometer/ thermostat with a 2313 26/06/05
' - -µp Configuration - - - - - - - - - - - - - - - - - - - - - -
$crystal = 8000000
'lcd configuration
Config Lcdmode = Port ' config 4 bit
Config Lcdpin = Pin , Db4 = Portb.3 , Db5 = Portb.2 , Db6 = Portb.1 , Db7 = Portb.0 , E = Portb.4 , Rs = Portb.5
Config Lcd = 16 * 2
'--I2C configuration --------------------
Config Sda = Portd.0 ' I2C Data.
Config Scl = Portd.1 ' I2C Clock.
'les variables---------------------------------
Dim Jbyte As Byte 'generic
Dim Nb_write As Byte ' index of (buffer_wr) in the buffer
Dim Buffer_wr(10)as Byte 'array of reception on messge
Dim Size_message As Byte ' size of message returned
Const TMPWrite = &B10010000 'ADD1 and ADD0 GND, Table XI of Datasheet
Const TMPRead = &B10010001
Const TMPConfig = &B00000001
Const TMPTemp = &B00000000
Const TMPTLow = &B00000010
Const TMPTHigh = &B00000011
Dim Temp_H Dim Byte
Dim Temp_L Dim Byte
Dim Temperature As Integer
Wait 1
' Initialize TMP100
I2cstart
I2cwbyte TMPWrite
I2cwbyte TMPConfig
I2cwbyte &B01100010 'Change configuation register to your design page 6 of Datasheet
I2cstart
I2cwbyte TMPWrite
I2cwbyte TMPTLow 'Write lower temp limit for comparator or thermostat mode
I2cwbyte &B00000000 '0 Celcius lower limit
I2cwbyte &B00000000
I2csstart
I2cwbyte TMPWrite
I2cwbyte TMPTHigh 'Write higher temp limit for comparator or thermostat mode
I2cwbyte &B01100100 '100 Celcius Higher limit
I2cwbyte &B00000000
I2cstart
I2cwbyte TMPWrite
I2cwbyte TMPTemp 'Change pointer to Temp register since last access was Temp High register
I2Cwstop
Waitms 500 'Delay to read temp
' To Read temp from temperature register, can be declared as subroutine
I2cstart
I2cwbyte TMPRead
I2crbyte Temp_H
I2crbyte Ack 'Acknowledge first byte
I2crbyte Temp_L
I2cstop
Temperature = Makeint (Temp_H, Temp_L)
' You need to reset pointer back to temperature register if you do other write to other TMP registers
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum