Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

dsPIC - ADC and PWM

Status
Not open for further replies.

Maverickmax

New Member
Hi

I am thinking of using dsPIC30F for dsp application very soon but I want to be absolutely sure that I fully understand on 3 processes in regards to sampling frequency and reproducing signal on PWM channel.

1) Let say I am interested to take signal such as sine wave up to 500Hz so that means I have to set the adc at 2000Hz in comply to shannon nyquist theory.

2) At the moment, I am not going to DSP filter algorithm.

3) To reconstruct the original signal, should I use 2000Hz for PWM frequency? If higher frequency would be better, then please tell me why? To observe the signal on PWM, I would need to put 2nd pole Low pass filter RC circuit.


Once I fully grasp this concept, I will test it. If there is anything that i miss something importnat, please share your knowledge with us.

MM
 

dougy83

Well-Known Member
1) Nyquist theory states sample rate must be at least twice the highest input frequency.
2)
3) With a 2000Hz PWM frequency, you'll have a very strong 2000Hz present in your output signal, even with your 2nd order RC filter (if you want to output the 500Hz). Increasing the PWM frequency means that it is easier to filter out the PWM frequency and harmonics.
 
Last edited:

Maverickmax

New Member
Hi

Thank you for clearning this up. Do you have any tutorials for me to learn about these stuff within dspic?

Regards

MM
 

Maverickmax

New Member
Yes but I am slightly confused with implementation. Does the software simply take ADC sample at specified time and transfer to the PWM register straight away then PWM interrupt produce output at specified time?

Is it correct?

MM
 

Nigel Goodwin

Super Moderator
Most Helpful Member
No interrupts required, just read the sample and move it to the PWM register, as simple as that. The output frequency of the PWM has no effect, as long as it's high enough - and the higher the better, as it's easier to filter out.
 

Maverickmax

New Member
Cool, thank you for information. I am going to confess that I am not entirely sure which should I go for AVR or dspic chip. I am practically torn away with this problem. Please advise me asap. I have been working on AVR for a while but I have not touched PIC or dsPIC since I was student. I am inclinded to do dspic because everyone and companies use them more than AVR chip. Do you agree with me?

I simply want to use microcontroller that allows me to sample and reproduce signal. Of course later on I would like to use dsp such as notch filter, high pass filter and low pass filter, etc.

Please advise me asap

Regards

MM
 

Maverickmax

New Member
Unfortunately ATMEGA32 does not has the DSP functionality like dsPIC. I will order dsPIC chip very soon and build the software from scratch.

MM
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top