Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 13th October 2009, 03:34 PM   #16
Default

Yes, to do the conversion you add 32 but your value is twice as big as it should be and so you have to add 64.

Consider 20C, the chip will return 40 which gets divided by 2 and so 20 is displayed. When you multiply the 40 by 9, divide by 5 and add 64 you get 136 which will be displayed as 68F. Doing it without it being doubled, 20*9/5+32=68 which is correct.

Mike.
Pommie is online now  
Old 13th October 2009, 04:06 PM   #17
Default

Is this an LM75 or LM75A? I was wondering why you were shifting 7 bits and your calcs were different until I realized I was using the 11bit return from the LM75A.
__________________
Mark Higgins
DirtyLude is online now  
Old 13th October 2009, 04:18 PM   #18
Default

Quote:
Originally Posted by DirtyLude View Post
Is this an LM75 or LM75A? I was wondering why you were shifting 7 bits and your calcs were different until I realized I was using the 11bit return from the LM75A.
Interesting question. I'd assumed the A as that is what Jason posted information from but in the text he states the bd which returns 11 bits. However, the code should work with either as the LSBs will get shifted out.

The code is a little lazy, it shifts the MSB left 8 so the sign bit is in the correct position and then shifts right 7 to preserve the sign.

Mike.
Pommie is online now  
Old 13th October 2009, 07:01 PM   #19
Default

im using the lm75BD (not A)

Also if i divide the number by 2 is the 64 needed?
AtomSoft is offline  
Old 13th October 2009, 09:03 PM   #20
Default

Can you post the circuit how you interfacing the LM75 to PIC pin? What PIC you using, can you measure the voltage at the output pin of LM75 with and without connecting it to the PIC A/D input?

-Raj
Experiments with PIC16F628A
rajbex is offline  
Old 13th October 2009, 09:21 PM   #21
Default

sure but in a bit. i haveto get son from daycare. You just reminded me about ADCON1 there... i need to check if i set it to digital. im sure i did but heh you never know.

The LM75 i got was a sample. They sent me 2 for free since i buy from mouser a lot.

The MCU im using is a PIC18F2525. Im using the SCL and SDA lines i think .. i know its RC3 and RC4.

The Address lines A0:A2 are grounded. Not pull down (straight to gnd). The GND is gnd and the VS+ is 5v.

The OS line isnt connected at all. Ill make a schematic when i come back ok. or maybe now since i got 30 min until i leave. Let me see if i can draw one up fast.
AtomSoft is offline  
Old 13th October 2009, 09:35 PM   #22
Default

Here is my schem:
Attached Thumbnails
LM75 Help please-temp.jpg  
AtomSoft is offline  
Old 13th October 2009, 09:41 PM   #23
Default

using:
Code:
    temp*=9;
    temp/=5;
    temp+=64;
With the gnd connected to IC i get 480F lol and with ground off i get about 81F
AtomSoft is offline  
Old 13th October 2009, 09:46 PM   #24
Default

Quote:
Originally Posted by rajbex View Post
Can you post the circuit how you interfacing the LM75 to PIC pin? What PIC you using, can you measure the voltage at the output pin of LM75 with and without connecting it to the PIC A/D input?

-Raj
Experiments with PIC16F628A
Maybe you should look at the datasheet and previous conversation before trying to help. LM75 is a digital temp sensor, not a analogue one.

I wouldn't mind seeing all the code again to see if I can figure out what's going on. I'm having trouble fitting the pieces that have been posted together. Pommie's code is using 9bits, which gives 0.5 deg resolution.

I'm using 11bits, but I don't need to convert to Fahrenheit so calculation is not such a big deal for me.
__________________
Mark Higgins
DirtyLude is online now  
Old 13th October 2009, 09:49 PM   #25
Default

Ill post a zip:

The Proteus stuff is just crap from another project heh dont mind it
Attached Files
File Type: zip Temp.zip (126.5 KB, 4 views)
AtomSoft is offline  
Old 13th October 2009, 09:56 PM   #26
Default

ok i replaced the IC with the second one and it shows 52.5F with ground and 81.5F with out gnd
AtomSoft is offline  
Old 14th October 2009, 03:18 PM   #27
Default

I don't see anything specific with the code itself.

Does the temp reading change when you put your finger on the chip to warm it up, or is the reading static?

My Math is terrrible. I'll put your fahrenheit conversion into my own code tonight and try it out.

I have to say, using the logic analyser with the protocol analysis has made this kind of debugging so much easier for me. I gave up on so many of these things before I was able to just look at what I was getting and have it explained using the analysis software what's going on.
__________________
Mark Higgins
DirtyLude is online now  
Old 14th October 2009, 03:43 PM   #28
Default

heh i need to get me one of those :

Saleae Logic. The Logic Analyzer, Remastered. Now shipping for $149

But never remember to save the money for it heh....

The temp is always fluctuating from 81F-82.5F

When i place my finger on the device it changes a few degrees to about 83F-85F
AtomSoft is offline  
Old 14th October 2009, 03:49 PM   #29
Default

Quote:
Originally Posted by DirtyLude View Post
Maybe you should look at the datasheet and previous conversation before trying to help. LM75 is a digital temp sensor, not a analogue one.

I wouldn't mind seeing all the code again to see if I can figure out what's going on. I'm having trouble fitting the pieces that have been posted together. Pommie's code is using 9bits, which gives 0.5 deg resolution.

I'm using 11bits, but I don't need to convert to Fahrenheit so calculation is not such a big deal for me.
Sorry, Mark. I totally messed it up with another post that uses LM35. You are right, LM75 is a digital sensor.
- Raj
Experiments with PIC16F628A
rajbex is offline  
Old 14th October 2009, 05:00 PM   #30
Default

Thanks tho Raj.. I like the fact you tried to help at least. i rather have someone jump in than just look heh ... thanks again


Nice Blog!

Last edited by AtomSoft; 14th October 2009 at 05:01 PM.
AtomSoft is offline  
Reply

Tags
lm75

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
interfacing Atmel Microcontroller AT89C51 with LM75 umar abdul sattar Micro Controllers 0 28th June 2003 06:27 AM



All times are GMT. The time now is 01:47 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker