I dunno if this should go in uC forum. But here goes...
See the attached pdf for reference.
My aim is to detect the AC mains by the PIC. ( not PIC specific ).
I am not concerned about the diagram. I can make amends while building.
My problem is the PIC software confusion. Mind you this is not a zero crossing detection nor ADC. Just a digital input. I am going to run a PIC routine like "while (AC_OK) { blah blah blah }"
As you can see from the diagram the opto will output 100Hz square wave. That is why I am using C18, trying to filter it out to some extent. Still,
will the PIC pin (AC_OK) see 100Hz ?
And what will happen to the "while (AC_OK){ blaaaaah}" routine during a low level ?
I am thinking if the PIC pin goes low it will exit the routine even AC is there.
Will placing a cap at the PIC pin rectify my issue.
What is the best possible solution ?
{edit}
Sorry guys. I deleted the pdf. I do not want a n00b trying to attempt to build the circuit and get deep fried.
I got the answer so I think it is best not to talk about this. Those who posted images please check if they could be hazardous to n00bs and remove them if you do not mind.
See the attached pdf for reference.
My aim is to detect the AC mains by the PIC. ( not PIC specific ).
I am not concerned about the diagram. I can make amends while building.
My problem is the PIC software confusion. Mind you this is not a zero crossing detection nor ADC. Just a digital input. I am going to run a PIC routine like "while (AC_OK) { blah blah blah }"
As you can see from the diagram the opto will output 100Hz square wave. That is why I am using C18, trying to filter it out to some extent. Still,
will the PIC pin (AC_OK) see 100Hz ?
And what will happen to the "while (AC_OK){ blaaaaah}" routine during a low level ?
I am thinking if the PIC pin goes low it will exit the routine even AC is there.
Will placing a cap at the PIC pin rectify my issue.
What is the best possible solution ?
{edit}
Sorry guys. I deleted the pdf. I do not want a n00b trying to attempt to build the circuit and get deep fried.
I got the answer so I think it is best not to talk about this. Those who posted images please check if they could be hazardous to n00bs and remove them if you do not mind.
Last edited: