Help me with PIC16f877a

Discussion in 'Embedded Systems and Microcontrollers' started by Abdo_pc_dr, Apr 4, 2010.

  1. Abdo_pc_dr

    Thread Starter New Member

    Apr 3, 2010
    13
    0
    I need to use pic16f877a to display temperature measured from Lm35 sensor and I need to display the data on an LCD 2X16 (lmb162abc-4)
    but I don`t know how to program PIC to interface the lCD using proton IDE
    can anyone help me Please ?:confused:

    If there were any books to program PIC using proton IDE I need their names:)
     
    Last edited: Apr 4, 2010
  2. Tahmid

    Active Member

    Jul 2, 2008
    344
    25
    Hi,
    If it is possible on your part to use mikroBASIC, take a look at this:
    Code ( (Unknown Language)):
    1. program thermometer452
    2.  
    3. dim LCD_RS as sbit at RB4_bit
    4.     LCD_EN as sbit at RB5_bit
    5.     LCD_D4 as sbit at RB0_bit
    6.     LCD_D5 as sbit at RB1_bit
    7.     LCD_D6 as sbit at RB2_bit
    8.     LCD_D7 as sbit at RB3_bit
    9.  
    10.     LCD_RS_Direction as sbit at TRISB4_bit
    11.     LCD_EN_Direction as sbit at TRISB5_bit
    12.     LCD_D4_Direction as sbit at TRISB0_bit
    13.     LCD_D5_Direction as sbit at TRISB1_bit
    14.     LCD_D6_Direction as sbit at TRISB2_bit
    15.     LCD_D7_Direction as sbit at TRISB3_bit
    16.  
    17. dim ADCResult as longword
    18. dim value as word[3]
    19. dim vstring as string[3]
    20.  
    21. sub procedure GlobInit
    22.     TRISB = 0
    23.     PORTB = 0
    24.     TRISA = 1
    25.     ADCON1 = $4E
    26.     LCD_Init
    27.     LCD_Cmd(_LCD_CLEAR)
    28.     LCD_Cmd(_LCD_CURSOR_OFF)
    29.     LCD_Out(1, 1, "Temp:")
    30.     LCD_Out(1, 15, "'C")
    31. end sub
    32.  
    33. main:
    34.      GlobInit
    35.      while true
    36.            ADCResult = (ADC_Read(0) * 500) >> 10
    37.            value[0] = ADCResult div 100
    38.            value[1] = (ADCResult div 10) mod 10
    39.            value[2] = ADCResult mod 10
    40.            vstring[0] = value[0] + 48
    41.            vstring[1] = value[1] + 48
    42.            vstring[2] = value[2] + 48
    43.            LCD_Out(1, 10, vstring)
    44.            delay_ms(50)
    45.      wend
    46. end.
    http://www.edaboard.com/ftopic367389.html

    I don't know about PROTON books, but mikroElektronika has a free book on programming PICs with mikroBASIC.

    Hope this helps.
    Tahmid.
     
  3. Abdo_pc_dr

    Thread Starter New Member

    Apr 3, 2010
    13
    0
    thanks alot

    if U can send me the full project with the circuit digram
     
Loading...