I tried a simple c code on AVR 328, to toggle a pinout. The compiled code works fine, however the Program Counter seems to be wrong. It shows 0x0048 / 0x0049. In the hex file this is within the interupt table. I thought it should be somewhere between 0x0086 and 0x009a...

- Code:
#define F_CPU 8000000UL
#include <stdio.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#define SET_BIT(PORT, BIT) ((PORT) |= (1 << (BIT))) // Set Port-Bit
#define CLR_BIT(PORT, BIT) ((PORT) &= ~(1 << (BIT))) // Clear Port-Bit
#define TGL_BIT(PORT, BIT) ((PORT) ^= (1 << (BIT))) // Toggle Port-Bit
int main(void)
{
SET_BIT(DDRD, PORTD1);
while (1)
{
TGL_BIT(PORTD, PORTD1);
_delay_us(50);
}
}

Last edited by arcachofo on Fri Dec 24, 2021 2:54 am; edited 1 time in total (Reason for editing : Marked as solved (green color))