Perfect, Nigel.
thanks a lot
By the way, all unused pins should be connected to gnd without resistors
I am checking the circuit becasue I have noise when a device is connected to the outlet or a lamp is turned on/off.
this noise is presented in the gnd and in the voltage source.
I have reduced 50% of the spikes grounding PORTB to gnd from 1V at 500 or 600mV but I need more because some spikes reach more than 500mA the ADC reads this spikes but they are noise and not the DC level
my setpoint is fixed at 220mV, I do not know how to change it becasue other set point is fixed at 2V here is ok, but at 220mV as setpoint I have false readings.
Thanks