Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
First, I removed the external crystal and the two capacitors. Then I connected one of the output pins of a second microcontroller to the XTAL1 pin of the “broken” atmega8. Nothing should be connected to XTAL2. Both of the microcontrollers have to be connected with their GND pin to the same ground, and to a power source of course. The working microcontroller should be programmed to send pulses with regular intervals on its output pin. The program shown below is fine:Code: [Select]#include <avr/io.h> //Required to use assembler commands#define F_CPU 1000000UL // set the internal clock speed of 1 MHz#include <util/delay.h> int main(){ DDRC = 0xFF; //Make Port C output values PORTC = 0x00; //Turn all output pins on port c off while(1) { PORTC = 0x01; _delay_ms(5); //This delay is probably not necessary PORTC = 0x00; _delay_ms(5); //This delay is probably not necessary either } }With this setup, the Atmega8 with the wrong fuse bits may be programmed as usual, because the other AVR now serves as external clock source.
#include <avr/io.h> //Required to use assembler commands#define F_CPU 1000000UL // set the internal clock speed of 1 MHz#include <util/delay.h> int main(){ DDRC = 0xFF; //Make Port C output values PORTC = 0x00; //Turn all output pins on port c off while(1) { PORTC = 0x01; _delay_ms(5); //This delay is probably not necessary PORTC = 0x00; _delay_ms(5); //This delay is probably not necessary either } }