KlausST
Advanced Member level 7
- Joined
- Apr 17, 2014
- Messages
- 26,357
- Helped
- 4,926
- Reputation
- 9,875
- Reaction score
- 5,803
- Trophy points
- 1,393
- Activity points
- 177,474
Hi,
For the minimal solution it's just (pseudo code)
* read ADC value
* setup MUX
* setup ADC that conversion can be triggered by timer
* compare stored_ADC value with trip_max
* if bigger: trip SSR
* compare stored_ADC value with trip_min
* if lower: trip SSR
* leave ISR
****
If the ISR stores the ADC values in an array that may be read in main loop: you may transmit the values (maybe every 100ms) to the PC for monitoring. You are free to do what you like in the main loop..it won't harm the "overcurrent detection" as long as you don't disable interrupts.
Klaus
When using ADC interrupt, why not immediately process the incoming data? You have plenty of time doing this inbetween two samples.This way the reading + processing should not exceed 20ms + 10ms (64 MHz Oscillator) and I will be able to trip the faulty load line within 30ms of fault.
For the minimal solution it's just (pseudo code)
* read ADC value
* setup MUX
* setup ADC that conversion can be triggered by timer
* compare stored_ADC value with trip_max
* if bigger: trip SSR
* compare stored_ADC value with trip_min
* if lower: trip SSR
* leave ISR
****
If the ISR stores the ADC values in an array that may be read in main loop: you may transmit the values (maybe every 100ms) to the PC for monitoring. You are free to do what you like in the main loop..it won't harm the "overcurrent detection" as long as you don't disable interrupts.
Klaus