I have two questions.
1)I am using the ADC on QG8 in 8 bit mode and continous compare to interrupt when a certain value to the input is above the set value in ADCCVL.
I now want a window comparator where I want to monitor an ADC i/p of less than some set value.How can I do this since QG8 has either a higher than or lesser than compare value (ACFGT).
Further I had a problem while using the 'higher than' setting.I am using a CT (current transformer) to measure a current value and the secondary side is rectified and filtered and fed to the ADC i/p.Even if I set the ADCCVl at 0xFF,so that the voltage at which it interrupts is 3.3V,it gives an interrupt for a voltage drop of 2V.To aggravate it also interrupts for a very small load because of the current surge.How can I take care of this?
2)In the same circuit I am powering the QG8 and related ckt using an unisolated Power supply.(The mains is not stepped down with a transformer)The neutral on mains and the ckt ground are common.
I also drive a relay with one of the GPIO on the QG8.
Whenever I run the code on a battery generated 5V(or the debugger),the code executes flawlessly.
But when the unisolated PSU is connected,the noise starts working into the MCU.I have heavily filtered the key points on the board,but still the problem continues.
It is further aggravated when the relay switches with some load.The EMI/EMC on the contacts of the relay make the MCU misbehave and it jumps to unknown routines.
How immune is the QG8 to this kind of noise?
Has anyone worked on this kind of setup before?....The same kind of setup is used in washing machines and it works nicely.
Thanks and regards