I've built a simple pc oscilloscope using pic18f4550 and a 20 MHz crystal.

I've made a simple application using vb2010 which is able to show the frequency oscillation on pc. The problem that I have right now is, when I apply a sine wave to my pic project, the sine wave is properly displayed on my pc. But when a sine wave is applied to pic with a frequency of 40 kHz and above the displayed amplitude will decrease, and it will continue to decrease with higher frequencies.

Why is the amplitude decreasing ? How to maintain the amplitude at freq 1 MHz ?

I did not put any buffer opamp before input signal to pic.

| improve this question | | | | |
  • 4
    \$\begingroup\$ Read the datasheet, paying particular attention to the capabilities of the A/D. \$\endgroup\$ – Olin Lathrop Mar 7 '16 at 12:52
  • 2
    \$\begingroup\$ I've added the datasheet to the post. However, you should detail your question and tell us what did you do exactly (with a schematic), which pins did you connect etc... I also think it's hardware related \$\endgroup\$ – MaximGi Mar 7 '16 at 12:57
  • \$\begingroup\$ Do you have an opamp buffer between your trace input and your A/D? You generally want to have a low-impedance source driving your A/D. \$\endgroup\$ – slightlynybbled Mar 7 '16 at 13:42
  • \$\begingroup\$ Need to put buffer opamp. Any ic suggestion ? \$\endgroup\$ – Art76 Mar 7 '16 at 13:50
  • \$\begingroup\$ I cannot read the datasheet post by maximgi \$\endgroup\$ – Art76 Mar 7 '16 at 13:51

As you haven't provided a schematic diagram of the circuit you are using, I'll have to shoot in the dark on what might be the problem.

One thing that could result in lowering signal amplitude with frequency is having a circuit acting as a low-pass filter in front of the ADC. Do you have any capacitors and resistors before the ADC input? Also, have you buffered the ADC input with an op-amp, or is the input source connected directly to it? According to the datasheet, the maximum recomended impedance of the signal source in 2.5k (page 272), or else there would be higher measurement error that specified.

Another thing that I've noticed is that at 20MHz, according to the equations provided in the datasheet (page 272) your maximum possible sampling frequency is around 65kHz (if you want to be using the 10 bits of resolution). If I'm not mistaken about the 65k, it means that at 40kHz you would be above the Nyquist frequency and should be seeing aliasing effects.

So yeah... 1MHz with this MCU is a no go as a real time oscilloscope. You need one with higher bandwidth ADC and with higher clock frequency.

Hope that answers your question! Keep trying!

| improve this answer | | | | |
  • \$\begingroup\$ Hai, are you reffering to pic18f4550 datasheet? \$\endgroup\$ – Art76 Mar 8 '16 at 12:25
  • \$\begingroup\$ Yes, we are talking about this MCU after all. ;) \$\endgroup\$ – Emiliyan Nikolov Mar 11 '16 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.