interrupt 19 void ADC_ISR(void)
{
ADC_Read=ADCR; //+Acknowledge the Read Value to disable COCO Flag
{
if ((( ADC_Read>=306) ) && (PTAD_PTAD1==0))//*********CHANGED FOR ACSTRIAC
{
PTAD_PTAD1 = SET; //************CHANGED FOR ACSTRIAC
PTBD_PTBD1 = SET ; //red LED on
while(1); //wait here until reset
}
if ((( ADC_Read<50)) && (PTAD_PTAD1==0) ) //************CHANGED FOR ACSTRIAC
{
PTAD_PTAD1 = SET; //************CHANGED FOR ACSTRIAC
PTBD_PTBD0 = SET ; //green LED on
}
}
}
Hi dknguyen
Thanks for replying and taking keen interest in my problem.
The method you gave is beautiful. Thanks for that.
Although x>y that you mentioned may not be pertinent to my application since i just need two threshold levels and generous errors in the time taken to react to the overload or underload conditions mayn't be harmful.
Voltage doesn't work that way. A 5V chip does not need 5V at the +V pin. It needs a DIFFERENCE of 5V between it's +V and GND pins. Diodes also don't work that way. Diodes drop voltage, they don't raise voltage. You can use diodes to turn 5V into 3.3V, but you can't use them to turn 3.3V into 5V. If voltages and diodes worked that way, I could take a 1V battery and add 100 diodes to power a 100V device.[EDIT] : referring to the schematic i have few questions here.As you can see,i have 2 different grounds.One is the 5v ground and the other is the 3.3v ground (effectively,since lifted by 3 diode drops).The current sensor operates on 5v and my MCU is on 3.3v and fullscale ADC reading for 10bit operation is 3.3v=1023 steps.
the current sensor o/ps a voltg wrt its GND which is 5v scaled.This i am feeding to the ADC which refers the MCU GND as 3.3v scaled.Is this approach corect or will it create some problem?..i dont know if i have put my question corectly..maybe u can understand..
I have attached the complete schematic of my board (earlier i had attached only the particular section in discussion)..I am in a pickle here since i have to achieve so many things.To begin with i have to generate an unisolated Vcc from mains.Now my MCU is max 3.6v and the ACS712 is min 4.5v.The TRIAC has to be turned on only (& only) in the way mentioned in the data sheet.Its common terminal has to be at a higher dc voltg level than its gate to turn it on.Also the common should be mandatorily connected to Neutral of mains (or return path) .So i have to create a -5v and consider GND as Vcc & vice-versa.So i cannot get common GND because of this since NEutral=Vcc=triac common.This doesn't permit use of another 5v to 3.3v regulator.This can ONLY be achieved by lifting the MCU GND by some 2v.Normally you drop the voltage on the high-side so all all the devices in a circuit running off the same ground. I can see why you want to do it the way you have it so you can minimize the number of components needed to get the 5V sensor output to work with the 3.3V ADC.
[/QUOTE]If I had to do it your way, I would put a capacitor in parallel with D6-D7 to stabilize the voltage. YOu should also have a decoupling capacitor in parallel with the power pins of the ACS712. THis will stabilize the voltages which could also be factors in the problems you are talking about.
interrupt 19 void ADC_ISR(void)
{
ADC_Read= ADCR; //Acknowledge the Read Value to disable COCO Flag
if (( ADC_Read>=273) && (PTAD_PTAD1==0))
{ PTBD_PTBD1 = ~PTBD_PTBD1 ; //toggle red********TESTING
ADC_CNT = ADC_CNT+3;
}
else
{
PTBD_PTBD0 = ~PTBD_PTBD0 ; //toggle green********TESTING
ADC_CNT = ADC_CNT-1;
if(ADC_CNT<=1)
ADC_CNT=4;
}
if (ADC_CNT>255)
{
if (( ADC_Read>=273) && (PTAD_PTAD1==0))//*********CHANGED FOR ACSTRIAC
{
PTAD_PTAD1 = SET; //************CHANGED FOR ACSTRIAC
PTBD_PTBD1 = SET ; //red LED on
}
ADC_CNT=0;
}
}
The reading at the ADC pin is not stable.Maybe because of the 3 diodes i have there.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?