page1
Setup
End
Reset History
Set ports, timers and interrupts
Loop
Set gate timer
Add read values to totals
1 second
passed since last
update?
Yes
No
Calculate averages
Calculate historical
totals
Calculate differentials
and diff totals
Read current, voltage
and temperatures
Read EEPROM and
set persistent values
Check and update
charge stage
Show stats, also
debug stats if enabled
Check and zero
current offset (every hour)
Tune output level to
the required current
Update counters and totals
End
ISR (INT0_vect)
Fires when mains crosses zero
End
Reset gate timer
Increment mains zero
cross counter
ISR (TIMER1_COMPA_vect)
Fires when gate timer ends
Reset gate timer
Set TRAIC gate high
if charging is enabled
Set TRAIC gate low
Short delay 50 CPU clock ticks
=approx 3uS
End
Update counter and reset interrupt
UARTReceive
Fires when character is sent on UART
End
Run operation based
on received command
Show received character