| ??? 05/10/03 17:55 Read: times |
#45187 - RE: My Approach Responding to: ???'s previous message |
I think what you mean to say is: if I write 0 to a port pin, it is probably dangerous to put a "hard" 1 on it from the outside. Exactly. Don't even try it, unless you like smoke. (someone once explained to me: everything actually works on smoke. When the smoke escapes, it doesn't work anymore.)
To use 8051 port pins as inputs, you must make sure that they are NOT 0. Write 0ffh to p1 once, and you're in business. Aside: if you write 0 to a port pin, and then read it, you will always see 0, no matter what happens outside. As for your approach: you will only test for 8 cases. 00000001 00000010 00000100 00001000 00010000 00100000 01000000 and 10000000 Any other combination will lead in none of the "work" getting done. What you will probably want to do is: bit0: jnb acc0,bit1 call work0 bit1: jnb acc1,bit2 call work1 ... and so on, and write the "work" bits as subroutines. |



