digital to analog?

Discussion in 'Embedded Systems and Microcontrollers' started by murph909, Apr 25, 2011.

  1. murph909

    Thread Starter New Member

    Apr 24, 2011
    Im making a c program using mplab, and am using a pic16f887 and tc77 temperature sensor to take the temperature and display it. Right now, I am successfully getting the temperature (comes out in a 13 bit digital answer) but need the program to convert it. Example: 0000 1011 0100 1111 (ignore the last three 1's) is 22.5 degrees Celsius. The chip outputs 0000 1011 0100 1111, I need the program to convert it to 22.5 degrees. I know the pic has an analog to digital converter but thats the opposite of what I need and I am not sure how to use it anyways.

    Any ideas?
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    Why do you want to convert this reading to analog form? Page 9 of the data sheet explains the data format, which is 13 bit 2's compliment. Wikipedia knows all about this -'s_complement

    Convert the reading to BCD and you can display it.