I'm writing assembly code for the ATMEGA328P (arduino uno). i have a example from a book.
'Adjust the previous assignment so that the LED stays on even when you release the button. The LED must remain lit until the other button is pressed'
the previous assignment was:
'Create a program that lights an LED when a button is pressed. When button 0 is pressed, LED 0 must light up. When button 1 is pressed, LED 1 must light up.'
for this i have write some code( maybe not the best, but it works )
ldi temp, 0xff
ldi temp1, 0x00
out DDRD, temp
out PORTD, temp
so my question is how can i do the second assignment?
What I have tried:
i have tried to add this:
ldi temp, 0xFF
cpi temp, 0x00