1.9 us of sampling time? or TAD?
(remember, TAD should be greater than 1.6us)
a TAD of 1.9us (which is ok) will give a minimum of 23us of sampling time... (F_sample= 43 kHz)
any way at a 50Hz signal (T=20ms) it will give near 870 samples per cycle...
Which is apparently ok...
apparently...
Now, don't forget another issue.... the communication to the PC...
If you are communicating to the PC with a serial (USART) port via RS232, you are very limited by the communication baud rate...
for example... if you are communicating at 9600 bps
that's 104us per bit... Let's assume a common byte (8bits) with start bit, stop bit and no parity (total 10 bits)
that's 1.04ms per byte
and let's assume you sample 8 bits of your signal, and send them in binary(hex) directly to the port...
you can send Only one sample at every 1.04ms that's a F_sample= 961 Hz
that's almost 19 samples per cycle of a 50Hz signal...
but, let's face it... if you send continuous data stream at 9600bps you will have many sync errors... so your actual F_sample should be slower.... (minimallyIi would try sending 2 stop bits... so 1.114 ms per byte... F_sample=874 Hz and 17 samples per 50Hz cycle....) and it get's worse if you need/want 10 bits (or more) of data in the PC... (you can send only 8 bits so you will need 2 bytes per sample... so your F_sample halves itself!)
So, that's the figure...
Conclusion... It's a communication issue... do your work inside the micro or upgrade your communication (change to USB or something faster)
PD: I took a look at your code, still 57600bps isn't enough but you can do the numbers