Hey people ,
I'm try load the registers of AD9910 with a Mbed but isn't work. Now i'm try with Arduino uno, anyone knows a code for a load control AD9910 !?
Thanks a lot
Hetan
Hey people ,
I'm try load the registers of AD9910 with a Mbed but isn't work. Now i'm try with Arduino uno, anyone knows a code for a load control AD9910 !?
Thanks a lot
Hetan
The AD9910 seems to have an I2C interface by default, usable with the Wire library.
The AD9910 Have SPI , but i dont known how programing !
You can use the SPI library. You transfer a command byte, then read or write the required number of bytes for that command.
How can i send a 32 bits word through SPI ?
Do 4 transfers:
digitalWrite (ssPin, LOW);
SPI.transfer (byte0);
SPI.transfer (byte1);
SPI.transfer (byte2);
SPI.transfer (byte3);
digitalWrite (ssPin, HIGH);
or
digitalWrite (ssPin, LOW);
SPI.transfer (dataArray[0]);
SPI.transfer (dataArray[1]);
SPI.transfer (dataArray[2]);
SPI.transfer (dataArray[3]);
digitalWrite (ssPin, HIGH);
or use other methods to break up an unsigned or signed long,
or ...
But 4 transfers no matter what.
Hetan97:
The AD9910 Have SPI , but i dont known how programing !
#define SPI_MOSI_PIN MOSI
#define SPI_MISO_PIN MISO
#define SPI_SCK_PIN SCK
#define DDS_CS SS
#define MASTER_RESET 11
#define IO_RESET 6
#define IO_UPDATE 4
SPISettings spiSettings;
#define CFR1 0x00
#define CFR2 0x01
#define CFR3 0x02
static void digitalWriteDirect(int pin, boolean val)
{
digitalWrite(pin, val);
}
static inline int digitalReadDirect(int pin)
{
return digitalRead(pin);
}
void update()
{
digitalWriteDirect(IO_UPDATE, LOW);
//Special update used to maximize speed of update
digitalWriteDirect(IO_UPDATE, HIGH);
// if (!fastUpdate)
{
delayMicroseconds(1);
}
digitalWriteDirect(IO_UPDATE, LOW);
}
void set4Wire()
{
//CFR1 values needed for 4 wire mode
byte set4Wire[4] = {0x00, 0x00, 0x00, 0x02};
resetSPI(); //Reset physical communications (precautionary)
writeReg(CFR1, set4Wire, sizeof(set4Wire)); //Write values to buffer
update(); //Update buffer values into register
}
void sendWriteAddr(int addr)
{
SPI.beginTransaction(spiSettings);
digitalWrite(DDS_CS, LOW);
SPI.transfer(addr);
}
void sendReadAddr(int addr)
{
SPI.beginTransaction(spiSettings);
digitalWrite(DDS_CS, LOW);
SPI.transfer(0x80 | addr);
}
void writeBytes(byte addr, byte *data, byte length, byte start)
{
int tmp = 3;
sendWriteAddr(addr);
if (length <= 4)
tmp = len;
for (byte i = start; i < tmp-1; i++)
{
SPI.transfer(data*);*