LCD Rountine For Blinking Or Flashing A Set Of String ?

Go To Last Post
21 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

Have search our forum & have not found what I am looking for.
This could be a long shot in dark.

Using the HD44780, 20x4 LCD display in 4 bits mode.
Is there any function to blink or flash or invert a word like "Hello World". (Positive to Negative at about 500mS rate)

I know about the Cursor On & Off method.

Can this be done ?

Any pointers, links, suggestions or snippet of asm code, would be appreciated.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well simplistically the following will probably achieve this but I don't know the HD44780 so can't tell you controller specific ways to do it:

{
  while (1) {
    LCD_putstr("Hello World");
    delay_ms(500);
    LCD_clear_screen();
    delay_ms(500);
  }
}

(but if the controller has RAM definable font characters you could achieve flashing inversion by XORing the entire set of font definitions with 0xFF every half a second or something)

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The HD44780s don't have an inverse mode and you can only define 8 custom characters, so inverse is out. Also, there is no blink mode (except for the cursor) either. The only way to do it would be as clawson said, to alternately write and clear the string manually. If you just wanted one line to blink, you could send a line of spaces instead of a clear_screen command.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Ken,

There is a faster way to toggle the display on/off than writing the DDRAM all the time.
Though I have never done this, the HD44780 controller has a display control register that sets the entire display on/off without affecting the DDRAM data at all.

The command is simple: Holding the register-select (RS) and the read/write (E/W) lines low (0b0), write the command "0b00001DCB", where:
D: Display ON/OFF
C: Cursor ON/OFF
B: Blinking of cursor position character ON/OFF

For example, writing 0b00001000 the controller blanks the entire display without touching the DDRAM contents. Writing 0b00001100 the controller displays the DDRAM contents, hiding the cursor and keeping visible the character pointed by the cursor.

George.

I hope for nothing; I fear nothing; I am free. (Nikos Kazantzakis)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

@cliff

Quote:
LCD_clear_screen()

Do you have the generated assembler code of the command above ?

@ George
I like your idea & will give this ago.
Give me a couple of days to try this out.

Thanks for the help.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Do you have the generated assembler code of the command above ?

One would assume that you already have a routine that sends a command to the LCD (since you need to do this to even initialize it). Simply send the clear_screen command code to the LCD.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

@Steve
Yes, I do have the rest of LCD asm code.
But all I needed was just that extra command that is generated by Cliff's rountine.

{ 
  while (1) { 
    LCD_putstr("Hello World"); 
    delay_ms(500); 
    LCD_clear_screen(); 
    delay_ms(500); 
  } 
}

I was just curious to see this part as I do not want the rest of code. Mainly how Cliff's code is translated to assembler code.

I did a search in the avr-gcc & other C program folders & could not find this "LCD_clear_screen()".
This maybe hand written by Cliff.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
This maybe hand written by Cliff.

No, it is a function of the LCD itself. Just look in the LCD datasheet to see what needs to be sent for a clear_screen command.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

I am aware of the clearing the screen.
But I do not want to clear the whole screen but invert a particular string in any of the line.
In the mean time the screen will display other details.

See below.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ON the face of it is is simple.
You have a function for writting to selected locations and write a selected character, in this case a blank, to the selected locations.
If we assume the locations will be of differing lengths but continuos blocks

Then send Line address, starting character location address, number of locations address and the replacement character.
1 setup the display address to first character.
2 write into it the replacement character
3 decrease the count for number of charaters
4 if result of 3 not 0 write the replacement char else leave.

Keep it simple it will not bite as hard

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My program above was just "psuedo-code" written on the spur of the moment. I don't have LCD_putstr() or LCD_clear_screen() but I kind of guessed that anyone who's interfaced an LCD to an AVR will have a "bag of tools" including such fundamental routines. If you don't have an LCD_clear_screen() but DO have an LCD_putstr("text", line_number) then I guess:

LCD_putstr("Hello World", 3);

would write the string on line 3 while:

LCD_putstr("           ", 3);

would obliterate it and hence the "flashing" effect but I guess this is probably teaching granny to suck eggs at this stage!

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

@suttun & clawson
Both are valid good suggestions.
As you guys pointed out, there are a few ways of doing it.
Really depend on me to decide which mode to be implement.
Either have blank or solid rectangle for each character.
OR
Generate a negative of the character & toggle it between normal & reverse.

Thanks
Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

but isnt there only enough cgram for 8 chars of 8 bytes each? If you only needed 8 chars and their negative, you're golden.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

@Bob
Yes, you are correct.
While browsing through the datasheet & when you reply.
Found the same limitation.

Quote:
While defining a 5x7 dots character:
- Character code bits (DDRAM) 2..0 correspond to CGRAM address bits 5..3
(i.e. 8 possible user defined characters).

If smart enough, I could use the SMS text like the mobile phone.
But will not be suitable for the application I using it for.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Get one of those el cheapo 128x32 graphics lcds, and you can do your own chars any size, reverse, add graphics, go crazy.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

I know this thread is old but the solution I ended up using was at
http://elm-chan.org/junk/graylcd/report.html
All though it is Japanese.
The pictures spell out how it can be done.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's not really inerting characters is it?
There's no green characters with blue background.
It does present a solution to "highlight" one character though.

AFAIK you need a graphic display where a single byte or entire screen can invert by i.e. in assembly using COM instruction.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

Interesting or not does not bother me.
At least it does work in a different manner.
It is better than nothing.
I only raise this, so others might like to use this concept.

Quote:
AFAIK you need a graphic display where a single byte or entire screen can invert by i.e. in assembly using COM instruction.
Agreed.

Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ken,

Maybe I didn't read all posts deep enough...
Got 'hooked' on inverting subject.
The method you displayed a link to open a lot of possibilities to play with the normally rather restricted way character displays are used.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

Lennart, I am glad this was of interest to you.
Yes, it is a very novel setup.
Credit to Elm Chan.

Cheers
Ken

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
...but DO have an LCD_putstr("text", line_number) then I guess:

LCD_putstr("Hello World", 3);

would write the string on line 3 while:

LCD_putstr("           ", 3);

would obliterate it and hence the "flashing" effect but I guess this is probably teaching granny to suck eggs at this stage!

Cliff

I've used this method with just about evey project that I have done that used a HD44780 text based LCD display. It works quite well, though, it does take more then one character to space out the text to be blanked out.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston