MCP4822 (DAC) not working with Timer of dsPIC33F

Discussion in 'Embedded Systems and Microcontrollers' started by Harnee15, Dec 29, 2015.

  1. Harnee15

    Thread Starter New Member

    Sep 14, 2015
    24
    0
    Hello everyone,

    I have two DACs (MCP4822) as slaves and dsPIC33F as master. I'm using interrupt Timer3 for writing to the DACs. The problem is that when I write on the DACs without using Timer, I get the desired output. However, when I use Timers, I don't get the required output.

    Does this mean that the DAC (SPI) can't be controlled from the Timer of the dsPIC? Can anyone please help me with this, please?

    Many Thanks!!
     
  2. Picbuster

    Member

    Dec 2, 2013
    373
    50
    Timer 2/3 are difficult are normal used to generate PWM but they must do the job.
    Setup the timer3 and toggle a pin on overflow. This must indicate a working timer.
    You might run into the problem of an interrupt inside an interrupt ( timer SPI out/in).
    I don't know what your MPU is doing during this event.
     
  3. dannyf

    Well-Known Member

    Sep 13, 2015
    1,779
    360
    Yes and No.
     
  4. sailorjoe

    Member

    Jun 4, 2013
    361
    63
    I just looked at the datasheet for your DAC's. If I was doing this, I would write my data to both DAC input registers, then use the timer to cause LDAC to go low, thus loading the data from the registers to the DACs.
    I would want to avoid potential delays in the SPI communications, but I'd want the DACs to be loaded on a fixed timing schedule. From your description, it sounds like you may be overrunning the timer (not responding to every timeout), or maybe some other process is using the same timer.
    Hope that helps.
     
Loading...