LM35 and PIC16F690


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    8

    Default 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.
    Attached Files Attached Files

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi, Mihai

    the problem is here:

    Code:
       grade=(5*temp*100)/1024
    you declared " Grade " as a byte, and " grade " is obviously > 500 !!!

    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
    Last edited by Acetronics2; - 26th June 2010 at 19:06.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts