Fixed 2. If (wrong procedures)
Commented ISR-handlers
This commit is contained in:
parent
2aab28a8c5
commit
dc36f3c7da
@ -45,11 +45,11 @@ int main()
|
||||
PORTD |= (1<<3); // Enable pull-up-resistor Pin-D3
|
||||
|
||||
// Interrupt for INT0 Pin-D2 High-voltage check
|
||||
EICRA |= (0 << ISC01)|(1 << ISC00); // Only at any edge [0|1]
|
||||
EICRA |= (0 << ISC01)|(1 << ISC00); // Only at any edge [Code: 01]
|
||||
EIMSK |= (1 << INT0); // Activate Interrupt INT0
|
||||
|
||||
// Interrupt for INT1 Pin-D3 Counter-click
|
||||
EICRA |= (1 << ISC11)|(1 << ISC10); // Only at rising edge [1|1]
|
||||
EICRA |= (1 << ISC11)|(1 << ISC10); // Only at rising edge [Code: 11]
|
||||
EIMSK |= (1 <<INT1); // Activate Interrupt INT1
|
||||
|
||||
sei(); // Activate global interrupts
|
||||
@ -95,21 +95,21 @@ int main()
|
||||
if(currTick >= signal_Output_nextTick) // If we are on or after the tick it should be executed
|
||||
{
|
||||
// Set pin according to next exec
|
||||
if(boost_highVoltage_nextHigh) // Set it high
|
||||
if(signal_Output_nextHigh) // Set it high
|
||||
{
|
||||
bit_set(PD5, 1);
|
||||
bit_set(PD6, 1);
|
||||
boost_highVoltage_nextHigh = false; // Next is low
|
||||
signal_Output_nextHigh = false; // Next is low
|
||||
}
|
||||
else // Set it low
|
||||
{
|
||||
bit_set(PD5, 0);
|
||||
bit_set(PD6, 0);
|
||||
boost_highVoltage_nextHigh = true; // Next is high
|
||||
signal_Output_nextHigh = true; // Next is high
|
||||
}
|
||||
|
||||
// When the signal should stop
|
||||
boost_highVoltage_nextTick = currTick + 101 // Todo: Add calculation for PWM high/low time
|
||||
signal_Output_nextTick = currTick + 101 // Todo: Add calculation for signalOutput low time
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,8 @@ int main()
|
||||
* Interrupt-handler
|
||||
* ISR - Interrupt service routine
|
||||
*/
|
||||
// Address: 0x001 INT0
|
||||
// Address: 0x001 INT0 - Only at any edge [Code: 01]
|
||||
// Handles: Over/Below working voltage
|
||||
ISR(INT0_vect)
|
||||
{
|
||||
if(PIND&0x20 == 0x00) // Falling edge
|
||||
@ -136,11 +137,14 @@ ISR(INT0_vect)
|
||||
reti(); // Exit interrupt-handler
|
||||
}
|
||||
|
||||
|
||||
// Address: 0x002 INT1 - Only at rising edge [Code: 11]
|
||||
// Handles: Counter tube "tick"
|
||||
ISR(INT1_vect)
|
||||
{
|
||||
// Tick detected, signalOutput
|
||||
enable_signalOutput = true;
|
||||
// Execute immediately
|
||||
signal_Output_nextTick = 0;
|
||||
|
||||
reti(); // Exit interrupt-handler
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user