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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/04/05 19:29
Read: times


 
#89132 - Read on low EN?
Responding to: ???'s previous message
Luc Vandenborre said:
I was tracing the value of Instr in debug mode but the value is always FF. Writing to LCD works fine but reading back from it fails .


Again, I haven't had time to study this too closely, but I did quickly review Keil application note 161. On page 5 they have a diagram that suggests the LCD should be read while EN is high and that data should be written while EN is low. But your code would appear to be reading the LCD while EN is low.

Try modifying the ReadInstrReg code to:

DISPDATA=0xFF;// set port for all inputs
REGSEL=0;// Select inst. register
RDWR=  1; // read mode
ENABLE=1;// enable LCD
_nop_();
Instr=DISPDATA;//read in the data
_nop_();
ENABLE=0;//disable LCD


All I did was move the Instr=DISPDATA instruction into the middle of the nops rather than after ENABLE=0. That way you will be reading the value while EN is high, as the application note suggests.

Good luck.

Craig Steiner


List of 9 messages in thread
TopicAuthorDate
Another LCD question/problem            01/01/70 00:00      
   Read after disable?            01/01/70 00:00      
      Redundant            01/01/70 00:00      
         instruction register can not be read            01/01/70 00:00      
            Read on low EN?            01/01/70 00:00      
               Redundant indeed ;-)            01/01/70 00:00      
                  Oops            01/01/70 00:00      
            Port configuration?            01/01/70 00:00      
               Port configuration            01/01/70 00:00      

Back to Subject List