Help on Spin headphone to microphone object
domeniv97
Posts: 14
Hi there,
I am trying to get familiar it audio in and out with the parallax propeller 1 activity board.
I am using the Microphone to headphone object published in the github (https://github.com/parallaxinc/propeller/blob/master/libraries/community/p1/All/Microphone to Headphones/microphone_to_headphones.spin) but I seem to not be able to produce any output nor input.
It is unclear to me, with the mask $00000E00, which pin is expected to be used for microphone input and which for speaker output. Can someone maybe help me understand the code a bit better?
Domenico
Comments
Hi,
The application notes on adc and counters might be helpful!
https://www.parallax.com/download/propeller-1-documentation/
$00000E00 ist the bitmask for dira, every 1 bit sets a pin to output. So P9, P10, P11 are outputs.
The demo is made for the DemoBoard, which uses P10, P11 for Audio Out, and P8, P9 for the Microphon ADC. P8 is the input pin for the ADC and P9 the Feedback output for the delta modulator.
Unfortunately the demo code is written with all hardcoded pins, so it needs some PASM knowledge to change it to other pins.
I think the Activity board has no Microphon input, so you will need to add it on the breadboard. The problem is the ADC circuit must be built very close to the Propeller pins to work well.
Andy
domeniv97,
The Propeller Activity Board (PAB) has an ADC built into it, but the documentation doesn't specify its part number.
https://www.parallax.com/package/propeller-activity-board-wx-product-guide/
https://learn.parallax.com/tutorials/language/propeller-c/propeller-c-simple-circuits/measure-volts
What exactly are you trying to do?
BTW, $E00 = 1110 0000 0000
Thank you all for the explanation!
For the moment, I am just interested in the audio input and output capabilities of the propeller 1 for a university project involving open source hardware, so I would like to fin out if it is possible to use solely that chip for ADC in and DAC out.
I am using a propeller activity board and I did not notice that a discontinued demo board also existed and though they were the same, no the pin masking and the fact that I have to change it accordingly is clearer, I still struggle with understanding if the propeller 1 alone would be able to deal with ADC in and DAC out by itself though.
Domenico
The attached schematic and BOM include the ADC and DAC.
The ADC used was: ADC124S021
domeniv97,
Chapter 7 of the Propeller Education Kit Text has a number of different applications using the Propeller.
https://www.parallax.com/package/propeller-education-kit-fundamentals-text-and-code/
You should also refer to the Propeller Manual for programming information.
https://www.parallax.com/download/propeller-1-documentation/
There's an old schematic for the Demo board here.
https://forums.parallax.com/discussion/85107/new-propeller-demo-board-photo-and-schematic
This is the newest.
https://www.jameco.com/Jameco/Products/ProdDS/2174856Schematic.pdf
I wanted to give you a bit of an update and ask again for suggestions: I put together in the breadboard of the Propeller 1 activity board the schematic of mic input and feedback loop of the demo board (https://forums.parallax.com/discussion/85107/new-propeller-demo-board-photo-and-schematic, picture related
) and modified the mask of DIRA in the spin code (https://github.com/parallaxinc/propeller/blob/master/libraries/community/p1/All/Microphone to Headphones/microphone_to_headphones.spin) to 0000_1100_0000_0000_0000_0010_0000_0000 so that P9 and P26, P27 are now outputs, so that now according to the Parallax propeller activity board it should output to the headphone jack of the board itself. I still get no signal. Suggestions? Has anyone tried DAC and ADC scripts for the propeller activity board?
@domeniv97
In that code, did you also change:
Those lines set up the counters with the correct I/O pins.
domeniv97,
I think it is important that you not only know what changes to make but WHY.
According to page 96 of the Propeller Manual:
MOVS writes the value for APIN to the CTRx register.
MOVD writes the value for BPIN to the CTRx register.
MOVI writes the values for CTRMODE and PLLDIV to the CTRx register.
In the code above, 01001 is CTRMODE which is POS detector with feedback, and PLLDIV is 000 which is VCO/128 but PLL is not being used here so this value is meaningless.
The table of CTRMODEs and is on page 98 of the Propeller Manual.
Here is a modified version with PIN constants (untested)
Avsa242 silly me, I forgot to change those, well that was the problem!
Thanks Ariba, now it works well and your version uses constants so I like it and I will make use of it!
Genetix, I am aware of it, I will need to learn in deep how PASM works, I will check and recheck the manual. In my defense: The project I am part of is three years long so hopefully I will have a lot of time to learn by heart everything about the inner workings of the propeller 1.
Again thanks to everyone!