Hi, scs83,
I forgot one thing: you also need to tell the HD44780 during the initialization sequence (lcdinit routine) that there are 2 lines on the display.
Here is the modification to the original code:
================================================
; Finally,
; At this point, the normal 4 wire command routine can be used
;ldi wreg,0b00100000 ;Function set, 4 wire, 1 line, 5x7 font
;I commented out the previous line, which now becomes:
ldi wreg,0b00101000
rcall lcdcmd
================================================
The rest stays the same. And as I said previously, when you want to move to the second line you first need to set the DD RAM address to 40H. This can be done like this:
ldi wreg,0b11000000
rcall lcdcmd
One thing I noticed about this program is that id does not use equates. That makes modifications really awkward, because if the same constant is used in several places and you need to change it, then you have to chage it manually at all locations. If you forget one location, you can get a bug. It may not be ovious immediately, but it will show up eventually.
Therefore, take my advice: use equates. For example:
LCD_FSET EQU 0b00101000 ; LCD function set command
CRLF_CMD EQU 0b11000000 ; LDC CR+LF command (carriage return + line feed, for lack of a better definition; in fact this is what the command does, it returns the cursor to the beginning of second line)
With these, the modification to the code would read:
ldi wreg, LCD_FSET ; set LCD function to 4 wire interface, 2 lines, 5x7 char.
To start displaying on the second line, you would code:
ldi wreg, CRLF_CMD ; send CRLF command
rcall lcdcmd;
Now that is more readable, too, even without the comment. Should you find that you made a mistake when you defined CRLF (or other constant), all you need to do is change the EQU line and reassemble the program. The assembler will do the substitution for you at ALL locations, no misses.
One more thing: apparently this program uses a lot of hard-coded constants, including the number of characters per line, which means you may need to change that, too. Use EQU's.
Sorry for such a lengthy reply. I thought this might help.
Let me know if you have success with this.