Dear all,
I want to connect a Sinus signal to one of the pins of my Atmega16 MCU and calculate the average of its voltage every one second. I know that the total average of a sinus signal is 0, but we may haven't an integer number of the sinus signal period in one second , so the average voltage can be non-zero. I wonder how can I calculate this average and show it on an 2*16 LCD or send it to USART port using RS232 protocol every one second. May I ask you to please guide me how can I calculate the average of my signal?
Not that I must generate a square signal with the same phase and the same frequency of the sinus signal on another port of my Atmega16 during calculation of average of the input signal. So I think that I need a multi-thread program (A thread for generating the square signal and another thread for calculating the average voltage)! Am I right? If so, is it possible anyway?
Kindly Regards.
Thanks in advance.