Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. /* ------------------------------------------------------------
  2.   Titel : Projekt Rauchmelder
  3.  --------------------------------------------------------------
  4.  Funktion :  Zähler & Tasterentprellung
  5.  --------------------------------------------------------------
  6.  Prozessor : ATmega8
  7.  Taktfrequenz externer Quarz:    3,686411 MHz
  8.  Sprache : C
  9.  Datum : ©2010
  10.  Version : 1.1
  11.  ------------------------------------------------------------ */
  12.  
  13. #include <avr/io.h>
  14. #include <util/delay.h>
  15. #include <avr/interrupt.h>
  16.  
  17. void main (void)
  18. {
  19.   DDRB  = 0x03;
  20.   PORTB = 0x00;
  21.   PORTC = 0x00;
  22.   DDRC  = 0x00;
  23.   PORTD = 0x00;
  24.   DDRD  = 0x00;
  25.   ACSR  = 0b00001010;
  26.  
  27.   ISR (ANA_COMP_vect)                                 // Interrupt 0 Sub-Routine (ISR)
  28.     {
  29.      PORTB |= 0x02;
  30.      _delay_ms(2);
  31.      PORTB &=~ 0x02;
  32.      _delay_ms(2);
  33.     }
  34.     while (1)
  35.     {
  36.       PORTB = 0x01;
  37.       _delay_ms(1500);
  38.       PORTB = 0x00;
  39.       _delay_ms(4000); 
  40.       sei ();
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement