I'm working with an ATTINY26(L) learning about interrupts, and discovered a problem.
I am getting a different output voltage on PORTA (half) than I am on PORTB. To simplify things, I made a program to turn on a single LED on a given pin. I've tested so far on several pins from both ports.

On PORTA, if I measure pin to ground without a load, I get 5V. If I connect the LED (3\$V_f\$) and a 100Ω resistor, the voltage drops to 2.5V, and the LED is dim (2.5V across the LED and 6mV across the resistor).
On PORTB the voltage stays 5V (3V across the LED and 2V across the resistor).
Code:
int main()
{
DDRA = 0xFF;
DDRB = 0xFF;
while (1)
{
PORTA = (1 << PA6); // Half voltage?
PORTB = (1 << PB6); // OK
milli_delay(100);
PORTA = (0 << PA6);
PORTB = (0 << PB6);
milli_delay(100);
}
}
void milli_delay(int d)
{
for (int i = 0; i < d; i++)
_delay_ms(1);
}
Do I have a damaged microcontroller, or have I overlooked something?
Update:
I swapped out the microcontroller for an identical one, and have the same result. I think it's unlikely that two are damaged in the same way.
Update 2:
Some have requested the compiled HEX code: (Link now removed.)
Update 3:
@Jippie was kind enough to check out the ELF (decompiled) code and saw a weird change of PORTA back to input, immediately after setting it to output. What gives?
The code I pasted above isn't quite complete. There's a little extra line of code which should have been commented out, or pasted into this question:
DDRA = (0 << PA7); // input on PA7
PA7 was intended to read a switch as part of my pin change interrupt testing. I thought the line had been commented out, but it wasn't. And, if you look closely, you'll spot a problem.
It should be:
DDRA |= (0 << PA7);
Trying to set pin PA7 to 0 for input alone should be done with an OR-EQUALS operator (|=), not just EQUALS (=). As a result, the entire PORTA was set back to input.
The lesson here? A single pipe character ruined more than a whole day of learning and experimenting. A single line of code omitted from the question (or not properly commented out for testing) caused headaches.
I am always my own worst enemy when it comes to troubleshooting. It wasn't a faulty chip, a compile error, or some accidental configuration. Total newbie mistake in not thoroughly checking my own code.
Some pics:

DDRx = 0xFF;commands. It's quite confounding. – JYelton Jan 03 '13 at 06:15avr-gcc -Os -std=c99 -mmcu=attiny26 at26int.c -o compiled. I will update the Q with some pics as requested. What specifically would you like to see using the scope? – JYelton Jan 03 '13 at 17:27/usr/lib/avr/include/avr/)iotn26.hon your PC and does it include the correct pin settings for(DDR|PORT)(A|B)? 18/19/1A/1B – jippie Jan 03 '13 at 17:32#define PINA _SFR_IO8(0x19),#define DDRA _SFR_IO8(0x1A), and#define PORTA _SFR_I08(0x1B). – JYelton Jan 03 '13 at 17:35