Now through the op-amp to alternating current (ac) input to the microcontroller PIC16F877A AD mouth of the code is compiled, so didn't understand, wrote in the procedure as judgment to judge waveform acquisition frequency is 50 hz or 60 hz, and to determine the amplitude of alternating current to a constant value, after accumulation and comparison, the AD is 10 AD so the value of the collection in the program and the absolute value of 0 x7f differential accumulation and with a numerical comparison, what reason is this excuse me? Because the AD is 10 and sampling the op-amp to the halfway point of the ac waveform is carried to the 5 V, namely alternating current (ac) 0 V to 2.5 V, so the collected value 0 x7f do subtraction I can understand that, but I don't understand is as follows: op-amp circuit diagram and the op-amp output voltage waveform as shown to the AD at the mouth of the Nile, but doubt the following
1. The program once every 400 us handle AD program, and through the AD collection and compare it with the number of 24 to judge the waveform is 50 hz or 60 hz, what reason is this?
2. Why each time to collect a constant value, the value of the accumulation and compare to determine the amplitude of the input voltage is 220 v or 380 v
In the program for a comment below
; Sampling (half cycle amplitude accumulated value & lt; # 0 x0350)
Could you tell me how to get 0 x0350 is?
Our PIC assembly is looking at this product is too long, could you tell me how to determine single chip microcomputer frequency and amplitude of alternating current (ac)? Thank you very much!