View previous topic :: View next topic |
Author |
Message |
rcooke
Joined: 23 Feb 2011 Posts: 21 Location: Oceanside, CA USA
|
AD8402 digital pot - sending 10bits via SPI? |
Posted: Sun Apr 10, 2011 1:31 pm |
|
|
Hi Folks,
In my application I am forced to use the HW SPI due to conditions out of my control. I need to write 10 bits to the chip 2 bits of address and 8 bits of data. I can't use the CCS supplied 8400.c library because that uses a software SPI.
Looking at the 8402 datasheet is seems like I can send it 16 bits with the MSB 6 bits set to zero. It seems like the chip will load the register when the /CS line goes high so only the last 10 bits are actually loaded. Does this make sense?
Thanks,
Richard |
|
![](templates/subSilver/images/spacer.gif) |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
|
Posted: Sun Apr 10, 2011 1:41 pm |
|
|
That's pretty bizarre...
I would just write a software routine to handle it since doing a double write (16bits) doesn't seem to be an option.
How bizarre.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
![](templates/subSilver/images/spacer.gif) |
rcooke
Joined: 23 Feb 2011 Posts: 21 Location: Oceanside, CA USA
|
|
Posted: Sun Apr 10, 2011 1:46 pm |
|
|
I don't understand why you say it is bizarre. The hardware team designed the circuit in such a way that I am forced to use the hardware SPI function on the chip (18F24K22). We have other devices that I have to communicate with via the SPI bus.
Richard |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
rcooke
Joined: 23 Feb 2011 Posts: 21 Location: Oceanside, CA USA
|
|
Posted: Sun Apr 10, 2011 2:05 pm |
|
|
PCM,
Thanks for the heads-up. I searched the forum but didn't do a very good job. I just wanted a second opinion and you pointed me to one. That's the beauty of this forum.
Richard |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Apr 11, 2011 3:19 am |
|
|
There's a simple guideline. A device declared SPI compatible will always be able to communicate in multiplies of 8 bits. As many simple SPI devices, the AD8402 doesn't care how many bits have been shifted in front of the last 10 bits before the /CS rising edge. |
|
![](templates/subSilver/images/spacer.gif) |
|