Author Topic: ADC initialization  (Read 7118 times)

0 Members and 1 Guest are viewing this topic.

potul

Re: ADC initialization
« Reply #20 on: December 20, 2013, 03:27:47 PM »
so, are you using the internal DAC of the dspic?

MstrKurt

Re: ADC initialization
« Reply #21 on: December 20, 2013, 03:36:51 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

Re: ADC initialization
« Reply #22 on: December 20, 2013, 04:37:16 PM »
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
« Last Edit: December 20, 2013, 04:42:13 PM by slacker »

MstrKurt

Re: ADC initialization
« Reply #23 on: December 20, 2013, 04:46:32 PM »
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

Re: ADC initialization
« Reply #24 on: December 20, 2013, 05:36:57 PM »
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.
« Last Edit: December 20, 2013, 07:51:20 PM by MstrKurt »