Low cost audio function generator(DDS)


Closed Thread
Results 1 to 31 of 31
  1. #1
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563

    Unhappy Low cost audio function generator(DDS)

    Hi,

    I need to design a low cost digital audio function generator. For the sinewave generation I would use a lookup table. To keep the control digital I need to scale (modulate) the peak sine values in software and softare PWM. Cannot use a PGA for cost restriction.
    What is the best principal for that ?

    I am restricted in terms of PIC throughput considering the soft pwm and other housekeeping functions. I must use a PIC16 @ 20MHz series to keep down the cost lower. So calculating the sine values on the fly (when doing a modulation) may eat up to much cycles to fit within the update routine

    Please guide if it is at all possible and how ?
    Regards

    Sougata

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Is there a specific reason why you want to use a PIC for that?

    What is your frequency range?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default Unavailability of components

    Dear Steve,

    Thanks for replying. Actually I live in a part of my country where sourcing of specialized components is a real problem. Initially I considered using a DDS chip. But set back due to unavailability. Frequency range is within 10K. I haven't done the homework yet. Just trying to get some guidelines whether to base it on a 16F. The possibility you can say. If it is technically possible then I might consider using a 18F too. That depends on the overall BOM cost.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Default

    Hi, Sougata

    ICL 8038, voltage controlled ??? ... you use the Pic as the freq regulator ... say, you build a simple PLL !!! but 8038 outputs some sinewaves ...

    bad idea ???


    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default Down memory lane

    Dear Alain,

    Thanks for your reply. I just don't want to go the conventional (traditional)way. I have used MAX038 (big brother of XR8038) earlier but it was a pure analogue design with some fancy digital control as you mentioned. This project is all about low cost and best control. In fact with a PC side software the lookup tables could be modified to generate other waveforms as well. I am asking you guys for the possibility on a 16F. Storing one quadrant of data in the lookup table and building the sinewave is easy. But while modulating it, for a 8bit modulation index, I am doubtful on the processor througput considering 16/32 bit math. If there is an easy way out to do this in software please guide.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Default Commercial example ...

    Hi, Sougata

    Here, you will find such a DDS module ... for the price ... just tears left !!!

    http://shop.elv.de/output/controller...0&detail2=6325

    or here, with a PC interface:

    http://shop.elv.de/output/controller...&detail2=10617

    Alain
    Last edited by Acetronics2; - 12th December 2006 at 10:24.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  7. #7
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Smile

    Hi Sougata,

    I did some experimenting with DDS a few years ago, i wrote this piece of code. If my memory serves me right, it worked up to 20kHz with reasonable good looking sine on the output. I also did some testing with PWMoutput but never got good results with that, there may be some leftovers in the program from that ...... just remove.
    Code:
    '****************************************************************
    '*  Name    : DDS16F.BAS                                        *
    '*  Author  : Ingvar Gillholm                                   *
    '*  Date    : 2004-03-11                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : This program produces a sinewave through PortB,   *
    '*          : which should have a R-2R leadder connected to it. *
    '****************************************************************
    
    
    @ device  pic16F876, hs_osc, wdt_off
    
    define OSC 20
    'DEFINE LOADER_USED 1
    
    TonePort    VAR PortB
    CheckNew    VAR PortA.3
    
    Phase       VAR BYTE[3] BANK0
    Freq        VAR BYTE[3] BANK0
    Zero        VAR BYTE    BANK0
    
    TempVar     VAR BYTE
    
    ADCON1 = 7      'Porta is digital
    TrisA = $ff     'All inputs
    PortB = 0       'Start with all outputs low
    TrisB = 0       'All outputs            
    Zero = 0
    
    PR2 = $3f
    OUTPUT PortC.2
    T2CON = %00000100
    CCP1CON = %00001100
    GOTO New
    
    Main:
    asm
    ;
    ;======================== MAIN LOOP =========================
    ;
    
        bcf STATUS,RP0
        bcf STATUS,RP1
    
    Loop
        BTFSC   _CheckNew     ; Check for a new	frequency
        GOTO    _New          ; and get new frequency
                              ;
    	MOVF	_Freq,W       ; Get the current frequency
    	ADDWF	_Phase,F	  ; and increment the phase
    	btfss STATUS,C        ;
        goto NoCarry          ;burn time if no carry
    	incf _Phase+1         ;
    	btfsc STATUS,Z        ;
    	incf _Phase+2         ;
    AfterCarry	              ;
    	MOVF	_Freq+1,W     ;
    	ADDWF	_Phase+1,F    ; 
    	btfsc STATUS,C        ;
    	incf _Phase+2	      ;
    	MOVF	_Freq+2,W	  ;
    	ADDWF	_Phase+2,F    ;
    
    	MOVF	_Phase+2,W	  ;
    
    	ANDLW	07Fh		  ;Reduce to 7 bits for 180 degrees
    	CALL	SineTbl		  ; and get amplitude
        
    	BTFSS  _Phase+2,7	;Is amplitude supposed to be negative?
    	SUBWF  _Zero,w		;Change polarity of sine amplitude
       	
        MOVWF	_TonePort     ;Output to DAC
    	GOTO	Loop		  ;
    
    NoCarry
        goto AfterCarry
    
    ;*********** SINE TABLE ****************
    
    SineTbl
    	ADDWF  PCL
        retlw 080h
        retlw 083h
        retlw 086h
        retlw 089h
        retlw 08Ch
        retlw 090h
        retlw 093h
        retlw 096h
        retlw 099h
        retlw 09Ch
        retlw 09Fh
        retlw 0A2h
        retlw 0A5h
        retlw 0A8h
        retlw 0ABh
        retlw 0AEh
        retlw 0B1h
        retlw 0B3h
        retlw 0B6h
        retlw 0B9h
        retlw 0BCh
        retlw 0BFh
        retlw 0C1h
        retlw 0C4h
        retlw 0C7h
        retlw 0C9h
        retlw 0CCh
        retlw 0CEh
        retlw 0D1h
        retlw 0D3h
        retlw 0D5h
        retlw 0D8h
        retlw 0DAh
        retlw 0DCh
        retlw 0DEh
        retlw 0E0h
        retlw 0E2h
        retlw 0E4h
        retlw 0E6h
        retlw 0E8h
        retlw 0EAh
        retlw 0EBh
        retlw 0EDh
        retlw 0EFh
        retlw 0F0h
        retlw 0F1h
        retlw 0F3h
        retlw 0F4h
        retlw 0F5h
        retlw 0F6h
        retlw 0F8h
        retlw 0F9h
        retlw 0FAh
        retlw 0FAh
        retlw 0FBh
        retlw 0FCh
        retlw 0FDh
        retlw 0FDh
        retlw 0FEh
        retlw 0FEh
        retlw 0FEh
        retlw 0FFh
        retlw 0FFh
        retlw 0FFh
        retlw 0FFh
        retlw 0FFh
        retlw 0FFh
        retlw 0FFh
        retlw 0FEh
        retlw 0FEh
        retlw 0FEh
        retlw 0FDh
        retlw 0FDh
        retlw 0FCh
        retlw 0FBh
        retlw 0FAh
        retlw 0FAh
        retlw 0F9h
        retlw 0F8h
        retlw 0F6h
        retlw 0F5h
        retlw 0F4h
        retlw 0F3h
        retlw 0F1h
        retlw 0F0h
        retlw 0EFh
        retlw 0EDh
        retlw 0EBh
        retlw 0EAh
        retlw 0E8h
        retlw 0E6h
        retlw 0E4h
        retlw 0E2h
        retlw 0E0h
        retlw 0DEh
        retlw 0DCh
        retlw 0DAh
        retlw 0D8h
        retlw 0D5h
        retlw 0D3h
        retlw 0D1h
        retlw 0CEh
        retlw 0CCh
        retlw 0C9h
        retlw 0C7h
        retlw 0C4h
        retlw 0C1h
        retlw 0BFh
        retlw 0BCh
        retlw 0B9h
        retlw 0B6h
        retlw 0B3h
        retlw 0B1h
        retlw 0AEh
        retlw 0ABh
        retlw 0A8h
        retlw 0A5h
        retlw 0A2h
        retlw 09Fh
        retlw 09Ch
        retlw 099h
        retlw 096h
        retlw 093h
        retlw 090h
        retlw 08Ch
        retlw 089h
        retlw 086h
        retlw 083h
    
    ENDASM
    New:
    ' The frequency is calculated as FreqValue = DesiredFreq/((1/2^24)*(5*10^6/28))
    ' Same as FreqValue = DesiredFreq/((1/16777216)*(5000000/28))
    ' Same as FreqValue = DesiredFreq*16777216*28/5000000
    ' Same as FreqValue = DesiredFreq*93,9524096
    ' The resolution is 1/93,9524096 = 0,01064368656703404........Hz
    
    ' The eight frequencies selected for this test is........
    '  67,0 = 001896
    '  94,8 = 0022CA
    ' 118,8	= 002B99
    ' 146,2	= 0035A7
    ' 173,8	= 003FC8
    ' 199,5	= 004937
    ' 225,7	= 0052D5
    ' 254,1 = 005D41
    
        TempVar = PortA & %00000111     'Only lower 3 bits
    '    LOOKUP TempVar,[$00,$00,$00,$00,$00,$00,$00,$00],Freq[2]    'Stuff Hibyte            
    '    LOOKUP TempVar,[$1a,$25,$2e,$39,$44,$4e,$58,$63],Freq[1]    'Stuff Midbyte
    '    LOOKUP TempVar,[$58,$47,$b7,$7d,$57,$72,$c0,$eb],Freq[0]    'Stuff Lowbyte
        LOOKUP TempVar,[$00,$00,$00,$00,$00,$00,$00,$00],Freq[2]    'Stuff Hibyte            
        LOOKUP TempVar,[$18,$22,$2b,$35,$3f,$49,$52,$5d],Freq[1]    'Stuff Midbyte
        LOOKUP TempVar,[$96,$ca,$99,$a7,$c8,$37,$d5,$41],Freq[0]    'Stuff Lowbyte    
        GOTO Main
    END
    Doing amplitde control is probably too much to ask from a 16F@20MHz but a 18F@40MHz might be able to pull it off.

    /Ingvar

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


    Did you find this post helpful? Yes | No

    Default Thanks Ingvar

    Hi All,

    Thanks Ingvar at least you share the same vision as me.
    Doing amplitde control is probably too much to ask from a 16F@20MHz but a 18F@40MHz might be able to pull it off.
    Actually my client wants to put this module into a breadboard trainer to make it compete better. he does'nt want to increase the manufacturing cost however.

    Because the amplitude control will also be used to modulte the base sinewave at a lower frequency it needs to be computed on the fly through a modulation index (I suppose).

    Thanks Alain for the link but I cannot read German.(I am not sure even if it is German at all)
    Last edited by sougata; - 12th December 2006 at 11:45.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by sougata
    Hi All,


    Thanks Alain for the link but I cannot read German.(I am not sure even if it is German at all)
    The only interesting info here is the price reached ... ~ 50 US $ ( sold ...) .

    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Cool Really Cool Alain

    Hi,

    How about making one for $50 ? Possible ?
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Wink No secret ...

    Here is the scheme ... and all you should know !!!

    http://www.elv-downloads.de/service/...S-Board_km.pdf

    and

    http://www.elv-downloads.de/service/...M_G_041222.pdf


    moreover ... all components are available at this address !!!

    Alain
    Last edited by Acetronics2; - 12th December 2006 at 13:19.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default Thanks Alain

    Hi Alain,

    Thanks for the links.
    Regards

    Sougata

  13. #13
    speck's Avatar
    speck Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Ingvar-

    Could this be made to work using the HPWM output & a timer interrupt to output very low frequency sine waves? (< 30hz) Using a lookup table & a variable timer interrupt cycle to vary the sample rate/freq. of the sine? Perhaps amplitude could be varied by scaling the wavetable values?

    Was it the case that the PWM output didn't give you a smooth sine at higher frequencies? Or it just didn't work well at all?

    Quote Originally Posted by Ingvar

    I did some experimenting with DDS a few years ago, i wrote this piece of code. If my memory serves me right, it worked up to 20kHz with reasonable good looking sine on the output. I also did some testing with PWMoutput but never got good results with that, there may be some leftovers in the program from that ...... just remove.
    Doing amplitde control is probably too much to ask from a 16F@20MHz but a 18F@40MHz might be able to pull it off.

    /Ingvar

  14. #14
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Talking comment

    10-MHz-DDS-Funktionsgenerator mit PC-Softwaresteuerung-preis:69,95 euro
    Das ist gut, Ya ?

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


    Did you find this post helpful? Yes | No

    Default HPWM works

    Hi Speck,

    It can always be done with a hardware PWM and low pass filter. See my sinewave inverter thread http://www.picbasic.co.uk/forum/showthread.php?t=1846 for a code snippet that does this at an update rate of 100Hz driving a half bridge. Scaling the sine table is impractical with only 8 bits of resolution. For example if you define your sinewave lookup table to produce the maximum peak value into an 8 bit one then you have to do fractional math.That is your modulation index (depth of modulation) is <= 1. (The dSPIC supports fractional math). So the trade-off is multiplying the lookup table with a 8bit value and shredding off the LSBs. This works okay for low fixed frequency. If you do a cycle by cycle computation then the overhead is manageable. But for a 20K function generator to work with a base frequency and modulating frequency it has to be updated every PWM interrupt cycle. That is too much you could ask for a 16F PIC @ 5 MIPS. The 18Fs have an extended instruction set featuring a single cycle hardware multiply that too @ 10MIPS. In fact you can use Darrel's Software PWM http://www.pbpgroup.com/modules/wfse...p?articleid=12 to make your life easy. It takes of all your pain in doing it in asm.

    BTW the PIC Hardware PWM uses upto 10bits and it is a good practice to set your PR2 to $FF. That is where you get the maximum usable PWM resolution.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S.
    10-MHz-DDS-Funktionsgenerator mit PC-Softwaresteuerung-preis:69,95 euro
    Das ist gut, Ya ?
    Hi,Joe

    I've "built" ( laughs ...) the 20Mhz one ...

    just need an extra output buffer for > 10 Mhz outputs ( there's a too low -pass response somewhere ! ) ... and because the HC132 is a bit weak on even small capacitive loads.

    Otherwise it works really fine !!! ... and 4Mhz is the Max I really need ...as a variable PIC clock drive.

    precision and resolution are really unbeaten for such price ...

    Yawohl ... sehr gut !!!

    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 " !!!
    *****************************************

  17. #17
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Talking

    Je dit... c'est le excellent prix pour le excellent produit ... yah!

    I don't know the following, and i don't know how good they are and are really far of the needed range here but...
    http://www.amqrp.org/kits/dds60/
    http://www.minikits.com.au/kits4.html

    Kinda time saver i guess.
    Last edited by mister_e; - 13th December 2006 at 07:37.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #18
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    Hi Speck,

    It should be possible to do with hardware PWM, espescially at low frequencies like that. I just never got it working very well at higher freqs, so i never really finished it off to see where the limits were. Feel free to carry out your own investigation cause it should be possible.

    I think it was probably due to the fact that the loop runs at 5000000/28=178,571kHz and the highest (useable) PWM freq was around twice that ....... no resolution. However, like i said, i never took it all the way, i got the results i wanted with the R-2R ladder.

    /Ingvar

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


    Did you find this post helpful? Yes | No

    Wink Appel au peuple...

    Hi,All

    I saw one application in a the French "Electronique Pratique" magazine, issue 247, page 86 ...

    But, halas, I didn't download the Pic ( Hex ) Program ... and it's no more available.

    May be someone has it in his computer memory ???

    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 " !!!
    *****************************************

  20. #20
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Below is the link for an audio sine wave generator chip. Works good.

    http://www.mix-sig.com/prodsh_MSLOSC.html

  21. #21
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Low cost audio function generator?

    Audio?

    What about using the PC Sound Card as Signal Generator?
    http://www.virtins.com/page2.html#Signal%20Generator

    Tons of freeware available.

    Best regards,

    Luciano

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


    Did you find this post helpful? Yes | No

    Default Thanks Luciano

    Hi,

    Thanks Luciano. I am aware of the Freewares available and the application is a product. However the issue is a little different. Its all about the scope of a 16F performing DDS. Without using much of additional circuitry.
    Mark thanks for the link. The scope of the project does not permit to use it. Otherwise I would have gone for waveform generator chip. Also it is hard to find (if not impossible) in low quantities (less than 0.5K). If I at all go on with this project then I would be going for a 18F with a R-2R DAC.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Wink a convenient tool ???

    Hi, Sougata

    a look at CYPRESS Application notes could give you the solution and soft ...

    I know ... it's not PICs !!! but Free ICD and simple programmer.

    Worth it !!!

    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default I will lookup

    Hi,

    Thanks Alain for the info. I have played a little bit with the PSOC from cypress sometimes back. But not so skilled. I will though hunt the appnotes there and find out if the project is possible in low cost .
    Regards

    Sougata

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


    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 " !!!
    *****************************************

  26. #26
    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

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


    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 " !!!
    *****************************************

  28. #28
    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

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


    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 " !!!
    *****************************************

  30. #30
    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

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


    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