Skip to content
Snippets Groups Projects
Select Git revision
  • aeadb66c6d0dad0f3bff78acbb0c79ea05d061d4
  • master default protected
  • 2018ws
  • 2017ws
  • 2016ws
5 results

gtk-4.c

Blame
  • Forked from Peter Gerwinski / hp
    Source project has a limited visibility.
    blink-07.c 601 B
    #include <avr/io.h>
    #include <avr/interrupt.h>
    #include <stdint.h>
    
    uint8_t flag = 0;
    
    ISR (TIMER0_COMPB_vect)
    {
      static uint8_t counter = 0;
      if (counter++ == 0)
        flag = 1;
    }
    
    int main (void)
    {
      cli ();
      TCCR0B = (1 << CS01) | (1 << CS00);  /* Takt durch 64 dividieren */
      TIMSK0 = 1 << OCIE0B;  /* Interrupt einschalten */
      sei ();
      DDRB = 0xfe;   // Bit Nr. 0 als Input nutzen
      PORTB = 0x20;  // Bit Nr. 5 auf 1 setzen, alle anderen auf 0 ("digitalWrite" für alle 8)
      while (1)
        {
          if (flag)
            {
              PORTB ^= 0x20;
              flag = 0;
            }
        }
      return 0;
    }