Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: not sure how to use DAC ( not PWM ) T3.6

  1. #1

    not sure how to use DAC ( not PWM ) T3.6

    hello
    from my understanding , analogwrite() is using PWM pins so it's an analog emulator . i also found guidelines for using low pass filter that will turn the PWM signal to an actuall analog - but it comes with delays and noise that i seek to refrain from .

    am i missing an actual analog output pin that receives a value and produces a spectrum of voltages between 0 and 3.3V ?

    thanks

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,534
    If you had read the reference page on the PJRC website, you'd have seen that analogWrite was extended to the DAC pins, doing a true digital/analog conversion:
    https://www.pjrc.com/teensy/teensy31.html (scroll down to "12 Bit Analog Output")

    But you are right, on the outdated 8bit AVR processors, analogWrite does only PWM.

  3. #3
    the link you put shows exactly what i want , but it is a feature of T3.2 and i am talking about T3.6 . is it the same for the 3.6 version ?

    i got a bit confused , you say i'm right but show me that it is an option - how should i proceed ?

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,257

    Cool

    Quote Originally Posted by gony View Post
    the link you put shows exactly what i want , but it is a feature of T3.2 and i am talking about T3.6 . is it the same for the 3.6 version ?

    i got a bit confused , you say i'm right but show me that it is an option - how should i proceed ?
    The Teensy 3.5 and 3.6 have two DAC pins so you can do stereo effects, but they are on different pins (assume the USB connector is pointing up for the directions):
    • On the Teensy LC, the single DAC is on A12 and the position of the DAC is the second pin on the right side of the back 7 pins;
    • On the Teensy 3.1 and 3.2, the single DAC is on A14 and the position of the DAC is the second pin on the right side of the back 7 pins;
    • On the Teensy 3.5 and 3.6, the two DACs are on A21 and A22 and the position of the pins are pin #16, 17 on the right side.

  5. #5
    great !
    now i see the pins A21 and A22 , with the DAC0 and DAC1 sign .
    so now simply following the instructions on this link https://www.pjrc.com/teensy/teensy31.html ( and changing the pin to A21 / A22 ) will do the trick ?

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,534
    Studying the reference cards which come with the Teensy 3.5 and 3.6 should have shown you that these have even 2 of these DACs, and the Teensyduino core files allow you (naturally) to access these with analogWrite(A21) and analogWrite(A22) instead of analogWrite(A14) for the Teensy 3.1 and 3.2.

    For more details, you might look at the Teensy 3.6 reference manual.

  7. #7
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,534
    Quote Originally Posted by gony View Post
    great !
    now i see the pins A21 and A22 , with the DAC0 and DAC1 sign .
    so now simply following the instructions on this link https://www.pjrc.com/teensy/teensy31.html ( and changing the pin to A21 / A22 ) will do the trick ?
    Yes it will. Don't ask, try out and be happy!

Tags for this Thread

Posting Permissions

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