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
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 11: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 " !!!
*****************************************
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.
Doing amplitde control is probably too much to ask from a 16F@20MHz but a 18F@40MHz might be able to pull it off.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
/Ingvar
Hi All,
Thanks Ingvar at least you share the same vision as me.
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.Doing amplitde control is probably too much to ask from a 16F@20MHz but a 18F@40MHz might be able to pull it off.
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 12:45.
Regards
Sougata
The only interesting info here is the price reached ... ~ 50 US $ ( sold ...) .Originally Posted by sougata
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 " !!!
*****************************************
Hi,
How about making one for $50 ? Possible ?
Regards
Sougata
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 14: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 " !!!
*****************************************
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?
Originally Posted by Ingvar
10-MHz-DDS-Funktionsgenerator mit PC-Softwaresteuerung-preis:69,95 euro
Das ist gut, Ya ?
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
Hi,JoeOriginally Posted by Joe S.
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 " !!!
*****************************************
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 08:37.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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
Bookmarks