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

Back to Subject List

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


 
#67018 - Errors In 4 Bit - LCD tutorial
There is an error in 4 Bit LCD tutorial
The equates at the start are
DB4 EQU P1.4
DB5 EQU P1.5
DB6 EQU P1.6
DB7 EQU P1.7
EN EQU P3.7
RS EQU P3.6
RW EQU P3.5
DATA EQU P1
which indicates that the data lines are connected to high nibble of port1. but in the WRITE_2_NIBBLES function shown below ORL A,#0F0h sets the high nibble of accumulator to F and low nibble is retained. The next instruction ANL DATA,A doesn't affect high nibble of P1 and low nibble of P1 is the low nibble of data to be sent. I experimented with this code and it doesn't work. When I changed the
ORL A,#0F0h
to
ORL A,#0Fh it works fine

The code in tutorial
WRITE_2_NIBBLES:
PUSH ACC ;Save A for low nibbleORL DATA,#0F0h ;Bits 4..7 <- 1
ORL A,#0F0h ;Don't affect bits 0-3
ANL DATA,A ;High nibble to display
SETB EN
CLR EN
POP ACC ;Prepare to send
SWAP A ;...second nibble
ORL DATA,#0F0h ; Bits 4...7 <- 1
ORL A,#0F0h ; Don't affect bits 0...3
ANL DATA,A ;Low nibble to display
SETB EN
CLR EN
RET

Correct Version:
WRITE_2_NIBBLES:
PUSH ACC ;Save A for low nibbleORL DATA,#0F0h ;Bits 4..7 <- 1
ORL A,#0Fh ;Don't affect bits 0-3
ANL DATA,A ;High nibble to display
SETB EN
CLR EN
POP ACC ;Prepare to send
SWAP A ;...second nibble
ORL DATA,#0F0h ; Bits 4...7 <- 1
ORL A,#0Fh ; Don't affect bits 0...3
ANL DATA,A ;Low nibble to display
SETB EN
CLR EN
RET

Earlier also this issue was raised by a guy called Hatim but no corrections have been made in tutorial I request the moderator of this site to Please...
1. Either make the necessary changes in code to correct it.
2. Or atleast Delete off the 4bit lcd tutorial don't keep such a misleading tutorial.



List of 14 messages in thread
TopicAuthorDate
Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
   RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
      RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
   RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
      RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
         RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
            RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
               Craig when are going to correct it.            01/01/70 00:00      
   RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
      RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
         RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
            RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
            RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      
               RE: Errors In 4 Bit - LCD tutorial            01/01/70 00:00      

Back to Subject List