1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

temperature sensor LM35

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by civictypeR, Dec 6, 2007.

  1. theertock

    theertock New Member

    Joined:
    Oct 20, 2010
    Messages:
    1
    Likes:
    0
    i have some confiusing question..
    for my project im use pic 16f877 with lcd n lm35 sensor..
    i have their code for mplab and c++ only..
    who can help me how to change it to microchip stdio compiler?

    the code is:

    Device 16F877A
    Declare XTAL 4


    Declare LCD_TYPE 0 ' Type of LCD Used is Alpha
    Declare LCD_DTPIN PORTB.4 ' The control bits B4,B5,B6,B7
    Declare LCD_RSPIN PORTB.2 ' RS pin on B2
    Declare LCD_ENPIN PORTB.3 ' E pin on B3
    Declare LCD_INTERFACE 4 ' Interface method is 4 bit

    Dim ADC_Result As Float
    Dim Temp_Float as Float

    ADCON1 = %10000000 ' Set all to analogue inputs (PORTA)
    TRISA = $FF ' Declare porta as all inputs
    Delayms 150
    Cls

    Main:

    ADC_Result = ADIN 0
    Temp_Float = ADC_Result * 5000 / 1023 ' to reduce decimal error
    Print At 1,1, Dec1 Temp_Float , 0, "C "

    Return
     

Share This Page