hi, i am using p18f4550 and c18 compiler
i configured all the analog ports as digital i/o
then for the input 1 on port RE0 the led1 has to glow
but the led1 is always in OFF state and led2 in ON state.
can anyone tell what is wrong with the code??
it got built in the compiler
#include<stdlib.h>
#include<p18f4550.h>
#include<delays.h>
#define sw1 PORTEbits.RE0
void main()
{
ADCON1 = 0b00001111; //configuring all analog ports as digital i/o
TRISC = 0b00111111; //led1 and led2 as output
TRISE = 0b11111111; //all PORTE bits as digital input
while(1)
{
if(sw1==1) //if portRE0==1 then switch on led1
{
PORTC = 0b10000000;
}
else if(sw1==0) //else switch on led2
{
PORTC = 0b01000000;
}
}
}