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

P3.5 not changing its state

hi to all i am using at89c55wd
the problem is when i tried to toggle the P3 all bit i.e. P3.0,1,2,3,4,6,7 changes its state expect P3.5
i used timer 0 as timer after 1 sec i invert the P3. position by P3=~P3 but P3.5 unchanged all other toggle between 0 and 1.P3.5 toggle properly on simulator but not at h/w side.

i tried it by changing the perticuler bit i.e. P3.5 but did not work
please help me

Parents
  • Hello

    This sounds like a very complicated problem.

    The port is a quasi-directional one. When you do the compliment, the processor does a read-modify-write operation.

    If the port pin is being held at a level by external hardware, then the read will produce a result that
    might not match what you wrote to the pin.

    You say that it works in the simulator - This supports the theory.

    One solution would be to have a 'read copy variable' of the port so that you compliment that and then write that value to the port:

    
    char P3Copy;
    ...
    P3Copy = 0xFF;
    P3 = P3Copy;
    
    P3Copy = ~P3Copy;
    P3 = P3Copy;
    
    

    Give it a try.

Reply
  • Hello

    This sounds like a very complicated problem.

    The port is a quasi-directional one. When you do the compliment, the processor does a read-modify-write operation.

    If the port pin is being held at a level by external hardware, then the read will produce a result that
    might not match what you wrote to the pin.

    You say that it works in the simulator - This supports the theory.

    One solution would be to have a 'read copy variable' of the port so that you compliment that and then write that value to the port:

    
    char P3Copy;
    ...
    P3Copy = 0xFF;
    P3 = P3Copy;
    
    P3Copy = ~P3Copy;
    P3 = P3Copy;
    
    

    Give it a try.

Children