|
|
@ -1,6 +1,4 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* geigerzaehler.main.c.c
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Created : 28.02.2019 09:07:22
|
|
|
|
* Created : 28.02.2019 09:07:22
|
|
|
|
* Author : John Ditgens, Alexander Brandscheidt
|
|
|
|
* Author : John Ditgens, Alexander Brandscheidt
|
|
|
|
* Git-Repository : https://gitea.Railduction.eu/JohnD/Geigerzaehler.git
|
|
|
|
* Git-Repository : https://gitea.Railduction.eu/JohnD/Geigerzaehler.git
|
|
|
@ -13,6 +11,10 @@
|
|
|
|
// Imports
|
|
|
|
// Imports
|
|
|
|
#include <avr/io.h>
|
|
|
|
#include <avr/io.h>
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Global variable declaration
|
|
|
|
|
|
|
|
uint8_t
|
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -22,10 +24,12 @@ int main(void)
|
|
|
|
PORTD |= (1<<2); // Enable Pull Up Resistor Pin D2
|
|
|
|
PORTD |= (1<<2); // Enable Pull Up Resistor Pin D2
|
|
|
|
PORTD |= (1<<3); // Enable Pull Up Resistor Pin D3
|
|
|
|
PORTD |= (1<<3); // Enable Pull Up Resistor Pin D3
|
|
|
|
|
|
|
|
|
|
|
|
EICRA |= (1 << ISC01)|(1 << ISC00); // Only at raising edge
|
|
|
|
// 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
|
|
|
|
EIMSK |= (1 << INT0); // Activate Interrupt INT0
|
|
|
|
|
|
|
|
|
|
|
|
EICRA |= (1 << ISC11)|(1 << ISC10); // Only at raising edge
|
|
|
|
// Interrupt for INT1 Pin-D3 Counter-click
|
|
|
|
|
|
|
|
EICRA |= (1 << ISC11)|(1 << ISC10); // Only at rising edge [1|1]
|
|
|
|
EIMSK |= (1 <<INT1); // Activate Interrupt INT1
|
|
|
|
EIMSK |= (1 <<INT1); // Activate Interrupt INT1
|
|
|
|
|
|
|
|
|
|
|
|
sei(); // Activate global interrupts
|
|
|
|
sei(); // Activate global interrupts
|
|
|
@ -36,14 +40,21 @@ int main(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Interrupt-handler
|
|
|
|
|
|
|
|
* ISR - Interrupt service routine
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Address: 0x001 INT0
|
|
|
|
ISR(INT0_vect)
|
|
|
|
ISR(INT0_vect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reti(); // Exit interrupt-handler
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ISR(INT1_vect)
|
|
|
|
ISR(INT1_vect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//???
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reti(); // Exit interrupt-handler
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
1
|