MCP4822 (DAC) not working with Timer of dsPIC33F

Thread Starter

Harnee15

Joined Sep 14, 2015
24
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!!
 

Picbuster

Joined Dec 2, 2013
1,047
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.
 

sailorjoe

Joined Jun 4, 2013
364
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.
 
Top