Run checks on real hardware and fixed booster

Added onboard-led as output
master
Railz 6 years ago
parent 6990bff184
commit 900874aeae

@ -20,7 +20,7 @@ uint16_t boost_frequency = 2000; // 2kHz frequency
uint16_t signalOutput_time = 200; // 200ms
uint8_t boost_highVoltage_nextHigh = 1;
uint16_t boost_highVoltage_nextTick = 0;
uint16_t boost_highVoltage_nextTick = 1;
uint8_t signalOutput_nextHigh = 1;
uint16_t signalOutput_nextTick = 0;
@ -42,6 +42,7 @@ int main()
DDRD |= (1 << PORTD4);
DDRD |= (1 << PORTD5);
DDRD |= (1 << PORTD6);
DDRB |= (1 << PORTB5); // Onboard-Led
// Interrupt for INT0 Pin-D2 High-voltage check
EICRA |= (0 << ISC01)|(1 << ISC00); // On at any edge [Code: 01]
@ -159,12 +160,16 @@ ISR(INT0_vect)
{
// Below ~400V, activate booster
boost_highVoltage_nextTick = 1; // Run as soon as possible
PORTB |= (1 << PORTB5); // Onboard-Led
}
else // Rising edge
{
// Reached ~400V, deactivate booster
boost_highVoltage_nextTick = 0;
PORTB |= (0 << PORTB5); // Onboard-Led
// reset state
PORTD |= (0 << PORTD4); // pin on low
boost_highVoltage_nextHigh = 1; // next is high

Loading…
Cancel
Save