Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

TMP100 (I2C) help required

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
tolisn

Bascom Member



Joined: 02 Jul 2005
Posts: 125
Location: Greece

greece.gif
PostPosted: Sat Jul 02, 2005 4:44 pm    Post subject: TMP100 (I2C) help required Reply with quote

Hi.

This is my first post.

Can someone help me access a TMP100 (I2C) temperature sensor with an
AVR 90S4433 using bascom avr basic.

Thanks in advance
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1198
Location: France

france.gif
PostPosted: Sat Jul 02, 2005 9:26 pm    Post subject: Reply with quote

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 Ds1621 = 144
Wait 1
Main:
Cls

I2cstart
I2cwbyte Ds1621
I2cwbyte &HAC 'config protocol
I2cwbyte &H02 'polarity
I2cstart
I2cwbyte Ds1621
I2cwbyte &HA1 'write the TH
I2cwbyte 25 'MSB
I2cwbyte 0 'LSB
I2cstart
I2cwbyte Ds1621
I2cwbyte &HA2 'Write the TL
I2cwbyte 24 'Msb
I2cwbyte 0 'LSB
I2cstart
I2cwbyte Ds1621
I2cwbyte &HEE 'Start
I2cstop
Wait 1
End

Bon courage
JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
ATIU

Bascom Member



Joined: 15 Oct 2004
Posts: 534

philippines.gif
PostPosted: Sun Jul 03, 2005 12:20 am    Post subject: Reply with quote

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
Back to top
View user's profile
tolisn

Bascom Member



Joined: 02 Jul 2005
Posts: 125
Location: Greece

greece.gif
PostPosted: Sun Jul 03, 2005 10:25 am    Post subject: Reply with quote

OK Thanks for your time
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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