Murali,

I am guessing that what you are saying is that you can get either the first two lines or second two lines to work, but NOT both at the same time.

I'd say if you are getting all four lines to get something that you are well on your way to success and you have some minor code issues to check.

You could have a couple of things going on there. You may be putting the LCD into a condition where the unit is resetting (initializing), as you do each write cycle. Or you could be doing a screen clear of the opposite set of lines that you are displaying. For example, you might be clearing lines 3 & 4 as you write to 1 & 2 and clearing 1 & 2 as you write to 3 & 4.

My code would be different than what you would use because I am using a BASIC Stamp, but the logic should be the same. In my case, I am clearing lines 1 & 2, then writing to lines 1 & 2. Then I clear lines 3 & 4 before writing to lines 3 & 4.

Rick