Microcontroller: ATmega32
Goal: Want to use PORTC as output to blink LEDs
Issue: All ports work as outputs except PORTC
Programmer: AVRisp MkII
Compiler: GCC/Win-AVR
IDE: AVR Studio 4, Version 4.15
I can't get PORTC to work as an output on my ATmega32. However, I am able to use all of the other ports as outputs. Why isn't PORTC working?
Do I need to change the fuse bits?
CODE (Borrowed and modified from "Newbie's Guide to the AVR ADC"):
#includeint main (void) { DDRC = 0b11111111; //Declares all pins on PORTC as outputs ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0); // Set ADC prescalar to 128 - 125KHz sample rate @ 16MHz ADMUX |= (1 << REFS0); // Set ADC reference to AVCC ADMUX |= (1 << ADLAR); // Left adjust ADC result to allow easy 8 bit reading // No MUX values needed to be changed to use ADC0 ADCSRA |= (1 << ADATE); // Set ADC to Free-Running Mode ADCSRA |= (1 << ADEN); // Enable ADC ADCSRA |= (1 << ADSC); // Start A2D Conversions for(;;) // Loop Forever { if(ADCH < 220) //Taking input from infrared sensor { PORTC = 0b00000010; // LED1 On } else { PORTC = 0b00000001; // LED2 On } } }