# Receiving more than one byte as response from SPI

**URL:** <https://forum.arduino.cc/t/receiving-more-than-one-byte-as-response-from-spi/184891>\
**Category:** Due\
**Created:** [September 23, 2013, 10:13pm UTC](https://forum.arduino.cc/t/receiving-more-than-one-byte-as-response-from-spi/184891 "2013-09-23T22:13:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [September 23, 2013, 11:01pm UTC](https://forum.arduino.cc/t/receiving-more-than-one-byte-as-response-from-spi/184891/4 "2013-09-23T23:01:18Z")

</div>

Hi,

send your 8 bit command

```arduino
Spi.transfer(CS_pin, command, SPI_CONTINUE);

```

and then for every byte (n) you want to read an other

```arduino
byte_1 = SPI.transfer(CS_pin, 0x00, SPI_CONTINUE);
byte_2 = SPI.transfer(CS_pin, 0x00, SPI_CONTINUE);
...
byte_n = SPI.transfer(CS_pin, 0x00);

```

not tested, but with SPI diagram on page 17, it should work 🙂  
[http://datasheets.maximintegrated.com/en/ds/MAX11040K-MAX11060.pdf](http://datasheets.maximintegrated.com/en/ds/MAX11040K-MAX11060.pdf)

if you want to write more than one byte it works the same

I use it this way for 8/16/32 bit read & writes to AD5666 / MCP4261 and it works fine ( ~~if only one CS is used in the sketch~~ ).  
[edit]Multiple usage of the predefined CS work now!  
see [[solved] due extended SPI problem - Arduino Due - Arduino Forum](http://forum.arduino.cc/index.php?topic=189682.0)

background:  
with SPI\_Continue the CS\_pin keeps low  
and every other transfer 8 bits of MISO are clocked in  
so for your SPI slave it looks like one big command comming in  
the last SPI.transfer without SPI\_CONTINUE let the CS\_pin go to high again.

---

_[View the full topic](https://forum.arduino.cc/t/receiving-more-than-one-byte-as-response-from-spi/184891)._
