Somehow I kind of remembered that when I accidentally programmed it to external clock, I also didn't remove CKDIV8. So I guess it's CKDIV8 that's been messing with the clock, so 1 mhz would be divided by 8, and so on.
Update: I tried using my spare tiny2313 with external 8 mhz crystal (this time without CKDIV8 to get full 8 mhz out of it) and using this code:
- Code: Select all
#include <avr/io.h>
int main(){
DDRB = 0x01;
while(1){
PORTB ^= (1<<0);
}
}
Sadly I don't have an oscilloscope so I can't verify if this is really making a clean 8 mhz square wave(or 2 mhz). Also the Fusebits of my (slight) dead tiny2313 is lfuse[0x60], hfuse[0xDF], and efuse[0xFF]. I'm feeding the clock signal at Pin 5 (XTAL1) of the dead tiny2313.
-----------------------------------------------------------------------------------------------
Out of one hole, and into another.