This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

error in execution

in the below code mov A,80h does not work correctly.There seems to be 0FFh in 80h but
mov A,80h makes A=0;

        MOV     P0,#00H  ; P0=0
        MOV     P1,#01H  ;      P1=1
PLOOP1:
;       CALL    DELAY

PLOOP2:
        MOV     A,P1
        CJNE    A,#0,PLOOP2
PLOOP3:
        MOV     A,P1
        CJNE    A,#1,PLOOP3

        MOV     A,80H
        MOV     A,0A0H
        MOV     A,0A1H
        MOV     A,0A2H
        MOV     A,0A3H
        MOV     A,P0
        CPL     A
        MOV     P0,A
        JMP     PLOOP1

Parents
  • And how would the compiler be involved in what the simulator decides to read back from port pins?

    And what does P1 have to do with the contents read back on P0?

    Don't you think the biggest issue when _you_ get into troubles with a simulator is that _you_ have made assumptions that just are not true?

    But since you are a very experienced developer - you would have to be to make claims that the compiler has a bug - you would probably have a good understanding of the ports on the 8051 chip. What is the "normal" values to write to P0 if you want to use P0 as an input? What is the meaning of writing 0 to P0 and then trying to use P0 as an input?

    Would you care to describe to us the logic behind your code. What _you_ think happens, and if what you do seems consistent with what "all other" code out there seems to do.

Reply
  • And how would the compiler be involved in what the simulator decides to read back from port pins?

    And what does P1 have to do with the contents read back on P0?

    Don't you think the biggest issue when _you_ get into troubles with a simulator is that _you_ have made assumptions that just are not true?

    But since you are a very experienced developer - you would have to be to make claims that the compiler has a bug - you would probably have a good understanding of the ports on the 8051 chip. What is the "normal" values to write to P0 if you want to use P0 as an input? What is the meaning of writing 0 to P0 and then trying to use P0 as an input?

    Would you care to describe to us the logic behind your code. What _you_ think happens, and if what you do seems consistent with what "all other" code out there seems to do.

Children