MCP4922 Dual DAC


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Try mode 5?

    DEFINE SHIFT_PAUSEUS xx?

  2. #2
    J_Brittian's Avatar
    J_Brittian Guest


    Did you find this post helpful? Yes | No

    Default

    Originally I used mode 5 because that was the way my code ran for the 1257 DAC. I took another look at the MCP4922 datasheet though and on pg. 19 it shows the clock idles low and somewhere I think I read that the data gets latched on a low to high clock pulse. What would DEFINE SHIFT_PAUSEUS xx do ? I'm more concerned about the way I tacked the configuration bits on to the front of my variable. I have to send the DAC 16 bits. The first four are the configuration bits the next twelve bits are the output. Should I add/or a 16 bit configuration value with my output variable and then only Shiftout a single 16 bit number? Or should it work the way I've got it?

  3. #3
    Join Date
    Oct 2005
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    DEFINE SHIFT_PAUSEUS xx where xx is some number will slow down the SDI transmission. Looking at the data sheet, it shouldn't be necessary but maybe worth a try? No harm in trying to make up one 16 bit word for transmission either, maybe that would help.

    Like I said, I'm pretty new to PICs but I've found if I thrash around and change enough stuff I can mostly get stuff to work....mostly.

    As far as I can see, your connections and logic look good. Sorry I can't find you a magic bullet.

  4. #4
    J_Brittian's Avatar
    J_Brittian Guest


    Did you find this post helpful? Yes | No

    Default

    I tried DEFINE SHIFT_PAUSEUS 100. Still no output.

    I used a logic probe to verify activity on the serial and clock pins. I can watch the CS pin go low. Activity on the LCD screen verifies the program is running. The PIC seems to be doing what it's supposed to. I changed the Shiftout command to:

    Shiftout alldata,CLK,1,[%1111111111111111\16]' Shift out the 16-bit word

    This should output 5V on output B.
    Still no output.

    The differences between this chip and the LTC1257 are: Configuration bits, hardware and program shutdowns, LDAC signal. I think I've addressed all of these. Using essentially the same code as below, just without configuration bits, I verified the PIC16F877 I'm using will drive the LTC1257. I've exhausted all my ideas for now. Any thoughts at all are welcome.

  5. #5
    Join Date
    Aug 2004
    Posts
    64


    Did you find this post helpful? Yes | No

    Default dac

    J.Britain:
    Do you can live with 8 bits.?
    Last week I tried the MAX520, with 4 DAC channels.
    It uses I2C and worked in the first try. It is more expensive than the
    Microchip part,but with 4 channels. I got them at Digikey.
    I hope this helps...
    Greetings...
    Ruben de la Pena

  6. #6
    J_Brittian's Avatar
    J_Brittian Guest


    Did you find this post helpful? Yes | No

    Default Give up?

    Ruben,
    You want me to give up? I have ten of things sitting on my desk.

    -Josh

  7. #7
    Join Date
    Aug 2005
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    I have had problem with the shiftin/shiftout commands depending on the device being used.The clock pulses are too fast and using the define shift_pauseus doesn't seem to help.Writing your own works best as you can control the clock pulses.This example sends out the control bits,then reads in the data bits.


    DataAcquisition:
    for Indexer = 12 to 0 step -1 ' Output data,13 clock pulses
    portc.2 = SerialDataOut.0[Indexer] ' Output data port
    gosub Clockout ' Output clock pulse
    next Indexer ' Next data bit,next clock pulse
    for Indexer = 1 to 12 ' Read data,12 clock pulses
    SerialDataIn = SerialDataIn * 2 ' Shift each bit to the left
    SerialDataIn = SerialDataIn + portc.3 ' Data in port
    gosub Clockout ' Output clock pulse
    next Indexer ' Next data bit,next clock pulse
    Clockout: ' Clock pulse
    pulsout portc.0,5 ' Clock pulse port, 1 msec
    return

Similar Threads

  1. PIC18F4525 to DAC (PCF8591P) I2CWrite too fast?
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th April 2008, 08:16
  2. countdowntimer with dual 7segment display with 16f628a
    By dr.ragh in forum Code Examples
    Replies: 23
    Last Post: - 3rd May 2007, 13:22
  3. dual 7-segment countdown timer code
    By dr.ragh in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 30th April 2007, 13:19
  4. Bluetooth wireless with PIC / HSERIN / DAC
    By rpatel in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2004, 22:13
  5. 10 bit pwm as dac
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th June 2004, 15:12

Members who have read this thread : 0

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