MC56F8013 - spi communication to dac

cancel
Showing results for 
Search instead for 
Did you mean: 

MC56F8013 - spi communication to dac

Jump to solution
1,942 Views
Egal
Contributor I

I am a newbie when it comes to programming microcontrollers and I have a question on connecting the 56F8013 to a dac (digital analog converter) using the spi interface.

I want to connect the dsp to a "DAC121S101" 12-bit dac. The pin-connection is correct, I think:

DSP DAC
MOSI -> Din
SCLK -> SCLK
GPIOB4 -> SYNC (like SS)

The input shift register of the dac has sixteen bits. The first two bits are "don`t cares" and the following two bits determine the mode of operation.
The contents of the serial input register are transferred to the dac register on the sixteenth falling edge of SCLK.

It is a 12-bit dac with a 16-bit shift register. I am using CodeWarrior with Processor Expert to configure the dsp.
How do I have to configure it when I only have 12-bits but need to send 16 falling edges. I am confused.

Thanks.

Labels (1)
Tags (2)
0 Kudos
1 Solution
276 Views
rocco
Senior Contributor II
Hi, Egal:

Talking to that DAC is pretty straight forward. You have it hooked up correctly. To load it, do the following:

1) Set SYNC (GPIOB4) low.
2) Write the high four bits of the twelve bit DAC value to the SPI (the four bits should be in the low nibble, and the high nibble should be zero for normal mode).
3) Write the low eight bits of the twelve bit DAC value to the SPI.
4) Wait for both bytes to finish transferring.
5) Set SYNC (GPIOB4) high.

Hope that helps.

View solution in original post

0 Kudos
1 Reply
277 Views
rocco
Senior Contributor II
Hi, Egal:

Talking to that DAC is pretty straight forward. You have it hooked up correctly. To load it, do the following:

1) Set SYNC (GPIOB4) low.
2) Write the high four bits of the twelve bit DAC value to the SPI (the four bits should be in the low nibble, and the high nibble should be zero for normal mode).
3) Write the low eight bits of the twelve bit DAC value to the SPI.
4) Wait for both bytes to finish transferring.
5) Set SYNC (GPIOB4) high.

Hope that helps.

View solution in original post

0 Kudos