EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Stop lcd from blinking the words written to it

Stop lcd from blinking the words written to it

|

Microcontroller › PIC › Stop lcd from blinking the words written to it

  • This topic has 3 replies, 2 voices, and was last updated 12 years ago by AJISH ALFRED.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • June 14, 2013 at 11:29 am #2484
    kite
    Participant

    Hello guys , 

    Can someone tell me how to stop the words blinking in my lcd to stop blinking this is the code i use.

    #include<p18f4550.h>
    #include<delays.h>
     
     
    #pragma config FOSC = INTOSC_EC
     
    #pragma WDT = OFF
    #define EN LATDbits.LATD7
    #define RS LATDbits.LATD6
     
     
    void lcdcmd(unsigned char Data);
    void lcdData(unsigned char l);
    void lcdinit(void);
    void waitlcd(int x);
    void prints(const rom char * message);
    void clearLcd(void);
     
    void main(void)
    {
     
    OSCCON = 0b11110010;
     
    TRISD=0;
    TRISB=0;
    EN=0;
    lcdinit();
     
     
    prints(‘HI’);
     
     
     
     
     
    }
    void lcdcmd(unsigned char Data)
    {
    RS=0; //because sending command
    EN=0;
    PORTB =((Data >> 4) & 0x0F);
    EN=1;
    waitlcd(2);
    EN=0;
    PORTB  = (Data & 0x0F);
     
    EN =1;
    waitlcd(2);
    EN=0;
     
     
    }
    void lcdData(unsigned char Data)
    {
    RS=1;  //because sending data
    EN=0;
    PORTB =((Data >> 4) & 0x0F);
     
    EN=1;
    waitlcd(2);
    EN=0;
    PORTB  = (Data & 0x0F);
    EN=1;
    waitlcd(2);
    EN=0;
     
     
     
    }
     
    void lcdinit(void)
    {
    RS=0;
    EN=0;
    PORTB= 0x3;
    waitlcd(40);
    EN=1;
    EN=0;
    waitlcd(5);
    EN=1;
    EN=0;
    waitlcd(5);
    EN=1;
    EN=0;
    waitlcd(2);
    PORTB=0x2;
    EN=1;
    EN=0;
    lcdcmd(0x28);   //set data length 4 bit 2 line
    waitlcd(250); 
    lcdcmd(0x0C); // enable display;   // set display on cursor on blink on
    waitlcd(250);
    lcdcmd(0x01); // clear lcd 
    waitlcd(250); 
    lcdcmd(0x06);  // cursor shift direction
    waitlcd(250);
    lcdcmd(0x80);  //set ram address
    waitlcd(250);
     
     
    }
     
    void waitlcd(int x)
    {
    int i;
    for (x ;x>1;x–)
    {
    for (i=0;i<=110;i++);
    }
    }
     
     
    void prints( const rom char * message)  // Write message to LCD (C string type)
     
    {
     
    lcdcmd(0xE); // enable display;
     
     
     
    while (*message){ // Look for end of string
    lcdData(*message++);
    }
     
     
     
    }
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    June 17, 2013 at 11:27 am #9975
    AJISH ALFRED
    Participant

    Hi Kite,

    The LCD is blinking because your controller resets continuously. To prevent the controller from reset you have to apply an infinite loop like

    while ( 1 )

    {

                ;

    }

     

    I hope modifying your main function like the following will solve the issue

     

    void main(void)
    {
     
    OSCCON = 0b11110010;
     
    TRISD=0;
    TRISB=0;
    EN=0;
    lcdinit();
     
     
    prints(‘HI’);
     
     
    while ( 1 )
    {
          ;
    }
     
     
    }
    June 23, 2013 at 9:45 am #10011
    kite
    Participant

    Thanks Ajish

     

    June 25, 2013 at 4:23 am #10020
    AJISH ALFRED
    Participant

    You are welcome Kite. If you have any further queries please don’t hesitate to share with us.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Raise your hand if your car had one of these: July 8, 2025
  • Tektronix 2235 channel 1 trace unstable July 8, 2025
  • How to make string LEDs? July 8, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz July 8, 2025
  • The Analog Gods Hate Me July 8, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise