I am new to microcontroller and just become confused to solve the following problem:
An ATmega32 chip is connected to four on/off switches (SW0-SW3) and 4 LEDs (LED0-LED3). SWi is connected to PAi. LEDi is connected to PA(4+i). How will I code such a way that turning a switch on, turns the corresponding LED on. For example, turning SW1 on will turn LED1 on. I am confused in the part that after taking input what will I send to port A? Multiple switch can be switched on at the same time.
For clarification:
switch0 is connected to PA0
switch1 is connected to PA1
switch2 is connected to PA2
switch3 is connected to PA3
LED0 is connected to PA4
LED1 is connected to PA5
LED2 is connected to PA6
LED3 is connected to PA7