Thoughts on dsPIC test bench

Started by JKowalski, February 18, 2011, 06:20:51 PM

Previous topic - Next topic

JKowalski

#20
Quote from: JMCTech on February 28, 2011, 12:57:17 PM
I've just found this link:

http://spinlab.wpi.edu/projects/dspboard/dspboard.html

There's a realy good project report with schematic and source code inluding 6 detailed DSP based LAB assignments

They use a dsPIC33FJ128GP802 with a TI TLV320AIC23 stereo audio codec.

JC

Thanks, that's a great resource.


I am considering adding a digital potentiometer for analog feedback purposes - SPI so interface is already set up.

I was musing over the fact that delay would not be possible in the current configuration, since there is no feedback, and the board is built as a software oriented dev platform, not hardware.

Thoughts? Means I would have to find ANOTHER input pin to use for CS  :icon_rolleyes: Maybe I will do the hardware CV/pot switching after all.


Potul, you said you were using C to program the dsPICs.... What compiler are you using? I see that the microchip one is free 60 days / indefinitely with limited options... Are you using the limited version or some third party compiler?

I starting writing the code in ASM, it's going okay. I read the whole instruction set to familiarize myself with the commands and my options, WOW it is huge compared to the 8-bit IS's. Very versatile though, many commands I felt were sorely missing in the 8-bit IS's. (bit toggle, so nice)

I also found a good example code for ASM, for audio effects no less, which has proved helpful in letting me know how the chips should be set up:

burnit.co.uk/sdiy/index.php?page=4xd

potul

Quote from: JKowalski on March 02, 2011, 02:07:03 PM
Potul, you said you were using C to program the dsPICs.... What compiler are you using? I see that the microchip one is free 60 days / indefinitely with limited options... Are you using the limited version or some third party compiler?

I'm using C30 evaluation version. After 60 days everything  still works, but code is less optimized.

potul

BTW, and maybe a little offtopic.... One idea I stumbled with when searching for other stuff....
I was thinking of using 2 rotary encoders instead of pots, but the fact that they need 2 I/O pins each was a showstopper. But, I realized that:

-You can read multiple switches with a single ADC input, setting up an R2R resistor ladder. That is basically an DAC... so you read the analog value, and depending on this value you can know which switches are on and which off. This opens up a lot of room for pin optimization (debouncing might be tricky, though). So I could use a single ADC input to read 2 encoders. (4 bits), and even add another switch to it.

-The same applies to Pots. If you can afford to have half pot resolution, you can feed 2 pots in the same ADC input. The MSb will represent one pot, the LSb the other one.

I will see if I can get my hands on a rotary encoder and try... but it will take me some weeks.

Mat

Galego

I doubt it. The current status of the encoder signals doesn't mean anything. You need to know the previous value of the signals to compare it with the current to know if you're going forwards or backwards.

One detent of the encoder outputs the following:
1100
1001

If we rotate the encoder what will happen?
from:
   v
11001100
10011001
to:
    v
11001100
10011001

old = 1,(1)
new = (1),0
direction = 1 xor 1 = 0 (xor of the numbers in parenthesis) - moving CW

from:
    v
11001100
10011001
to:
     v
11001100
10011001

old = 1,(0)
new = (0),0
direction = 0 xor 0 = 0 (xor of the numbers in parenthesis) - moving CW

Now in the other direction:
from:
   v
11001100
10011001
to:
  v
11001100
10011001

old = 1,(1)
new = (0),1
direction = 0 xor 1 = 1 (xor of the numbers in parenthesis) - moving CCW

from:
  v
11001100
10011001
to:
 v
11001100
10011001

old = 0,(1)
new = (0),0
direction = 0 xor 1 = 1 (xor of the numbers in parenthesis) - moving CCW

and so on...

Another easy way to see it is to look at a longer sequence:

110011001100110011001100
100110011001100110011001

If you move the botton row one step further you'll see how xor'ing them will always return 0:
110011001100110011001100
100110011001100110011001


If you move the botton row one step back you'll see how xor'ing them will always return 1:
110011001100110011001100
100110011001100110011001



I know this is a bit confusing, i hope my explanation makes sense.

MoltenVoltage

Encoders are mechanical and their datasheets specify a certain amount of "contact bounce".

Unless you are using optical encoders (which are generally a lot more expensive), the mechanical contacts are going to bounce and you are never going to get a steady stream of ones and zeroes as Galego suggests.

Even the encoders he uses specify: "Contact Bounce ( at 15 RPM) 5.0ms max."

http://www.bitechnologies.com/pdfs/en11.pdf

This bounce has to be dealt with in the code or it will result in false data with unexpected results.

Determining the debounce algorithm that suits your encoder (in fact you will need to test a number of encoders from the same batch to find a happy medium) and the speed range at which you expect people to turn them takes trial and error and will be different depending on the complexity of your code and the number of interrupts that are competing for CPU cycles.
MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!

Galego

I don't have the habit of looking for solutions to problems i don't have. What i said was that I had no problems with those encoders and i'll add that it works with PIC16F684, PIC16F88, PIC16F877 and PIC18F2550 running at 8-20MHz.
I'm not saying there isn't a situation where you'll need debouncing, interrupts or whatever, but i can guarantee that it works just fine in the experiments i've made.

You can bring up all the info you want, but If i had any issues with it, i don't see a reason why i would say otherwise. So please stop insinuating that i'm deceiving people, and stop putting words in my mouth.

potul

Quote from: Galego on March 06, 2011, 08:15:59 AM
I doubt it. The current status of the encoder signals doesn't mean anything. You need to know the previous value of the signals to compare it with the current to know if you're going forwards or backwards.

I don't see the relationship of this with what I commented regarding using an ADC and an R2R ladder. You can continuously poll the ADC value the same way you poll continuously the value of digital inputs.

MoltenVoltage

#27
Quote from: Galego on March 06, 2011, 12:47:24 PM
I don't have the habit of looking for solutions to problems i don't have. What i said was that I had no problems with those encoders and i'll add that it works with PIC16F684, PIC16F88, PIC16F877 and PIC18F2550 running at 8-20MHz.
I'm not saying there isn't a situation where you'll need debouncing, interrupts or whatever, but i can guarantee that it works just fine in the experiments i've made.

You can bring up all the info you want, but If i had any issues with it, i don't see a reason why i would say otherwise. So please stop insinuating that i'm deceiving people, and stop putting words in my mouth.

I'm not trying to insinuate anything.

You have said repeatedly that your project is working fine.  I don't doubt this is true.

My experience was very different with encoders.  I spent a couple weeks getting them to work fluidly with Molten MIDI 2.  This probably had to do with the fact that a whole lot of interrupts were involved and much more complex code, but I also had issues with switch bouncing.  I use the Bourns encoders, so maybe the ones you use don't bounce nearly as much.

I am just pointing out that your simplification of the issues is not a universal truth.  Encoders bounce.  Even the manufacturers tell you so.  If it doesn't create problems with your project, then it doesn't, but that does not mean it is an issue that can always be disregarded.

Again, my apologies if you feel insulted.  That wasn't my intent.

-------------------

Re Potul's comments,

I don't think you can use two pots an a single ADC input, because the voltages would not be separate, so they could not be read apart from each other.  Instead you would read the higher of the two.

With encoders, it might work if you had two separate voltages where they are held "high" and the rest state is 0v, but for any encoder I have seen, the rest state is +V.

MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!

potul

Quote from: MoltenVoltage on March 06, 2011, 04:36:14 PM

Re Potul's comments,
I don't think you can use two pots an a single ADC input, because the voltages would not be separate, so they could not be read apart from each other.  Instead you would read the higher of the two.
With encoders, it might work if you had two separate voltages where they are held "high" and the rest state is 0v, but for any encoder I have seen, the rest state is +V.

Oops, you are right, I was taking some bad assumptions... it will never work with 2 pots. But it should be possible with encoders. I've just purchased some encoders from ebay, once I receive them I will try.

Mat

Hal

Sorry for the bump, but I'm extremely interested in this project...I have been thinking of doing something similar myself.

Any update to this? How does it sound? Were you able to get anything useful out of it?

potul

My particular dsPIC project is still WIP. I'm not dedicating much time to it lately, but I was able to use some simple effects (flanger, short delays...), and I'm in the  middle of developing a looper.

Mat

earthtonesaudio

Quote from: potul on March 07, 2011, 08:18:10 AM
Quote from: MoltenVoltage on March 06, 2011, 04:36:14 PM

Re Potul's comments,
I don't think you can use two pots an a single ADC input, because the voltages would not be separate, so they could not be read apart from each other.  Instead you would read the higher of the two.
With encoders, it might work if you had two separate voltages where they are held "high" and the rest state is 0v, but for any encoder I have seen, the rest state is +V.

Oops, you are right, I was taking some bad assumptions... it will never work with 2 pots. But it should be possible with encoders. I've just purchased some encoders from ebay, once I receive them I will try.

Mat

System clock-driven CD4060 plus CD4051 allows the use of 8 separate pots while using only a single pin on the PIC (one ADC input only).

Hal

cool! How did the loopback sound? Did you AB it? Did you learn anything about codecs - are you using anything besides the built in ADC and DAC?

Thanks!
Hal

potul

What I tried is a Looper, so record-playback-overdub... Here you can see some testing:

http://www.youtube.com/watch?v=TOBXiai4FoI

And here some effects with the same unit.

http://www.youtube.com/watch?v=Yj0t6TNvrgM