LM35 with pic16f877

Discussion in 'Embedded Systems and Microcontrollers' started by auststud, Mar 28, 2009.

  1. auststud

    Thread Starter New Member

    Mar 25, 2009

    I want to use temperature sensor, LM35 with PIC16F877. There are many programs to connect LM35 with PIC16F877 and then show the result on LCD. I want to display the temperature reading on the Computer through parallel port, as I would be using Serial Port to connect to a mobile.

    I am programming the microcontroller in PicBasic Pro. I am using one pin, AN0 to connect the output of LM35. The A/D conversion is performed. I want to have the result of conversion on PortB (or any other port) and then connect this port to computer through parallel port. The code that I have written is shown below:

    define ADC_BITS 8
    define ADC_CLOCK 3
    define ADC_SAMPLEUS 50

    x var byte
    y var byte
    z var byte

    pause 500

    ADCIN 0,x
    x = x*100 [As for room temperature, I get 0.26V, so multiplying by 100 to get
    26°C, LM35 produces 10mV/°C]
    PortB = x
    output PortB
    pause 500
    goto loop

    Using this code, I dont get the data on PortB. The PortB is all zeros. Can anyone plz tell me the what modification should I do in the program???I dont want to display on the LCD.

    Where is the result of A/D conversion stored in PIC16F877, so that I can connect PortB to it. Plz explain in detail and that it can work.

    Plz help me. Its very urgent...

    Thanx a lot...

    May God bless all of us...