how to make the second line of lcd blink?

Discussion in 'Embedded Systems and Microcontrollers' started by edski, Dec 4, 2010.

  1. edski

    Thread Starter Member

    Sep 22, 2010
    65
    0
    pls help...tnx
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    You could have a timer that first displays the text you want then display all spaces.
     
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Writing the message out, waiting half a second, writing out a blank line, wait a half second, etc.

    The update should be done with a timer interrupt rather than a delay() function so inputs aren't ignored during the flashing period.
     
  4. edski

    Thread Starter Member

    Sep 22, 2010
    65
    0
    can you help me how could i be able to do that? i mean, can you please show some example code. pls. thanks
     
  5. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    One Forum w/code and schematic

    I'm not sure where you are at with your project. Is it all connected? Do you have a schematic?

    What language are you using? Can you write to the LCD now (without blinking)?
     
  6. edski

    Thread Starter Member

    Sep 22, 2010
    65
    0
    yes i have the diagram. im using C..yes i can write without blinking..
     
  7. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016

    If you can do that then you are most of the way there. The simple way is to create a loop. First write out your line, delay a bit, then write out a blank line, delay a bit then start the loop all over again.

    The delay does not need to be any thing fancy. It can be a for loop.


    The right way to do it is to setup a timer. The text you write to the lcd would be written to a string variable instead. The timer interrupt routine would have a flag called bWriteBlank. It would be set to false by default. If false the timer interrupt writes the string to the LCD if true it writes a blank line.

    Give it a try yourself first. If you get stuck I will see what I can do about writing the code for you. But you should try yourself first.

    Try the first suggestion I had first then you can move on to the more complicated timer interrupt.
     
  8. maxpower097

    Well-Known Member

    Feb 20, 2009
    795
    388
    If your using a PIC24 there is a cursor function on the LCD. You would just tell it where to go and init the cursor in LcdInit.
     
  9. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    I went ahead and wrote something fo you. But you should really try yourself first.

    The first sample is a simple loop with a delay. The second sample uses a timer interrupt.

    Both samples are based on a PIC18f45k22 with a 1MHZ clock. You may need to make some adjustments to your code to fit your PIC, clock and pinouts.
     
Loading...