|
3-phase PV router
|
Interrupt Service Routine - Interrupt-Driven Analog Conversion. More...

Public Attributes | |
| uint8_t | admux |
| uint8_t | index |
| struct adc_ctx_t * | next |
Interrupt Service Routine - Interrupt-Driven Analog Conversion.
An Interrupt Service Routine is now defined which instructs the ADC to perform a conversion for each of the voltage and current sensors in turn.
This Interrupt Service Routine is for use when the ADC is in the free-running mode. It is executed whenever an ADC conversion has finished, approx every 104 µs. In free-running mode, the ADC has already started its next conversion by the time that the ISR is executed. The ISR therefore needs to "look ahead".
At the end of conversion Type N, conversion Type N+1 will start automatically. The ISR which runs at this point therefore needs to capture the results of conversion Type N, and set up the conditions for conversion Type N+2, and so on.
By means of various helper functions, all of the time-critical activities are processed within the ISR.
The main code is notified by means of a flag when fresh copies of loggable data are available.
Keep in mind, when writing an Interrupt Service Routine (ISR):
ADC channel context for circular linked list optimization
This structure replaces the switch-case logic in the ADC ISR with a more efficient circular linked list approach. Minimal memory footprint.
Based on florentbr's optimization suggestion #1 for reducing ISR overhead.
Definition at line 1126 of file processing.cpp.
| uint8_t adc_ctx_t::admux |
ADMUX register value written after this channel: the channel after next
Definition at line 1130 of file processing.cpp.
| uint8_t adc_ctx_t::index |
channel just converted (0-5 for V1,I1,V2,I2,V3,I3: AdcChain::Channel)
Definition at line 1129 of file processing.cpp.
| struct adc_ctx_t* adc_ctx_t::next |
pointer to next context in circular list
Definition at line 1128 of file processing.cpp.