Hi - so I'm quite new to the world of AVRs. I finally got some simple buttons working today. I attached 8 leds + resistors to PortB on an AT90S8515, and 8 buttons between PortC and ground. Then I set PortB to be an output, and PortC to be an input with pull up resistors. Then my entire program was:
INLOOP: IN R24, PINC OUT PORTB, R24 RJMP INLOOP
Very simple - and it worked! :) But was this the proper way to connect the buttons? Also - it got me wondering - If I wanted to make an entire program driven by buttons - what would be the proper way of doing so? To me it seems like I could have a simple loop that would read the port with the buttons attached, and when one of them went high it would execute some code, then go back to looping. The problem I see with this is that if a button was pressed and released while that code was being executed, the AVR would never even see the input. Is this a situation that can't be avoided? Or is there a better way of dealing with buttons? Thanks!
-Michael