Shop OBEX P1 Docs P2 Docs Learn Events
Max5250 DAC - “bit gluing” — Parallax Forums

Max5250 DAC - “bit gluing”

Tom_005Tom_005 Posts: 7
edited 2008-11-26 16:51 in Propeller 1
I have a MAX5250 Low-Power, Quad, 10-Bit Voltage-Output DAC with Serial Interface. A nice article was done in Nuts and Volts Column #59, March 2000 by Lon Glazner:
A Digital-to-Analog Converter for All Seasons. This is where I drew I inspiration on how to achieve my goal. The article was written for the BS2 not the Prop.

My confusion is How do I paste together the 16 bit word?

I understand the first 4 bits contains the address and control; the next 10 bits are my value for voltage, and then 2 addition bits that don’t matter to my case.

I can send a word hard coded and the chip responds no problem.

But I can not figure out how to “glue” the bits together so I can change my voltage value programmaticaly.
Here is a non-programmatic example of what I am trying to achieve.

adct=%0011

Vdata= %0000011111

So=%00

Wordtosend=(adct)+(Vdata)+(So)

Any advice, or direction on where to look for a method on how to do this “bit gluing” would be appreciated,
Thanks

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2008-11-26 16:51
    Tom_005,
    If your wanting to do this for a Propeller, then this would work...

    [b]CON[/b]
    adct = %0011    'Address and Control
    So = %00        'Don't Care Bits
    
    [b]VAR[/b]
    word     Vdata, Wordtosend
    
    [b]PUB[/b] Demonstration
        Vdata := %0000011111
        Wordtosend := adct<<12 + Vdata<<2 + So
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 11/26/2008 4:56:41 PM GMT
Sign In or Register to comment.