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

Interfacing PushButton

I want to sense when a port pin goes high.
I have connected it to Vcc through a resitor
and pushbutton , so when pushbutton is pressed
the port pin goes high .But to configure port
for input I must first write 0xFF to Port .

     V
     |       R1       PB     |
     |_____/\/\/\____.--.____|Port Pin
                             |

Parents
  • the port pin goes high .But to configure port
    for input I must first write 0xFF to Port .

    
    
         V
         |       R1       PB     |
         |_____/\/\/\____________|Port Pin
                       |         |
                       O |
                         |
                       0 |
                       |
                      GND

    Will work, your design will not. Just change your code to look for pin low instead of pin high.

    Have fun,

    Erik


Reply
  • the port pin goes high .But to configure port
    for input I must first write 0xFF to Port .

    
    
         V
         |       R1       PB     |
         |_____/\/\/\____________|Port Pin
                       |         |
                       O |
                         |
                       0 |
                       |
                      GND

    Will work, your design will not. Just change your code to look for pin low instead of pin high.

    Have fun,

    Erik


Children