-
1 Attachment(s)
LM35 and PIC16F690
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.
-
Hi, Mihai
the problem is here:
Code:
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
Code:
dummy = 500*temp
grade = DIV32 1024
Alain