Go Down

Topic: Master and Slave question. Arduino connected with DDC101 an IC (Read 920 times) previous topic - next topic

ref110

Hi,

first of all, I have to say, that my English is not the best, so I´m sorry if there are mistakes in the following text.

I want to connect the DDC101 to the Arduino. This is a IC which is connected to a phododiode.

Here you can see the datasheet.
http://focus.ti.com/lit/ds/symlink/ddc101.pdf

It needs a frequency of 2MHz, which I create with the following code:


const int freqOutputPin = 11;   


const int prescale  = 1;
const int ocr2aval  = 3;



const float period    = 2.0 * prescale * (ocr2aval+1) / (F_CPU/1.0e6);


const float freq      = 1.0e6 / period;

void setup()
{
    pinMode(freqOutputPin, OUTPUT);
    Serial.begin(9600);

   
   
    TCCR2A = ((1 << WGM21) | (1 << COM2A0));

   
    TCCR2B = (1 << CS20);

   
    TIMSK2 = 0;
   
    OCR2A = ocr2aval;

    Serial.print("Period    = ");
    Serial.print(period);
    Serial.println(" microseconds");
    Serial.print("Frequency = ");
    Serial.print(freq);
    Serial.println(" Hz");
}


void loop()
{
   
}


Now there is an problem. How you can see in the Attach the Arduino has to send a 12bit binary word to the DDC. With each pulse it has to send
one bit.

Because the Arduino is with normal commands is to slow, I want to use the Master and Slave methode.

Here is an example from the Arduino page:
http://www.arduino.cc/en/Tutorial/SPIEEPROM

But I do not really understand it. How can I send my 12bit word to the DDC with this?

Another question is, can I use this, because my outputpin is pin11 for the frequency. And for master and slave I need also pin11. Can you solve
my problem?

The most important problem is, how I can send the 12 bit word, because I have never worked before with this SPI Device.


Thanks for your help

Markus




Go Up