LCD can't display second line data

  1. VISHALMISHRA540
    VISHALMISHRA540
    Hi, i am using 2x16 LCD module and interface with AT89S52, when i try to display data on second line , the LCD doesn't work, can someone figure out what's with my code?

    AT OUTPUT I AM GETTING "TSR FACTS PROJCT" ON LCD ONLY.........

    MY CODE IS:-


    #include<reg52.h>
    #define LCDDATA P2

    sbit RS =P0^5;
    sbit RW=P0^6;
    sbit EN=P0^7;
    sbit BUSY=P0^7;
    sbit switch1=P1^0;

    sbit THY1=P1^0;
    sbit com_pin=P1^0;

    bit update_flag=0x12;
    bit timecount_flag=0x11;
    bit zvs_flag=0x12;
    bit zcs_flag=0x12;
    bit lead_flag=0x13;
    bit lag_flag=0x14;

    unsigned char high_count,high_count1;
    unsigned char low_count,low_count1,count,time_count;
    unsigned int Time;
    void Init_LCD();
    void BusyCheck();
    void LCDCMD(unsigned char CMD);
    void LCDData(unsigned char Data);
    void LCDString(unsigned char*str);
    void delay1();
    void Int0_ZVS_ISR(void)interrupt 0
    {
    if(zcs_flag==1)
    {
    zcs_flag=0;
    TR1=0;
    high_count=TH1;
    low_count=TL1;
    timecount_flag=1;
    }
    }
    void Int1_ZCS_ISR(void)interrupt 1
    {
    if(lead_flag==1)
    {
    TMOD|=0X10;
    TH1=0X00;
    TL1=0X00;
    TR1=1;
    zcs_flag=1;
    }
    }
    void INIT_INT01()
    {
    EX0=1;
    EX1=1;
    }
    void Init_Timer0()
    {
    TMOD|=0X01;
    TH0=0X00;
    TL0=0X00;
    }
    void main()
    {
    Init_LCD();
    LCDString("TSR FACTS PROJCT");
    LCDCMD(0Xc0);
    LCDString("VOLT COMNSTION");
    INIT_INT01();
    Init_Timer0();
    delay1();
    while(1)
    {
    if(com_pin==1)
    {
    THY1=1;
    delay1();
    lead_flag=1;

    while(timecount_flag==1);

    lead_flag=0;
    zvs_flag=0;
    zcs_flag=0;
    timecount_flag=0;

    high_count1=high_count;
    low_count1=low_count;
    Time=(((256*high_count1)+low_count1));
    if(Time>3000)
    {
    LCDCMD(0X80);
    LCDString("HIGH VOLTAGE");
    LCDCMD(0Xc0);
    LCDString("CAPACITIVE LOAD");
    }
    }
    if(com_pin==0)
    {
    THY1=0;
    lead_flag=0;
    delay1();
    lead_flag=1;
    while(timecount_flag==1);
    lead_flag=0;
    zvs_flag=0;
    zcs_flag=0;
    timecount_flag=0;

    high_count1=high_count;
    low_count1=low_count;
    Time=(((256*high_count1)+low_count));

    if(Time<3000)
    {
    LCDCMD(0x80);
    LCDString("NORMAL VOLTAGE");
    LCDCMD(0xc0);
    LCDString("COMPENSATE MODE");
    }
    }
    }
    }
    void delay1()
    {
    int p,q;
    for(p=0;p<500;p++)
    for(q=0;q<3000;q++);
    }
    void LCDCMD(unsigned char CMD)
    {
    LCDDATA=CMD;
    RS=0;
    RW=0;
    EN=1;
    EN=0;
    }
    void LCDData(unsigned char Data)
    {
    LCDDATA=Data;
    RS=1;
    RW=0;
    EN=1;
    EN=0;
    }
    void LCDString(unsigned char*str)
    {
    while(*str)
    {
    LCDData(*str);
    str++;
    }
    }
    void Init_LCD()
    {
    LCDCMD(0x38);

    LCDCMD(0x06);

    LCDCMD(0x0C);

    LCDCMD(0x02);

    }
  2. thannara123
    thannara123
    http://circuits-collection.blogspot.in/ search in that forum you may have to find solution
Results 1 to 2 of 2