DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?


Closed Thread
Results 1 to 40 of 77

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    I don't know how fast a PIC at 10, 15 or 20 MHz can output new values on a Port but sure he has a 3rd order filter at the output that makesthe difference.

    Note that.

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    Depends how much distortion you want to acheive. Sure enough you need a filter somewhere OR a way better granularity which imply a way bigger lookup table, but if you do so, you also limit your max Freq. Even with that, you'll always have some steps in your waveform.

    Another thing, 1% (or less) precision resistor MAY help... but still.
    Steve

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

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    Well that is not exactly what I was thinking about. but it does provide some data. with the tuning word = 1 I caculate it takes about 24 instrcution cycles to get through the main loop. thats 3 uS. or the 333K you referenced above. IMHO that seems plenty fast enough to make a 5K signal. at 5K, you will have enough time to run your loop ~66 times. so thats 33 loops for each half cycle. so every 5.4 degrees you change output values. that would be the same as skipping values in the table I suppose. I know I am not helping here, but something just feels better thinking about the values this way. the next issue is sine waves are not triangle waves. there is more action over time at the reversals. during the rise and fall they are almost vertical, well more then 45deg anyway. So it seems to me you need more of those samples there.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    Why dont you change to a 18F46K20 or similar that you can run on 64MHz. A 64MHz pic is not that much more expensive unless you plan to make lots and lots of your product.

    Speed could be helpful sometimes.

    Meep Meeep as the Road Runner would have said!

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


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    Steve

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

  6. #6
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    Quote Originally Posted by Jumper View Post
    Why dont you change to a 18F46K20 or similar that you can run on 64MHz. A 64MHz pic is not that much more expensive unless you plan to make lots and lots of your product.

    Speed could be helpful sometimes.

    Meep Meeep as the Road Runner would have said!
    I'm not designing a product...this is just me learning about the benefits/constraints of DDS, think I need a break from this one for a few days now though!

    RE going with an 18F PIC....the 16f1822 can run at 32Mhz (which is pretty fast!)....also smaller PICs just appeal to my sense of "wow, look what was squeezed out of that tiny thing!"

  7. #7
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    MIIPS MIIIPS !! What the Road Runner really meant.

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: DDS (generating sine waves) with onboard DAC using latest PIC 16F chips?

    Hi,
    I had a play with this. Just a counter variable pointing into the lookup table which outputs the value to PortB where a R2R ladder and 2nd order low-pass filter with a cutoff at ~6kHz is waiting.

    Here's a scopeshot, raw signal on Ch1, filtered on Ch2 (as if that wasn't obvious):
    Name:  Scope 5kHz.jpg
Views: 1795
Size:  108.3 KB
    To get ~5kHz output I had to index the table in steps of 20 but then I'm only running at 8Mhz. At 32Mhz you should be able to get pretty good performance and signal "quality". Of course, everything is relative...

    I did (or do) have a weird problem though with the PIC resetting that I can't figure out but I'll post that in a separate thread.

    /Henrik.

Members who have read this thread : 1

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