
AD6654
Rev. 0 | Page 68 of 88
LSBFIRST Mode Using Single Byte Block Transfers
SerialWrite(0x98); //CRCF Start Address
SerialWrite(0x01);
SerialWrite(0x00);
SerialWrite(0x99); //CRCF Final Address
SerialWrite(0x01);
SerialWrite(N-1);
//N is the number of coefficients
for (i=0 ; i < N; i++) {
// writing registers
SerialWrite(0x9C);
//LSB written first
SerialWrite(0x01);
//data bits[7:0]
SerialWrite(coeff[i] & 0xFF);
SerialWrite(0x9D);
SerialWrite(0x01);
//data bits[15:8]
SerialWrite(coeff[i] >> 8 & 0xFF);
SerialWrite(0x9E);
//MSB written last
SerialWrite(0x01);
//data bits[23:16]
SerialWrite(coeff[i] >> 16 & 0xFF);
}
SerialWrite(0x98); //CRCF Start Address
SerialWrite(0x01);
SerialWrite(0x00);
SerialWrite(0x99); //CRCF Final Address
SerialWrite(0x01);
SerialWrite(N-1);
//N is the number of coefficients
for (i=0 ; i < N; i++) {
//reading registers
SerialWrite(0x9C);
//LSB readback first
SerialWrite(0x81);
//data bits[7:0]
Coeff[i] = SerialRead();
SerialWrite(0x9D);
SerialWrite(0x81);
//data bits[15:8]
Coeff[i] |= SerialRead() << 8;
SerialWrite(0x9E);
//MSB readback last
SerialWrite(0x81);
//data bits[23:16]
Coeff[i] |= SerialRead() << 16;
}
MSBFIRST Mode Using Multi Byte Block Transfers
SerialWrite(0x99); //CRCF Final Address
SerialWrite(0x02);
SerialWrite(N-1);
//N is the number of coefficients
SerialWrite(0x00);
for (i=0 ; i < N; i++) {
//writing registers
SerialWrite(0x9E);
SerialWrite(0x03);
//data bits[23:16]
SerialWrite(coeff[i] >> 16 & 0xFF);
//data bits[15:8]
SerialWrite(coeff[i] >> 8 & 0xFF);
//data bits[7:0]
SerialWrite(coeff[i] & 0xFF);
}
SerialWrite(0x99); //CRCF Final Address
SerialWrite(0x02);
SerialWrite(N-1);
//N is the number of coefficients
SerialWrite(0x00);
for (i=0 ; i < N; i++) {
//reading registers
SerialWrite(0x9E);
SerialWrite(0x83);
//data bits[23:16]
Coeff[i] = SerialRead() << 16;
//data bits[15:8]
Coeff[i] |= SerialRead() << 8;
//data bits[7:0]
Coeff[i] |= SerialRead();
}
LSBFIRST Mode Using Multi Byte Block Transfers
SerialWrite(0x98); //CRCF Start Address
SerialWrite(0x02);
SerialWrite(0x00);
SerialWrite(N-1);
//N is the number of coefficients
for (i=0 ; i < N; i++) {
//writing registers
SerialWrite(0x9C);
SerialWrite(0x03);
//data bits[7:0]
SerialWrite(coeff[i] & 0xFF);
//data bits[15:8]
SerialWrite(coeff[i] >> 8 & 0xFF);
//data bits[23:16]
SerialWrite(coeff[i] >> 16 & 0xFF);
}
SerialWrite(0x98); //CRCF Start Address
SerialWrite(0x02);
SerialWrite(0x00);
SerialWrite(N-1);
//N is the number of coefficients
for (i=0 ; i < N; i++) {
//reading registers
SerialWrite(0x9C);
SerialWrite(0x83);
//data bits[7:0]
Coeff[i] = SerialRead();
//data bits[15:8]
Coeff[i] |= SerialRead() << 8;
//data bits[23:16]
Coeff[i] |= SerialRead() << 16;
}