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

PORT PROBLEM!!!!

Hi everyone.....
Hope u r fine.......
I have a problem in the following code

ORG 00H
BACK:MOV A,#55H
MOV P1,A
ACALL DELAY
MOV A,#0AAH
MOV P1,A
ACALL DELAY
SJMP BACK
DELAY:
MOV R3,#70
H2:MOV R4,#254
H1:DJNZ R4,H1
DJNZ R3,H2
RET
END


Now if i see the output in port P1
I see that
P1:0xAA then 0X55 then 0XAA then 0x55 (repeat continuously......)toggling
Pins:0xAA then 0X55 then 0XAA then 0x55 (repeat continuously......)toggling
Now if i modify my program by just replacing
port P1 by port P0 in all lines
and now if i see output in port P0
i see that..
P1:0xAA then 0X55 then 0XAA then 0X55 (repeat continuously......)toggling
pins:there is no change or toggling
Why is it so??????
Why is there no toggling in output window of port p0 under pins:
pins:No change
P0:toggling
plz help me out......

Parents
  • At this time I suggest that you spend a little time on the basic 8051 hardware structure. These document links will give you a good introduction to the 8051 devices. Links taken from Erik's reply to thread 6922.

    Chapter 1
    www.semiconductors.philips.com/.../
    various/80C51_FAM_ARCH_1.pdf

    chapter 2
    www.semiconductors.philips.com/.../
    various/80C51_FAM_PROG_GUIDE_1.pdf

    chapter 3
    www.semiconductors.philips.com/.../
    various/80C51_FAM_HARDWARE_1.pdf

    Also, go to http://www.8052.com for on-line tutorials.
    That said the Keil Debugger simulates both the port latch and the the I/O pins. The port latch stores the last value written to the port by the internal CPU firmware. There are a number of 8051 instructions that read the current port value before modifying the port value. These are called read-modify-write instructions.
    The are built into the firmware. The programmer has no control over this action. Notice the write operation.
    On a read operation, the firmware reads the actual pin value.
    So the Keil Debugger simulates the actual 'pins' with the pin dialog and the port latch with the port dialog.

Reply
  • At this time I suggest that you spend a little time on the basic 8051 hardware structure. These document links will give you a good introduction to the 8051 devices. Links taken from Erik's reply to thread 6922.

    Chapter 1
    www.semiconductors.philips.com/.../
    various/80C51_FAM_ARCH_1.pdf

    chapter 2
    www.semiconductors.philips.com/.../
    various/80C51_FAM_PROG_GUIDE_1.pdf

    chapter 3
    www.semiconductors.philips.com/.../
    various/80C51_FAM_HARDWARE_1.pdf

    Also, go to http://www.8052.com for on-line tutorials.
    That said the Keil Debugger simulates both the port latch and the the I/O pins. The port latch stores the last value written to the port by the internal CPU firmware. There are a number of 8051 instructions that read the current port value before modifying the port value. These are called read-modify-write instructions.
    The are built into the firmware. The programmer has no control over this action. Notice the write operation.
    On a read operation, the firmware reads the actual pin value.
    So the Keil Debugger simulates the actual 'pins' with the pin dialog and the port latch with the port dialog.

Children