Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/28/07 12:34
Read: times


 
#141318 - What exactly do you mean?
Responding to: ???'s previous message
You're not getting the second line? How are you determining this?
With the usual lcd units, the first and second lines are not sequential so once you go past the 16th char on the first line, it won't go to the second line. for the first line, the command to locate the cursor is 0x80 + offset, for the second line the command is 0xc0 + offset. The following code copes with a 4 line display. I would suggest you read the relevant datasheet that explains all of this.

//----------------------------------------------------------------------------
//
//  Locate the lcd cursor. cursor position (0..max) in pos
// eg: for a 16 char * 2 display :- 0..15 is the top line, 16..31 is the bottom line
//
//----------------------------------------------------------------------------
void locate_cursor(char pos)
{
char a;

  a = pos % NUM_CH_LINE;
  switch(pos / NUM_CH_LINE)
    {
    case 0:
        lcd_comm_wr(a + 0x80);
        break;
    case 1:
        lcd_comm_wr(a + 0xc0);
        break;
    case 2:
        lcd_comm_wr(a + 0x94);
        break;
    case 3:
        lcd_comm_wr(a + 0xd4);
        break;
    }  
}         


List of 2 messages in thread
TopicAuthorDate
problem in 4 bit routine for lcd            01/01/70 00:00      
   What exactly do you mean?            01/01/70 00:00      

Back to Subject List