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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/23/05 07:56
Read: times


 
#92219 - LCD problems
Responding to: ???'s previous message


Thomas,

I think you may have a problem in your code around here:

[pre]
WRITE_2_NIBBLES1:
PUSH ACC ;Save A for high nibble
ORL DAT,#0Fh ;Bits 0..3 = 1
****** the following line will set bits 0..3!!! ******
ORL A,#0Fh ;Don't affect bits 4-7
****** maybe this should go some way to fix it !!!
ANL A,#0fH


SWAP A ;Swap high nibble into low region
ANL DAT,A ;High nibble to display
SETB EN1
NOP
[/pre]

Just a couple of other comments - you rarely need to read from the lcd so you can eliminate the code & r/w port pin.

The routine names 'write_2_nibbles' doesn't tell us much - we want the routine to 'hide' the actual operation of writing to the lcd display. Something like 'write_lcd' may be more meaningful and doesn't need a comment, the name says it all. Then you can expand that to 'write_lcd_cmd' and 'write_lcd_data'. The higher levels of code don't or shouldn't care how you write to the lcd. When you work on large assembler projects, having subroutine names that actually tell you something makes it easier to write and maintain code.

I suggest you run your code through a simulator to check your code - its always good practice to make sure your code does what you expect it to do!




List of 6 messages in thread
TopicAuthorDate
HD44780 showing garbage            01/01/70 00:00      
   LCD problems            01/01/70 00:00      
   embarassing            01/01/70 00:00      
      Congradulations, You are the first.            01/01/70 00:00      
         honesty with respect to admitting errors            01/01/70 00:00      
         We're all human            01/01/70 00:00      

Back to Subject List