Pages: [1]   Go Down
Author Topic: Scrolling with custom characters  (Read 1243 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i need to sroll right or left with my custom characters.

i mean, is it possible to set cursor at a value more than 15(in a 16X2 lcd )?

suppose my lcd is filled with some text, when it scrolls left , i can see the custom characters appearing.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i need to sroll right or left with my custom characters.
I believe that the scrolling (actually shifting) will work the same way with the custom characters as it does with the regular ROM characters.

Quote
i mean, is it possible to set cursor at a value more than 15(in a 16X2 lcd )?
As far as the LCD controller is concerned the answer is yes.  BUT- the answer to your question really depends on how the library that you are using deals with the cursor positioning.  

Quote
suppose my lcd is filled with some text, when it scrolls left , i can see the custom characters appearing.
You may be confusing the LCD controller's three types of memory.
  CGROM is used to store the dot patterns for the regular ROM characters.
  CGRAM is used to store the dot patterns for the custom characters.
  DDRAM is used to determine what appears at a specific location on the screen.

When you send an ASCII code to the LCD the ASCII code that you sent is stored in DDRAM.  The LCD controller then uses that code as an address and it goes to either CGROM or CGRAM, whichever is appropriate, to get the specific dot pattern to put on the display. 

The scrolling (shifting) merely changes the normal relationship between the DDRAM addresses and the screen locations.


Don

« Last Edit: January 14, 2013, 11:03:09 am by floresta » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so how do i set the cursor to something like 50 ?
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so how do i set the cursor to something like 50 ?
The answer to your question depends on the library that you are using.

Also - you will have to explain what you mean by '50'.  The LCD controller uses hexadecimal numbers to represent it's memory addresses and hence the location of the character on the display.  Many LCD libraries use two numbers representing the row and column.  Some number them starting with 0 and others starting with 1.  The use of decimal numbers to represent a location on an LCD screen might make sense on a display with a single row of characters but certainly not on a 16x2 display, especially since the addresses are not sequential when going from the top row to the bottom row.


Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i mean, setCursor(50,0) that means, its the 51th (virtual) block
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i mean, setCursor(50,0) that means, its the 51th (virtual) block

What does the second entry, the '0', represent?  

Since you want the 51st virtual block then why aren't you use the number 51 instead of 50?  If you want a dozen eggs do you buy a carton that says it contains 11 eggs?  

If you follow the LCD Addressing link at http://web.alfredstate.edu/weimandn you will find information on how the LCD controller memory addresses map to the screen locations.  Among other things, you will find that the addresses are expressed in hexadecimal not in decimal, and that the relationship between the memory addresses and the screen locations varies when you get beyond the first row of characters depending on the screen geometry.  For the 16x2 displays there is also a gap in the address numbers.

And, once again, the technique for positioning the cursor will depend on the programming language that you are using and, if you are using a library, how the library is written.


Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

th numbering starts from the 0th position,
i dont mean to be rude, but i think i am not wrong
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
th numbering starts from the 0th position,
But you yourself have implied that you start with the number 1 when you count.  Why not let the user enter the position that he wants and have the program subtract '1' to account for the fact that the addresses start from '0'?

Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, that is not important, but how do i set it to 50 or 51?
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2763
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i mean, setCursor(50,0) that means, its the 51th (virtual) block

So did you actually try this?
Or at least look at the code that implements this in
the library you are using?
Go have a look, it is easy to find and you will see how it works.
If using the one supplied with the IDE,
the code is down in {installdir}/LiquidCrystal/LiquidCystal.cpp

It uses the SET DDRAM ADDRESS command.
The final address is created by adding the address for the given row
than adding in the column offset.

In the LiquidCrystal library that comes with the Arduino IDE,
there is no bounds checking on the column parameter.

--- bill
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i mean, setCursor(50,0) that means, its the 51th (virtual) block
Have you followed the link I provided in reply #5 so that you might possibly let us know what you mean by the 51st virtual block in terms of something that relates to an actual display controller?

The way I interpret things this would be DDRAM location 0x4A which is located near the right center of the second row of a 16x2 display, at position (10,1).

Here is how I to do it in assembly language, which is the technique that I prefer to use.  If you use some other method then you will have to reveal what it is, something that you seem reluctant to do.

Code:
   ldi     temp, 0x4A                 ; desired DDRAM address
    ori     temp, 0b10000000           ; convert the plain address to an address instruction
    call    lcd_write_instruction
    ldi     temp, 80                   ; data sheet calls for a delay of at least 40 uS
    call    delayTx1uS

Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

duh!

actually, all of you are right  the code works just fine

i had set it to 510 instead of 51, and it was scrolling all right, but because it was taking a long time to be displayed, i though i d made a mistake

sorry for wasting all u ppl's time

thnx for clearing the (stupid ) doubt i had smiley-razz
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is nice that you have your display working but this thread has succeeded in adding exactly nothing to our store of knowledge to help people in the future.

We still do not know what you were trying to do, how you were trying to do it, how you implemented your changes, what you can now do that you couldn't do before etc, etc, etc.


Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, see
i wanted to use the setCursor (), to set the cursor at some very large number , so it would scroll to be visible after some time .
Logged

Pages: [1]   Go Up
Jump to: