PDA

View Full Version : LM35 and PIC16F690



Mihai Popa
- 26th June 2010, 09:28
Hello.
I need some help. I want to build a PIC16F690 and LM35 thermometer, but fail to properly setes ADC conversion and relationship. I realized I applied input assembly and a Trimmer 150mV and indication on the display is 501. And not really understand why. Any advice is welcome.

Acetronics2
- 26th June 2010, 18:44
Hi, Mihai

the problem is here:



grade=(5*temp*100)/1024


you declared " Grade " as a byte, and " grade " is obviously > 500 !!! :rolleyes:

so, here, you need to use DIV32 ... as somewhere in the operation you will get an overflow over 65535 ... ( > WORD )

declare
grade VAR WORD
dummy VAR WORD

and try, as a calculation


dummy = 500*temp
grade = DIV32 1024


Alain