Hi guys
i want to send 10 bits of data to DAC through SPI protocol. how can i do that?
i have tried
SPI.transfer(highByte(DATA))
SPI.transfer(lowByte(DATA))
this does not seems to work.
kindly help me out
Thanks in advance
Hi guys
i want to send 10 bits of data to DAC through SPI protocol. how can i do that?
i have tried
SPI.transfer(highByte(DATA))
SPI.transfer(lowByte(DATA))
this does not seems to work.
kindly help me out
Thanks in advance
What DAC?
thank you for your fast reply
the dac is DAC101S101.
please help me out i am stuck in my project here.
See section 8.5 of the datasheet - you send two bytes, but you don't pack them like that - it's 2 dont-care bits, 2 setting the mode, 10 data bits, then the two more don't care bits
So...
byte mode = //put the mode number here.
byte firstbyte=(mode << 4)|(DATA>>6)
byte secondbyte=DATA<<2
and then send the two bytes.
Thank you SO much for help.
can you please verify is this right if yes than its not working.if not can you please
modify the code i want the mode to be 1 or 0 or 2 or 3.
i have tried mode=0b00000000 as well.
int DATA=0b1111111111;
byte mode = 1; //put the mode number here.
byte firstbyte=(mode << 4)|(DATA>>6);
byte secondbyte=DATA<<2 ;
SPI.transfer16(firstbyte);
SPI.transfer16(secondbyte);