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?

    Not quite relevant, but for the DAC that was discussed before, for the new PIC 1782/3, it needs 10usec for each sample to output a DC voltage. So it will reach about 390Hz maximum.

    So even this solution is slow enough for the 5KHz target.

    Can the HPWM be of some help here? I think it can for a 32MHz PIC.

    Ioannis

  2. #2
    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 Ioannis View Post
    Not quite relevant, but for the DAC that was discussed before, for the new PIC 1782/3, it needs 10usec for each sample to output a DC voltage. So it will reach about 390Hz maximum
    Yeah, after my initial excitement ....while that's still a potentially very cool new PIC, a 28 pin solution seems excessive for a simple PIC DDS proposal!

    Re going with HPWM.... alas, that would need someone who knows a whole more about filters than myself!

    I'm obviously still not grasping something quite fundamental here (talk about being slow or what?!), cos this guy gets a lovely smooth 8 bit sinewave @ 8.9khz - and using a sampling (interrupt) rate of only 100khz .....

    http://www.g4jnt.com/PIC_DDS.pdf (albeit he's LP filtering the PIC output & hasn't shown whether the prefiltered R2R ladder is ugly or otherwise)
    Last edited by HankMcSpank; - 28th August 2011 at 19:44.

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

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

  5. #5
    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!

  6. #6
    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!

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

  8. #8
    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!"

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