Shop OBEX P1 Docs P2 Docs Learn Events
SX driving a DAC — Parallax Forums

SX driving a DAC

Alex41Alex41 Posts: 112
edited 2009-12-29 20:50 in General Discussion
Hello,

I want my SX to produce an adjustable output voltage from 0-5v. The DAC is a LTC1257, 12 bit resolution.

The problem I have is that the output is "choppy" to use a non-electrical term.

My data connection to the chip works fine and my voltmeter is reading the voltage that the DAC chip should be putting out. The basic setup works just fine. Amperage output is very limited directly from the chip as it will only dimly light an LED. I've amplified the output of the DAC through a LM358AN op-amp. No problem lighting a LED now. Also the output is what it should be according to my voltmeter, but still the same choppy output. I'm using the Parallax USB oscilloscope to view the output.

I'm guessing that what I'm seeing is exactly what I'm supposed to see. I know the DAC turns on, creates a voltage, then turns off, repeating this many hundreds or thousands of times a second. I've tried a few capacitors on the output and it has helped, but I'm afraid if I use one that is too big, then it will create a delay when changing the output voltage.

Am I going about this all wrong? Web searches return lots of info on ADC's, but very little on DAC's. Even the datasheet on the DAC isn't very informative. It talks about noise filters, but I don't see this as noise from an external source.

Any ideas? direction to go? things to read?

Thanks for any input.

Alex

Post Edited (Alex41) : 12/18/2009 3:35:03 AM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2009-12-18 15:24
    Alex,
    I'm not sure what you mean by "choppy". But a DAC like the LTC1257 does not turn on and off. It creates a stable voltage and holds it there.

    If you could post your code, we could maybe see what is wrong.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1st rule of finance...Don't lose money.
    Never be ashamed of making an honest·profit.
    Live within your means...Make do, or do without.
    ·
  • Alex41Alex41 Posts: 112
    edited 2009-12-18 20:09
    Bean,

    I didn't post the code before thinking this was a problem on the hardware end. It is attached.

    By choppy I mean the output, when viewed on an oscilliscope, looks like it has a lot of noise. I'll see if I can capture it and post it.

    I've attached a LCD to view the variables for debugging away from·my computer.

    Alex
  • LeonLeon Posts: 7,620
    edited 2009-12-19 20:03
    Forget the other hardware for now - simply output a fixed value to the DAC, and see what you get. Then try a ramp and check it with the scope. That should help you locate the problem.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
  • Alex41Alex41 Posts: 112
    edited 2009-12-22 00:35
    Here is a post when I was working on this a while ago.


    http://forums.parallax.com/forums/default.aspx?f=7&m=251301&g=254365#m254365

    The Link has a much shorter version of the one posted a few days ago. The code running the LTC1257 is identical.


    Here is the meat of the program running the chip.

    PinLoad = 0 ' activate chip to receive data
    SHIFTOUT Din,Clk,MSBFIRST,Pottime_MSB ' send high nib
    SHIFTOUT Din,Clk,MSBFIRST,Pottime_LSB ' send low byte
    PinLoad = 1 ' de-active chip to output voltage

    I don't know for sure if the above is even correct. It works, but I don't know if de-activating the chip is correct. Above Bean said that the DAC chips put out a constant voltage. When I deactivate the chip am I shutting off the chip and is that why I get such a rough signal? I figured out the above code by trial and error and not sure if it is the right way to go about it.


    This project has been sitting in my "to finish" box for a while and I want to know if it will work. It seems like I'm pretty close.


    Leon,
    The DAC does put out a fixed voltage when using a fixed value. My voltmeter reads it as a steady voltage. My scope shows a signal with a lot of noise in it. That's my problem.


    Thanks for everyones help so far.
  • PJMontyPJMonty Posts: 983
    edited 2009-12-22 18:15
    Alex41,

    How much noise are we talking about here? 1/2 volt? 1/4 volt? Smaller? Larger? A 12 bit DAC running at 5 volts means each step is roughly 1 millivolt. What is the setup you're working on? A breadboard with long wires everywhere? If you don't have a PCB with a ground plane, don't expect a clean output from a hi-rez DAC. The funkier your setup is, the funkier the output will be.

    Thanks,
    PeterM
  • Alex41Alex41 Posts: 112
    edited 2009-12-22 21:07
    Peter,

    it was first setup on 2 seperate breadboards. Now it's soldered to a circuitboard with several 5-6 inch wires running to a SX-28 protoboard. I guess that sure could be a problem.

    Right now I don't have a good answer on the amount of noise. I'll see if I can get a screen capture from the scope and post it tonight.

    Thanks,
  • Alex41Alex41 Posts: 112
    edited 2009-12-29 20:50
    OK,

    I have some more info/answers to questions to post.

    I appreciate everyones input, sorry it took a while to post this. Food poisoning tends to slow you down a bit.

    I have 2 pics attached. The setup is this, SX talks to DAC, then DAC output is amplified with an OpAmp. The output from the DAC is the same as from the OpAmp.


    DAC01 shows the output on the Parallax 'scope. The "Noise" is about 0.15 volts plus and minus the generated voltage of about 0.9 volts, for a total amplitude of about 0.3 volts. Also the 3 dips in voltage I haven't seen before.

    DAC02 shows the same output, but a higher voltage of about 1.3 volts. Total amplitude of the noise is still the same as the other pic.



    Any ideas?
    Alex


    PeterM,
    I have the DAC and OpAmp soldered to a Radioshack circuitboard, they are close together, but have no ground plane. The longwires of about 5-6 inches come from the SX Protoboard to the circuitboard. They are carrying the data to talk to the DAC.

    Post Edited (Alex41) : 12/29/2009 8:59:52 PM GMT
Sign In or Register to comment.