Long-time reader, first-time post.
I am trying to set a flag to trigger a software interrupt by using the statement PCIFR |= (1<<PCIF0); unsuccessfully. Datasheet says "PCIF0 becomes set (one)" when an interrupt is triggered. It appears that I cannot do this in code. It may have to do with attempting to set a flag connected with a pin that has been defined as an input. Datasheet indicates PCIF0 is R/W, however.
My ISR function works properly when a button on PCINT0 is pressed and released. But the software attempt does not work.
In a related question/observation, the Atmel Studio 7 debug IO Window View shows the PCIFR bits as all clear (zero) even when the button triggered interrupt functions properly (while single stepping). I would have thought the bit would light up (red) on the screen indicating the change. Occasionally (1 out of 5 interrupts or so), it will go red indicating a One in the value. And I think that means flag was set but I've also seen the opposite.
The attached file demonstrates my program/problem. This code distills the problem to the minimum of code to demonstrate the issue.
Hope I did this right. Thanks a bunch to the contributors to this forum. It has been very helpful in my quest to learn.