Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to scroll two rows of lcd in different direction?

Status
Not open for further replies.

regin

Junior Member level 1
Joined
Oct 11, 2011
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,430
hi,

i am using 2*16 lcd dispaly connected with 89c51.
please help me by provideing the particlar command or embedded c code.
 

hi,

i am using 2*16 lcd dispaly connected with 89c51.
please help me by provideing the particlar command or embedded c code.

You can use Shifting and continuously send that text to the LCD.
If the text to be displayed is less than 16 characters then pad up more "Blank Spaces" and make it 16 characters long.
Now take a continuous loop and send the text after rotating it every time. This will make the text scrolling that particular line..

---------- Post added at 19:39 ---------- Previous post was at 19:37 ----------

I'm not too sure about this coz I haven't tried something like this. But you can surely attempt this and verify the results in Keil or any other software you use...
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
regin said:
how to scroll two rows of lcd in different direction?

Is this a real world project or you want to do this for learning purposes? I'm asking because I don't know if that can have a practical usage. Imagine two texts, one going from left to right and the other one from right to left. You would be really confused when trying to read those texts...
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
Hello!

Indeed, it looks like some kind of homework.
Anyway, here are a few hints:
You have one string on top and one on bottom.
- Write a function that transforms the top string to another one shifted by n,
n being a number between 0 and 15. Of course, you have to "roll" the end
of the sting to the left.
-> at that point, you can notice that shifting the string right by a is like
shifting the string left by 16-a.

When you are done, you can iterate:
Code:
while(1) {
    scroll(top, a);
    scroll(bottom, 16-a);
    a++;
    a %= 16;
    delay();
}

Dora.
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
hi,

thanks for your replay.
i am doing this for my learning pourpse only.
but still i am confused.
my aim is to scroll a display from right to left in first row and at the same time(set delay but not visible for human eye) scroll another string from left to right in the second row.
 

Hello!

Do you have a problem with the method I proposed?

Dora.
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
There are some interesting commands you may want to use while experimenting, check the following link
LCD Info

In the commands link (HD44780 Commands) you can see some nice effects using the address and shift options

It also has a nice LCD simulator (LCD Simulator {/JavaScipt})

Alex
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
my aim is to scroll a display from right to left in first row and at the same time(set delay but not visible for human eye) scroll another string from left to right in the second row.
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
my aim is to scroll a display from right to left in first row and at the same time(set delay but not visible for human eye) scroll another string from left to right in the second row.

Did you try the logic which I suggested you...????
It will work...
 

Try this, this is only **broken link removed**.
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
Hi regin;

I wrote a simple crossing simulation in 2007 (as my first PIC attempt). Attached.
True, it uses a small PIC and animated user chars but scrolls as you wanted.
Sorry it's in assembly (and not supported now : - ) but the logic is the same I think.

It is working only in Proteus. Try it out if you have this great prog (use also the control mode switch).
It may help you ...
zuisti
 

Attachments

  • crossing.zip
    30.5 KB · Views: 135
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
Hello!

my aim is to scroll a display from right to left in first row and at the same time
(set delay but not visible for human eye) scroll another string from left to right in the second row.

Instead of repeating this endlessly (everybody understood what you want to do), why not
telling us first what you have already done?
1. Are you able to display something on your screen? For instance a character.
2. Are you able to display a string shifted by a certain number of bytes?

Hint: you can implement a roll function.
Supposing your string is originally const char * line = "0123456789ABCDEF", you can
draw it by:
Code:
MoveTo(0,0); // Go to top left
for(i = 0 ; i < 16 ; ++i) WriteChar(line[i]);  // Let's call this line A

Now you can implement a roll function like this:
shiftval is the value you want to shift. If for instance shiftval = 2, then you will
shift all the characters right by 2 and write the 2 last at the beginning of the string.
val is the current index.

Code:
char roll(char shiftval, char val) {
    val += shiftval;
    if(val > 15) val -= 16;
    return val;
}

Then in line A above, instead of WriteChar(line), you just write WriteChar(roll(shiftval, i));

And your line is shifted. Now if you read my first post, you will get the solution to roll
in the opposite direction if you notice that for instance roll(15, i) would exactly roll 1 to the
left.

Now before writing again what you want to do, please TRY BY YOURSELF and then
we can look at what you've done.

Dora.
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
I have some doubts about reasonableness of the intended double scrolled display. Scrolling can be done in full character width steps only, and will look somewhat flickering. It's probably necessary to display a long text in some cases. But bidirectonal in opposite direction?

Anyway, you'll need to rewrite the full display content for each scroll step, so the required programming seems rather straightforward.

P.S.:
Code:
char roll(char shiftval, char val) {
    val += shiftval;
    if(val > 15) val -= 16;
    return val;
}

It seems to me, that you should roll a pointer to line[] rather than the character code.
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
Hello!

It seems to me, that you should roll a pointer to line[] rather than the character code.

Yes, there was an error in what I wrote. So instead of this:

Then in line A above, instead of WriteChar(line), you just write WriteChar(roll(shiftval, i));

I should have written this:

Then in line A above, instead of WriteChar(line), you just write WriteChar(line[roll(shiftval, i)]);

That's it!

Dora.
 
  • Like
Reactions: regin

    regin

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top