Help!! Integer Math?


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Posts
    37

    Default Help!! Integer Math?

    I have been racking my brain for the past two weeks with the following!

    I have a PIC12F675 reading an AD595 thermocouple IC. The AD595 provides 10mV/C. In order to read the temp below 0 I have added a voltage divider to the ground pin of the AD595. I have also power the AD595 via a -5V to +5V power supply. I read the output of the AD595 on GPIO.0 and the Virtual Ground voltage via GPIO.1.

    To read the temperature above 0C I basically subtract GPIO.1 from GPIO.0. I cannot get the math correct for any thing below 0C or 32F.

    Here is some of the code:
    'celsius
    'farenheit
    'adval = GPIO.0
    'adval1 = GPIO.1

    if adval > adval1 then
    celsius = adval - adval1
    farenheit = (celsius * 18) / 10
    farenheit = farenheit + 32
    else
    adval_C = adval1 - adval
    adval_F_18 = (adval_C * 18)/10
    adval_F_32 = (adval_F_18 + 32)
    check = 0
    endif

  2. #2
    Join Date
    Jun 2005
    Location
    Mumbai,India
    Posts
    43


    Did you find this post helpful? Yes | No

    Exclamation Its not Maths problem

    Hi,
    U don't need racking Ur brain! As U have connected AD595 to +/- supplies
    the output below 0 degrees Celesius is -ve. There is no problem in Basic
    program. PIC A/D inputs cant read below 0V or GND of +5V supply. U just connect AD595 to only +5V and let 0degree celesius be at 2.5V and modify
    program for offset and it will work.Or u take one OPAMP and shift output of
    AD595 to some suitable value.
    Let me know if u have any other problem.
    psdayama

Similar Threads

  1. Resolution integer math assistance?
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th January 2010, 03:01
  2. Replies: 5
    Last Post: - 28th May 2008, 10:20
  3. Pulsin Math question
    By ruijc in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd April 2008, 16:15
  4. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 10:22
  5. Help!! Integer Math?
    By scottl in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd July 2006, 14:49

Members who have read this thread : 1

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