Wilko

Member Since: March 9, 2018

Country: Netherlands

  • I couldn't help myself, I just had to try it. My ATMEGA328p works like a charm on 0.2 Hz. That's as low as my equipment will allow me, one clock pulse every five seconds. No jitter, no hanging, just flawless operation. Current consumption at 3.3V fluctuates between 80uA and 170uA. This is how I programmed it.

    #define F_CPU 8000000UL
    
    #include <avr/io.h>
    
    int main(void)
    {
        DIDR0  |= (1 << ADC5D) | (1 << ADC4D) | (1 << ADC3D) | (1 << ADC2D) | (1 << ADC1D) |(1 << ADC0D);
        ACSR |= (1 << ACD);
        ADCSRA &= ~(1 << ADEN);
        PRR |= (1 << PRTWI) | (1 << PRTIM2) | (1 << PRTIM1) | (1 << PRTIM0) | (1 << PRSPI) | (1 <<  PRUSART0) | (1 << PRADC);
    
        DDRB |= (1 << PB5);
    
        while (1)
        {
            PORTB |= (1 << PB5);
            PORTB &= ~(1 << PB5);
        }
    }
    
  • Simple question, did you disable interrupts?

No public wish lists :(