Low cost audio function generator(DDS)


Closed Thread
Results 1 to 31 of 31

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,SOUGATA

    AN 2086 ...
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Let me clear some things

    Hi,

    Thanks Alain for the info. I am looking forward to an all digital way. Cypress PSOCs app-note uses a bandpass filter (integrated into the chip itself) In this thread things are being overlooked. So let me clear things up. I think only Ingvar replied with something direct reply related to my thread topic.



    1. I am not asking how to generate a sinewave ?
    2. Not battling on issues whether to use a Hardware PWM, R-2R or external DAC ?
    3. Not trying to use a dedicated DDS chip ?

    In a typical DDS system if I am having large phase accumulator registers then by offsetting and incrementing them at different update rate a sinewave with amplitude modulation can be produced. (attached DDS-01.gif)
    To do it real fast you possibilly need an ASIC. So lets now talk about the PIC way. To be specific PIC-PBP-ASM way.

    A function generator has controls for frequency, amplitude and also modulation. This is where (modulation) things get complicated.

    1. How to modulate (AM) the sinewave digitally ?
    I hope I type the word digitally correctly so I am not thrown back with answers like using a different PIC to generate the modulating waveform and using traditional analogue modulation techniques. Remember low cost = less BOM = no PGA = !!??!!
    I planned using the compare-match module for generating upto 16bits of usable PWM (soft ) resolution with minimal software overhead. Now I need to achieve the usable output sinewave to cover upto 20KHz. To keep the quantatization noise low I planned for a 64 point ( for each quadrant /attached 1Q-Sine.gif) lookup table. Now I have always found it impractical to generate a sinewave greater than 1/4 of the sample frequency. For fixed amplitude the lookup table could be computed and stored in an array. But for modulating it with another sine table (or arbitary) from a eeprom or an external AD input I found that I need to calculate the PWM values (sine through an obtained modulation index) on the fly. My weak maths revealed that I cannot (or the 16F PIC @20MHz) handle it cause I do not have enough instruction cycles. I was very hopeful that the Gurus out there would shed some light but this thread did not bring up much. One contributor (no offense) mentioned in a PM that he could do it better than me but remained silent there after. So now you do the MATHS and give me a Yes or No if it can be done on a 16F (no support for hardware multiply). That was the original topic.

    I am sorry if I am being rude. (May be my client is also following this thread!!!!!) If cost was not the factor then I would have gone any other way. Anyway I am still looking forward to suggestions from the Pros out there.
    Attached Images Attached Images   
    Last edited by sougata; - 6th January 2007 at 15:57.
    Regards

    Sougata

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Sougata ...

    You were looking for the cheap way ... a powerful Cy8C29466 ( 32K ) costs here 7 Euros ( 9 US$ ) !!! and the IDE is free ... and no expensive peripheral needed.

    That's the reason of my answer.


    Q1. How to modulate (AM) the sinewave digitally ?

    maybe generating your Analogic output across a full port ( an R-2R ladder ... as simple as this ! ) could solve the problem for a honest 256 steps amplitude resolution ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Cypress is costly here in my hometown

    Hi Alain,

    Using R-2R ladder does reduces software overhead. Fixed amplitude routine takes about the same code for both the PWM and the R-2R in. (8 bits) If a hardware PWM is used then the code overheads are almost the same. Write to PORT or CCPR (Ignoring LSBs). But I wanted to read an ADC or another lookup table within the PWM/R-2R update routine to create AM. I lost on the available cycles there. Then the sampling Freq is just not achievable. Now the most sad part.

    In my country (India) 1 USD = 50 INR (Indian Rupees). A PIC16 comes for about 1 USD but a PSOC lands for about $15. My client has a traditional Func-Gen (below average) which costs him less than $18, that too in annual quantities less than 1K. He wanted to give it a digital face lift so that he could better sale his product. He is ready to pay me for the development provided I fit the BOM within $20. I manage to earn my living by PICing and almost always face this constraint.

    I could have modified the analogue thing to display the freq./amplitude on a LCD but that was not my intention. (Actually this was the clients basic requirement). I am a 100% self taught and as Steve says there is no problem only learning opportunities.
    Regards

    Sougata

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink Humour ...

    Hi, Sougata

    Did you spent some time here ???

    http://www.picbasic.org/forum//showthread.php?t=1601

    some ideas to pick up.

    Bingo here : http://www.romanblack.com/picsound.htm

    Alain
    Last edited by Acetronics2; - 7th January 2007 at 10:40.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default I have played in the past

    Hi,

    I have tried using magic sinewaves from don and also tried the 1 bit audio playback from the PIC. They just don't suit my current requirement. I did a speaking greeting card using a PIC, EEPROM and 1 bit audio!!
    Regards

    Sougata

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Sougata

    another idea ...

    http://www.compile-it.com/Proton/PIC_WAV_PLAYER.zip

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  2. Pic16f84 and RC5 kode
    By terminator in forum Bluetooth
    Replies: 5
    Last Post: - 18th June 2007, 21:40
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Problems with RC2 and RC3
    By Christopher4187 in forum General
    Replies: 11
    Last Post: - 29th May 2006, 17:19
  5. 4-line LCD Help - using PortA instead of B
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 31st March 2005, 03:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts