I don't know if that is right what I have written for setup following the datasheets AD9833
I would like setup the control register as follows:
B28 = 0
HLB = 1
FSELECT = 1
RESET = 0
OPBITEN = 0
MODE = 0
This is the 16 bit word:
0 0 0 1 1 X 0 0 X X 0 0 0 X 0 0 0
Code: Select all
#define FREQ0 0x4000 // Address Freq0 = 0100 0000 0000 0000
// AD9833 Control Register bits
#define B28 (1 << 13) // bit 13 B28
#define HLB (1 << 12) // bit 12 HLB
#define FSELECT (1 << 11) // bit 11 FSELECT
#define RESET (1 << 8) // bit 8 RESET
#define OPBITEN (1 << 5) // bit 5 OPBITEN
#define MODE (1)
#define SINE 1
I try this:
SPI_Write(FREQ0 & B28 | HLB | FSELECT & RESET & OPBITEN & MODE);
Is that corrected if I the same results as this:
0 0 0 1 1 X 0 0 X X 0 0 0 X 0 0 0
I have learn that & = stands for reset an bit and | set an bit