Below in my code, else statement not simulate in proteus VSM
Discriptio: Switch is connected to PORTD.0 and LED is connected to PORTC.3; when switch pressed LED should be on and when switch realize or Unpressed LED should be OFF.
#define F_CPU 8000000UL
DDRD = 0x00; // set PORTD as input
DDRC = 0xFF; // set PORTC as output
if(PIND == 0b0000001) // if PD1 = High than PC2= High ow PORTC=0x00
PORTC = 0x03;
PORTC = 0x00;
Error: When i pressed switch in Simulation (VSM) LED is ON, but when i OFF the switch , LED remain ON, but in this task i wish it's off.
Please help me to solve this issue.