Hello guys, I'm new to this forum, however its seems pretty cool. I am having a little trouble with some code I pulled straight from Mazidi's book on the 8051 microcontroller:
ORG MOV A,#38H ; init. LCD 2 lines, 5x7 matrix ACALL COMNWRT ; call command subroutine ACALL DELAY ; give LCD some time MOV A,#0EH ; display on, cursor on ACALL COMNWRT ; call command subroutine ACALL DELAY ; give LCD some time MOV A,#01 ; clear LCD ACALL COMNWRT ; call command subroutine ACALL DELAY ; give LCD some time MOV A,#06H ; shift cursor right ACALL COMNWRT ; call command subroutine ACALL DELAY ; give LCD some time MOV A,#84H ; cursor at line 1, pos. 4 ACALL COMNWRT ; call command subroutine ACALL DELAY ; give LCD some time MOV A,#'N' ; display letter N ACALL DATAWRT ; call display subroutine ACALL DELAY ; give LCD some time MOV A,#'O' ; display letter O ACALL DATAWRT ; call display subroutine AGAIN: SJMP AGAIN ; stay here COMNWRT: ; send command to LCD MOV P1,A ; copy reg A to port 1 CLR P2.0 ; RS = 0 for command CLR P2.1 ; R/W = 0 for write SETB P2.2 ; E = 1 for high pulse CLR P2.2 ; E = 0 FOR H-to-L pulse RET DATAWRT: ; write data to LCD MOV P1,A ; copy reg A to port 1 SETB P2.0 ; RS = 1 for data CLR P2.1 ; R/W = 0 for write SETB P2.2 ; E = 1 for high pulse CLR P2.2 ; E = 0 FOR H-to-L pulse RET DELAY: MOV R3,#50 ; 50 or higher for fast CPUs HERE2: MOV R4,#255 ; R4 = 255 HERE: DJNZ R4,HERE ; stay until R4 becomes 0 DJNZ R3,HERE2 RET END
I put this code into Rigel's Reads51 IDE. When I try to compile/build it using the Reads51 v4 Toolchain I get errors wherever I put anything to do with PORTS (P1, P2.0, etc). These errors are listed as "Unresolved Operand(s)".
However when I try to compile/build the code with the Reads51 v3 Toolchain, the IDE gives no errors.
This is really weird and I'm pretty puzzled by this. Can anyone shed some light on this? |
|