regarding spi interface

Thread Starter

divyarna

Joined Apr 18, 2012
2
Hi i am doing an 8051 based microcontroller project where in i am trying to interface the 8 bit microcontroller with an 16 bit sensor. I am not sure if these two devices can be interfaced, please help. The spi register in the microcontroller is 8 bit and that in the sensor is 16 bit.
 

Papabravo

Joined Feb 24, 2006
21,225
You have asked a question without providing any useful information. How's about a link to the sensor datasheet. SPI is inherently an 8-bit protocol as originally defined by Motorola (now ON-Semiconductor and Freescale). For a 16-bit device it is likely to require multiple 8-bit SPI bus transactions to accomodate a 16-bit device.
 

Papabravo

Joined Feb 24, 2006
21,225
OK got it. What will happen is that you break the 16-bit transaction into two 8-bit transactions. what the sensor sees is Chip-Select followed by 8 clocks with arbitrary, null-data going out and the most significant 8-bits from the sensor coming in. Then there will be a short idle period DURING WHICH THE CHIP SELECT MUST REMAIN LOW, followed by another 8-bits of arbitrary null-data going out and the least significant 8-bit bits coming back in. then you take the chip select high and all is well.
 

MrChips

Joined Oct 2, 2009
30,809
The bit size of a processor has nothing to do with its capabilities.
Calculators use 4-bit processors.
You can interface an 8-bit processor to a 16-bit processor with no problem.

There are 10 types of people in the world. Those who understand binary and those who don't.
 
Last edited:
Top