News:

SMF for DIYStompboxes.com!

Main Menu

ADC initialization

Started by MstrKurt, December 04, 2013, 08:40:49 PM

Previous topic - Next topic

potul

so, are you using the internal DAC of the dspic?

MstrKurt

Quote from: potul on December 20, 2013, 03:27:47 PM
so, are you using the internal DAC of the dspic?

No, I just had a port A pin set as an output. I then just used the code PORTAbits.RA1 = ADC1BUF0;

slacker

#22
Ok, so what you're doing is sending the contents of the ADC buffer which is a 12 bit number, 4096 different values, to an output pin which only has two states 1 or 0 (3.3 Volts or 0 Volts). I'm not sure how that is making a signal anything like your input, I haven't used any DSPics so I don't know what happens if you do that, on an 8 bit PICs the output pin would be set to the value of the least significant digit of the ADC buffer, so you'd just get noise. Sounds like what could be  happening is loud signals are giving a 1 and quiet signals a 0, so you get a square wave signal what ever frequency you play, I don't know if that's actually possible though.

What you want to do is use the PWM module as a DAC, with some external filtering this will give you an analogue output.
http://extremeelectronics.co.in/avr-tutorials/introduction-to-pwm-pulse-width-modulation/
https://duckduckgo.com/?q=pic+pwm+tutorial

MstrKurt

I will give that a try when I manage to fix my project. I think the chip might have blown as there is continuity between VDD and VSS with the chip out of circuit. Shouldn't those 2 lines be isolated?

Actually ground has continuity to every single pin, is this normal?.

MstrKurt

#24
https://www.dropbox.com/s/m8i9onqbw2fxuva/sample.mp3 - Here is a sample of what I'm trying to explain sounds like. (it's meant to sound clean)

It's also lighting up an LED as I play the guitar haha. The higher notes can be heard but faintly, if you would like me to record the higher notes, let me know.

I've now fixed my project :).

I'm still unsure how to code an effect in C. I understand how the effects are made etc and after having done a DSP module last year in uni I'm comfortable enough with the maths involved but I'm unsure how to implement it to code.