+ Post New Thread
Results 1 to 16 of 16
  1. #1
    Banned
    Points: 1,777, Level: 9

    Join Date
    Aug 2011
    Posts
    257
    Helped
    11 / 11
    Points
    1,777
    Level
    9

    LCD display with pic16f877a

    Hello every body,I am trying otinterface my lcd to pic16f877a but as this is the first time I am not coming to the right solution.
    could you please help me to solve the issue.

    I am using CCS C COMPILER OR MPLAB with assembly language.

    Thanks

  2. #2
    Full Member level 5
    Points: 2,442, Level: 11

    Join Date
    Nov 2012
    Location
    yamasukro
    Posts
    300
    Helped
    55 / 55
    Points
    2,442
    Level
    11

    Re: LCD display with pic16f877a

    what did you want to display?



  3. #3
    Banned
    Points: 1,777, Level: 9

    Join Date
    Aug 2011
    Posts
    257
    Helped
    11 / 11
    Points
    1,777
    Level
    9

    Re: LCD display with pic16f877a

    I am using 16*1 Lcd display with pic16f877a ,I want to display "hello" in full screen.
    The codes in assembly and ccs c are welcome.

    My simulation in Proteus has been added here.



    •   AltAdvertisment

        
       

  4. #4
    Advanced Member level 5
    Points: 20,490, Level: 34
    Achievements:
    7 years registered

    Join Date
    May 2009
    Location
    Prime Meridian
    Posts
    3,056
    Helped
    892 / 892
    Points
    20,490
    Level
    34

    Re: LCD display with pic16f877a

    Quote Originally Posted by john120 View Post
    I am using 16*1 Lcd display with pic16f877a ,I want to display "hello" in full screen.
    The codes in assembly and ccs c are welcome.

    My simulation in Proteus has been added here.
    Hi,

    This should get you going, plenty of tutorials on lcds if you search this forum.



  5. #5
    Banned
    Points: 1,777, Level: 9

    Join Date
    Aug 2011
    Posts
    257
    Helped
    11 / 11
    Points
    1,777
    Level
    9

    Re: LCD display with pic16f877a

    I want to display " Hello" alone and then display " World"after the first cleared and so on meanwhile displaying a world at a time and in using only one line not 2 lines mode.

    Thanks!!



  6. #6
    Advanced Member level 5
    Points: 20,490, Level: 34
    Achievements:
    7 years registered

    Join Date
    May 2009
    Location
    Prime Meridian
    Posts
    3,056
    Helped
    892 / 892
    Points
    20,490
    Level
    34

    Re: LCD display with pic16f877a

    Quote Originally Posted by john120 View Post
    I want to display " Hello" alone and then display " World"after the first cleared and so on meanwhile displaying a world at a time and in using only one line not 2 lines mode.
    Hi,

    The code is a complete simple demo of displaying to the most common 16 x 2 display -sure you can work out how to use it with just one line...



  7. #7
    Junior Member level 1
    Points: 300, Level: 3

    Join Date
    Jan 2012
    Posts
    15
    Helped
    0 / 0
    Points
    300
    Level
    3

    Re: LCD display with pic16f877a

    hi if you have not find solution i can help you. tell me!!!



    •   AltAdvertisment

        
       

  8. #8
    Full Member level 5
    Points: 2,442, Level: 11

    Join Date
    Nov 2012
    Location
    yamasukro
    Posts
    300
    Helped
    55 / 55
    Points
    2,442
    Level
    11

    Re: LCD display with pic16f877a

    #include <16f877.h>
    #fuses xt, nowdt, noprotect, noput
    #use delay (clock = 4000000)
    #include "lcd.c“ // include this lcd driver
    void main()
    {
    lcd_init(); // initialize the lcd module
    lcd_putc(“HELLO WORLD \n"); // prints HELLO WORLD in 1st line and returns the cursor to 2nd line lcd_putc(“world "); // prints world in 2nd line
    }



  9. #9
    Banned
    Points: 1,777, Level: 9

    Join Date
    Aug 2011
    Posts
    257
    Helped
    11 / 11
    Points
    1,777
    Level
    9

    Re: LCD display with pic16f877a

    Yes,thanks for your reply,how can I display the resukt of an ADC reading after displaying those lines??
    for example after displaying "World" use a button then the pic reads the adc and display its result on the screen.

    Thanks!!



  10. #10
    Full Member level 5
    Points: 2,442, Level: 11

    Join Date
    Nov 2012
    Location
    yamasukro
    Posts
    300
    Helped
    55 / 55
    Points
    2,442
    Level
    11

    Re: LCD display with pic16f877a

    you need to use ADC of the pic and you must create a functions to do that....



  11. #11
    Advanced Member level 5
    Points: 20,490, Level: 34
    Achievements:
    7 years registered

    Join Date
    May 2009
    Location
    Prime Meridian
    Posts
    3,056
    Helped
    892 / 892
    Points
    20,490
    Level
    34

    Re: LCD display with pic16f877a

    Hi,

    The code shows how to convert your adc result using an Ascii converter subroutine.

    However the ascii converter I have only converts a 8 bits / one byte value into a 3 ascii digits.

    For a full 10bit adc result you will need to search for an ascii converter than will accept 10/16 bits and produce at least 4 digits of ascii output or display the adc result as a series of ten x ones and zeros



  12. #12
    Newbie level 1
    Points: 13, Level: 1

    Join Date
    Feb 2013
    Posts
    1
    Helped
    0 / 0
    Points
    13
    Level
    1

    Re: LCD display with pic16f877a

    hi friend,
    how to write adc program with out using library function



  13. #13
    Banned
    Points: 1,777, Level: 9

    Join Date
    Aug 2011
    Posts
    257
    Helped
    11 / 11
    Points
    1,777
    Level
    9

    Re: LCD display with pic16f877a

    can somebody help me with the codes for getting adc on the lcd using ccs c compiler?

    Thanks!!



  14. #14
    Banned
    Points: 23,048, Level: 36

    Join Date
    Dec 2012
    Location
    Bangalore, India
    Posts
    4,294
    Helped
    830 / 830
    Points
    23,048
    Level
    36

    Re: LCD display with pic16f877a

    You have to save the adc result in an int variable and then convert the int or float value to string and display it on lcd.



  15. #15
    Banned
    Points: 1,777, Level: 9

    Join Date
    Aug 2011
    Posts
    257
    Helped
    11 / 11
    Points
    1,777
    Level
    9

    Re: LCD display with pic16f877a

    [QUOTE=jayanth.devarayanadurga;1199189]You have to save the adc result in an int variable and then convert the int or float value to string and display it on lcd.[/QUOTENormally,I know how to do ADC and display for example on seven segment but now I want to display on LCD see the code below for example on seven segment display it on LCD:
    #include<16f877a.h>
    #device ADC = 10 // Need to tell compiler ADC is configured for 10-bit reading
    #fuses HS,NOWDT
    #use delay(clock=20000000)
    #include
    #include
    #use standard_io(A)
    #use standard_io(B)
    #use standard_io(D)
    #define PORTB
    #DEFINE PORTC
    #define PORTA


    byte const digit[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x9 0};

    char display[2];
    int value;
    unsigned long volt;
    unsigned int value2;

    void main(){
    set_tris_A(0xFF);
    set_tris_B(0X00);
    set_tris_D(0x00);
    output_b(0);
    output_d(0);

    setup_comparator(NC_NC_NC_NC);
    setup_adc(ADC_CLOCK_INTERNAL);
    setup_adc_ports(AN0);
    set_adc_channel(0);
    setup_vref(FALSE);

    while(TRUE){
    delay_us(100);
    //value=read_adc(); //Not required
    read_adc(ADC_START_ONLY);
    delay_us(100);
    value=read_adc(ADC_READ_ONLY);

    volt=(value*500)/1023; //I changed this part of the code
    value2=volt;

    output_low(PIN_D1);
    display[0]=value2/10;
    output_high(PIN_D0);

    output_B(digit[display[0]]);
    delay_ms(10);
    output_low(PIN_D0);
    display[1]=value2%10;
    output_high(PIN_D1);

    output_B(digit[display[1]]);
    delay_ms(10);

    }
    }

    Thanks



    •   AltAdvertisment

        
       

  16. #16
    Banned
    Points: 1,777, Level: 9

    Join Date
    Aug 2011
    Posts
    257
    Helped
    11 / 11
    Points
    1,777
    Level
    9

    Re: LCD display with pic16f877a

    #include <16f877a.h>
    #device ADC=10
    #use delay(clock=4000000)
    #Fuses HS,NOWDT,NOPROTECT,PUT,NOLVP
    #use rs 232(baud=4800,xmit=PIN_C6)
    #bit LED=5.5

    #include

    void main()
    {

    float temperature;
    float temp;
    float value;
    float volt;
    setup_adc_ports( ALL_ANALOG );
    setup_adc(ADC_CLOCK_INTERNAL );
    set_adc_channel( 0 );

    value = read_adc();
    volt = (value / 1023) * 5;
    temp = volt * 100;


    lcd_init();
    set_tris_a(0x1F);
    //set_tris_d(0b11110111);
    set_tris_b(0xff);
    set_tris_c(0xff);
    delay_ms(5);
    lcd_gotoxy(1,1);
    printf(lcd_putc "\fHow");
    delay_ms(1500);
    printf(lcd_putc "\fis it ");
    delay_ms(1500);
    printf(lcd_putc "\ffor ");
    delay_ms(1500);
    printf(lcd_putc "\fyou");
    delay_ms(1500);
    printf(lcd_putc "\fall?");
    delay_ms(5000);
    //printf(lcd_putc "temperature:%3.2f\f",temp);

    printf(lcd_putc,"Temp is:%f",temp);

    }
    see the exercice I am doing but the last line is not printing the temperature on the lcd,what is the syntax for that?

    Help me plz!!



--[[ ]]--