| ??? 05/30/02 13:56 Read: times |
#23651 - RE: any way of reading P2 SFR ? |
Peter,
I looked at your previous posts on this topic. Can you explain how to read the P2 latch when executing from internal code space? >>on using external code execution, you can >>never read back P2. >>Please use a function, executed from the >>internal code space, >>to read back P2. >>If no internal code space available: >>1. everytime, if you modify P2, store the >>same value >>to a byte in the internal RAM (= shadow >>register). I don't understand how using the DPTR is going to help reading the P2 latch. Please explain. >>2. use DPTR instead of P2 Surely the JBC instruction in the following method will change the P2 latch contents? >>3. you can read back P2 bitwise with using >>the JBC instruction (see 8051 manual for >>details): >>mov a, #0FFh >>jbc P2.0, tb0 >>clr acc.0 >>tb0: jbc P2.1, tb1 >>... >>tb6: jbc P2.7, tb7 >>clr acc.7 >>tb7: Thanks |



