I am using an AC input in my project. My input signals period which comes to port of PIC pin is 20ms.Its almost square waveform. I want to check this signal in 30ms time-interval continuously and make the output port "1". Because of using ac input,i cannot make the output port "1". I can not go out of DC 1-0 logic. This confuses me :S.
Asked
Active
Viewed 24 times
0
-
Your question is a little bit unclear for me. Please shoe code e.g. – Mike Mar 16 '22 at 12:34
-
@Mike He/She wants to set output pin to 1 as long as the input AC signal is active. But since the input is a square wave like signal he/she does not know how to deal with it to know whether the input signal is present or not, in order to decide to set or reset the output pin. – Kozmotronik Mar 17 '22 at 13:21
-
Well, since there is not much detail what PIC and what pins you are using, I would suggest you to use; either a pin with interrupt capability or a pin that feeds any timer or capture & compare hardware as input. This eases to track the input's AC signal activity by implementing a 25 ms time-out period. When there is no signal change on the input pin during 25 ms you must handle it as an input signal inactivity event (input signal lost). But as long as the 20ms signal is present, there will be no time-out and you must detect first the input signal activity and handle it (set output to 1). – Kozmotronik Mar 17 '22 at 13:29