Shop OBEX P1 Docs P2 Docs Learn Events
D/A converter chips?? — Parallax Forums

D/A converter chips??

jojo Posts: 15
edited 2005-09-26 20:04 in Learn with BlocklyProp
Instead of using the PWM method to build a D/A converter, I want to use a real D/A chip.
My project is
a sinusiodal wave input from funtion generater·pass through A/D chip(ADC0831) to BS2 then D/A(DAC???)

Did anyone use a real D/A·chip to build this kind of circuit?
Please give me more information.
Thank you in advance.

Comments

  • edited 2005-09-13 04:22
    I've got a schematics and code "somewhere" for the MAX522CPA.· You can buy it from www.digikey.com.· If you want to give it a try, let me know and I'll start looking through my archives.
  • edited 2005-09-13 04:58
    I found the old post with example code for the MAX522 (below).· You can use it to test and make sure your MAX522 is connected correctly and working before integrating it into your project.

    Andy


    I got a sample of that MAX522 DAC from www.digikey.com (Digi-Key part number MAX522CPA-ND). After fixing a mistake in the program, the part works fine. A corrected and updated program is below. Make sure to put output capacitors across each DAC output and ground as shown in the schematic on page 1 of the datasheet. They aren't kidding about the 0.1 uF cap across DAC A and the 0.01 uF cap across DAC B. Also, make sure to connect Vref to Vdd for a 5 V scale. If you are using LEDs to view the signal, use diffused light LEDs, and go with large series resistors to avoid clipping, 1 k on DAC A and 10 k on DAC B.
    ·
    ' ----[noparse][[/noparse] Title/Description ]------------------------------ 
    
     
    ' Max522DualTraingle.bs2 
    ' Generate two triangle waves 180-degrees out of phase 
    ' at about 1.65 Hz. Set your oscilloscope for 100 
    ' or 200 ms/div. 
    
     
    ' ----[noparse][[/noparse] Directives ]------------------------------------- 
    
     
    ' {$STAMP BS2} 
    ' {$PBASIC 2.5} 
    
     
    ' ----[noparse][[/noparse] Circuit/Pin Definitions ]------------------------ 
    
     
    ' Use the schematic and pinmap on page 1 of the MAX522 
    ' datasheet for connecting power and filtering 
    ' capacitors. For testing, connect Vref (MAX522 pin 7) 
    ' to Vdd for a full 5 V scale. Basic Stamp 2, I/O pin 
    ' connections are listed below: 
    
     
    Din         PIN    6            ' Connect to MAX522 pin 8 
    Cs          PIN    5            ' Connect to MAX522 pin 1 
    Sclk        PIN    4            ' Connect to MAX522 pin 2 
    
     
    ' ----[noparse][[/noparse] Constants ]-------------------------------------- 
    
     
    SetDacB     CON    %00100010    ' See datasheet, 
    SetDacA     CON    %00100001    ' page 9. 
    
     
    ' ----[noparse][[/noparse] Variables ]-------------------------------------- 
    
     
    dacValue    VAR    Byte         ' D/A converter value 
    startValue  VAR    Byte         ' FOR...NEXT start value 
    endValue    VAR    Byte         ' FOR...NEXT end value 
    
     
    ' ----[noparse][[/noparse] Initialization ]--------------------------------- 
    
     
    LOW SCLK                        ' Clock low 
    HIGH CS                         ' Chip select high 
    startValue = 0                  ' Initialize loop limits. 
    endValue = 255 
    
     
    ' ----[noparse][[/noparse] Main Routine ]----------------------------------- 
    
     
    DO 
    
     
      FOR dacValue = startValue TO endValue STEP 5 
        LOW Cs 
        SHIFTOUT Din, Sclk, MSBFIRST, [noparse][[/noparse]SetDacA, 255-dacValue] 
        HIGH Cs 
        LOW Cs 
        SHIFTOUT Din, Sclk, MSBFIRST, [noparse][[/noparse]SetDacB, dacValue] 
        HIGH cs 
      NEXT 
    
     
      ' When start value is 255, end value is 
      ' 0, and visa versa. 
      startValue = 255 - startValue 
      endValue = 255 - endValue 
    
     
    LOOP 
    
    
  • jojo Posts: 15
    edited 2005-09-13 05:44
    Thank you
    Andy

    I will buy this chip and build it.

    Sorry I am the new user.
    There are two place that you mention I don't get·it.
    1. Vref (in Max522 chip) connect to Vdd(in Stamp)
    ··· How about the pin Vdd (in Max522 chip)? where should it go?
    2. there are two outputs, outputA and outputB
    ··· How can I connect to oscilloscope?



    By the way, have you ever try DAC0800 series chip or DAC0830 chip as D/A converter?

    Post Edited (jo) : 9/13/2005 6:19:14 AM GMT
  • edited 2005-09-14 03:11
    1. Both the MAX522's VDD and REF pins should be connected to the·Board of Education's Vdd sockets.· The rest of the connections are listed below.· Also, on page 1 of the MAX522 datasheet, connect the·4 capacitors as shown.

    BOE··· MAX522
    ---···

    Vdd····VDD & REF
    Vss··· GND
    P6·····DIN
    P5·····CS
    P4···· SCLK

    2.· Here's one way to connect the oscilloscope to view both channels.· I'm guessing you'll only need one of the two channels for your project, probably OUTA.

    Scope········ MAX522

    ··

    Ground clip···GND
    ChA·········· OUTA
    ChB·········· OUTB

    I've looked at the DAC0830 many times, but never bought one because it takes 12 I/O pins to operate.· I might use it with an SX52 microcontroller is speed is a major concern.· With BASIC Stamps, I try to stick with synchronous serial devices, because they usually only take two or three I/O pins.· In many cases, they can be bussed together with common·SCLK and·DIN/DOUT lines.· The only lines that need dedicated I/O pins are the CS lines.·
  • jojo Posts: 15
    edited 2005-09-25 06:07
    Dear Andy

    Thank you for your DC offset advice.
    Finally,I receive MAX522 from Maxim.
    I build it as Max522 datasheet and try to combine my ADC0831 circuit and program.
    But I don't get any anglog output in OUTB and OUTA.
    Here is how I connect this two together.
    I connect the Pin 6 (ADC0831) to pin 8 (Max522)
    Am I right?

    Or I need to connect P0(BOE) to P6(BOE).

    About program, I combine the program in Experiment 27 and the one you gave me.
  • edited 2005-09-26 20:04
    It's a good practice to connect and test subsystems separately before trying to make them work together.

    Wire up your MAX522 separately from your ADC0831, and use the test program I posted on 9/12/2005 to test it.

    Once you are sure it's working, then make sure the ADC0831 is working.

    After that, try writing a program that first reads the ADC0831, and then sends that value to the MAX522.
Sign In or Register to comment.