On Wed, 6 Mar 2002 02:13:35 +0200, "Haris I. Volos" wrote: >Hi! > >I have recently posted a message about controlling an HD44780 display >because I couldn't make my code to work, finally I managed to initialise= the >lcd and display its cursor. > >The problem is when I make the RS(which is connected to RE2) input of = the >LCD high so I can enter characters to the LCD instead of commands, in my >surprise I discover that the RE2 pin goes high only for a very small >fraction of time and then goes back low!!! I have a >bsf PORTE,2 >as the last command prior an endless loop(label goto label) and when I >measure the level in RE2, is low. (I am using RE0 for E and RE1 for RW = lcd >inputs and port B<3-0> for data.) > >After further investigation I discovered if I either set RE1 or RE0 then >output of the pin(RE1 or RE0) is high and the other pin output is low >regardless of its preview state! An if I set RE2 high afterwards all the >pins are low! >Port B status is always what is should be. > >I have checked my circuit no short circuits exists between the pins or >supply rails. > I'd suggest doing your bsf/bcf operations on a 'shadow' register rather than on the port directly. You then write the shadow register's contents to the port. The bsf and bcf instructions (as well as several others) reads in the whole port, modifies the bit you want to change and writes the whole port back out. If a bit that you're not modifying reads back the wrong state, it will be written back out exactly as it was read. This has caused innumerable problems for many people. There's lots of info in the archives on read-modify-write problems. Regards, Bob -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.