I am new to avr micro-controllers and thus had a few basic questions. Thank you in advance for all the suggestions.
I am writing the following code to set and clear following pins of ATxMEGA32 A4u: (PINs are connected to SPST switches in DG612 IC. )
void main( void )
//setup pins as output.
PORTE.DIRSET = PIN1_bm; //switch0
PORTE.DIRSET = PIN0_bm; //switch1
PORTE.DIRSET = PIN2_bm; //switch2
PORTE.DIRSET = PIN3_bm; //switch3
//set initial switch positions
PORTE.OUTCLR = PIN1_bm; //switch0
PORTE.OUTSET = PIN0_bm; //switch1
PORTE.OUTCLR = PIN2_bm; //switch2
PORTE.OUTCLR = PIN3_bm; //switch3
Thus I want a high at PIN0 (i.e 3v) and low (i.e. 0v) for rest of the mentioned PINs. However I get 3.3v at PIN0 and get 2-3v at other PINs. I am not sure why do I get these voltages. I made sure that ground, AVCC & VCC pins get the proper voltages. I also checked my connections and no short appears in the pins. Please let me know what might be the problem.