Programming LCD + LDR in PIC16F877A

Discussion in 'Embedded Systems and Microcontrollers' started by Rasya, Oct 8, 2011.

  1. Rasya

    Thread Starter New Member

    Oct 8, 2011
    2
    0
    Hello..i realy need help.i am doing my final project which is the first timer.what i need now is the programming of LCD n PIC and LDR:) irealy need it urgent:(
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,346
    Hello,

    I got this in a mail from you:

    As I have never worked with the pics, I can not help you.

    Bertus
     
  3. Rasya

    Thread Starter New Member

    Oct 8, 2011
    2
    0
    #include<16f877a.h>
    #use delay (clock=20000000)
    #fuses hs, noprotect,nowdt,nolvp
    #define use_portb_lcd TRUE
    #include<lcd.c>

    #byte portb=6
    #byte portc=7
    #byte portd=8


    byte count;



    void main()

    {

    long count=0;

    int sta;
    int stax;
    set_tris_b(0);
    set_tris_c(0b11111111);
    set_tris_d(0);

    lcd_init();
    lcd_putc( "SMART PARKING ");


    portb=0x00;
    portd=0x00;


    do
    {

    if(input(PIN_C0)==0 && sta==1) // bila tekan switch
    {



    sta=0;
    count=count+1;
    lcd_putc("\f");
    portb=printf(lcd_putc, "AVAILABLE:%lu",count);
    if(count>=5&&count<=50)
    {

    lcd_gotoxy(1,1);
    lcd_putc("EXCEED LIMIT....");
    output_high(pin_d0); //buzer on


    }



    }


    ////////////////////////////////////////////////////////////////////////////

    if(input(PIN_C1)==0 && stax==3)
    {



    count=count-1;
    lcd_putc("\f");
    portb=printf(lcd_putc, "AVAILABLE:%lu",count);

    if(count>=51&&count<=65535)
    {

    lcd_gotoxy(1,1);
    lcd_putc("PARKING FULL....");
    output_high(pin_d0);


    }
    else
    {
    output_low(pin_d0);
    }


    }
    if(input(PIN_C0)==1)
    { sta=1; }
    delay_ms(100);



    if(input(PIN_C1)==1)
    { stax=3; }
    delay_ms(100);

    }while(1);

    }
     
Loading...