You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.9 KiB
C

/*
<<<<<<< HEAD
* geigerzaehler.c
*
=======
>>>>>>> f39ee6c90de22ce1514bb4f9e7e3e3116efac22f
* Created : 28.02.2019 09:07:22
* Author : John Ditgens, Alexander Brandscheidt
* Git-Repository : https://gitea.Railduction.eu/JohnD/Geigerzaehler.git
*
* MController : AtMega328P
* Board : Arduino Nano
*/
#define F_CPU 20000000UL // Clock speed: 20 MHz - Maximum of AtMega328P
// Imports
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdint.h>
<<<<<<< HEAD
=======
// Global variable declaration
uint8_t
>>>>>>> f39ee6c90de22ce1514bb4f9e7e3e3116efac22f
int main()
{
DDRD &= ~(1<<2); // Activate PD2
DDRD &= ~(1<<3); // Activate PD3
PORTD |= (1<<2); // Enable Pull Up Resistor Pin D2
PORTD |= (1<<3); // Enable Pull Up Resistor Pin D3
<<<<<<< HEAD
EICRA |= (1 << ISC11)|(1 << ISC10); // Only at raising edge
EIMSK |= (1 << INT1); // Activate Interrupt INT0
EICRA |= (1 << ISC00); // Only at falling edge
EIMSK |= (1 << INT0); // Activate Interrupt INT1
=======
// Interrupt for INT0 Pin-D2 High-voltage check
EICRA |= (1 << ISC01)|(0 << ISC00); // Only at falling edge [1|0]
EIMSK |= (1 << INT0); // Activate Interrupt INT0
// Interrupt for INT1 Pin-D3 Counter-click
EICRA |= (1 << ISC11)|(1 << ISC10); // Only at rising edge [1|1]
EIMSK |= (1 <<INT1); // Activate Interrupt INT1
>>>>>>> f39ee6c90de22ce1514bb4f9e7e3e3116efac22f
sei(); // Activate global interrupts
// Endless loop
while (1)
{
}
}
/*
* Interrupt-handler
* ISR - Interrupt service routine
*/
// Address: 0x001 INT0
ISR(INT0_vect)
{
<<<<<<< HEAD
reti();
=======
reti(); // Exit interrupt-handler
>>>>>>> f39ee6c90de22ce1514bb4f9e7e3e3116efac22f
}
ISR(INT1_vect)
{
<<<<<<< HEAD
reti();
=======
reti(); // Exit interrupt-handler
>>>>>>> f39ee6c90de22ce1514bb4f9e7e3e3116efac22f
}
1