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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/27/08 14:11
Read: times


 
#154035 - Some code comments first.
Responding to: ???'s previous message
In your code you are enabling several interrupts and the global interrupt enable but you have not allocated the interrupt vectors for either of the timer 0 or for external interrupt 1. I also do not see interrupt handlers for either. This is a problem.

When you initialize the four P0, P1, P2, and P3 ports you are setting then such that ALL port bits are going to be outputting a LOW level. Normally we initialize ports to 0FFh so that bits are inputs and this rise high due to the quasi-bidirectional nature of 8052 pins. This initialization is probably permanently asserting the INT1/ for which you have no handler defined.

When you call the WRITE_LCD the target routine ends with a sjmp $. It really seems like it would be better to move the SJMP to just after the LCALL WRITE_LCD and then equip the WRITE_LCD with a RET instruction.

In the WAIT_LCD routine you are setting the LDCDATA lines as inputs, i.e. making the port be equal to 0FFh, after you have already started the read cycle by setting EN high. This causes bus conflict with the LCD which is not an open drain type output. You need to setup the bus direction BEFORE you assert EN.

Also in the WAIT_LCD routine it seems a bit strange to have the wait loopback occur from inside the strobe enabled state back up to the top where the strobe assertion is done again. You should look at how the LCD controller functions but I suggest either loop back inside the strobes asserted logic or shut off the strobes each time before looping back to try again. A matter of cleaner programming.

Ok...now I'll move on to looking at your second link.

Michael Karas




List of 21 messages in thread
TopicAuthorDate
Damaged LCD?            01/01/70 00:00      
   Some code comments first.            01/01/70 00:00      
      Thanks...            01/01/70 00:00      
         Well if you need it later...            01/01/70 00:00      
            Hmmpf.            01/01/70 00:00      
               Multiple Problems            01/01/70 00:00      
                  My Bad!!!            01/01/70 00:00      
                  :) some improvement            01/01/70 00:00      
               try to initialise at startup            01/01/70 00:00      
                  Wahey...... O not quite            01/01/70 00:00      
                     Hex value            01/01/70 00:00      
                     Check your soldering.            01/01/70 00:00      
                     Oops            01/01/70 00:00      
                        Wahey..... o not AGain            01/01/70 00:00      
                           Leading 0            01/01/70 00:00      
                           Leading zero            01/01/70 00:00      
                     Some help            01/01/70 00:00      
                        Cheers guys, all working now            01/01/70 00:00      
                           Why You Were Content Dependant            01/01/70 00:00      
   The filled in blocks indicate..            01/01/70 00:00      
   No hardware but software problem            01/01/70 00:00      

Back to Subject List