Go Down

Topic: howto 16bit readout from device (Read 418 times) previous topic - next topic

Tyger

So creating a new topic because it turned out to be 16bit device.
http://ww1.microchip.com/downloads/en/devicedoc/70590c.pdf

I have no idea on how to read this out true SPI, little help?

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Tyger

I dont know how to do this, 2X 8bit transfers to get the full 16

Tyger

So i came up with this, but im not getting any output.

Code: [Select]
#include<SPI.h>

const int CS= 10;


const int command=0x0000; //STSREG

void setup ()

{

Serial.begin(9600);

SPI.begin();

pinMode(CS,OUTPUT);


SPI.setDataMode(SPI_MODE0); //datasheet

SPI.setBitOrder(MSBFIRST);

digitalWrite(CS,HIGH);

// Slow down the master a bit if needed, max 20mhz (datasheet)
//SPI.setClockDivider(SPI_CLOCK_DIV8);

}

void loop() // repeated pattern

{

digitalWrite(CS,LOW);

byte msb = SPI.transfer(highByte(command));

byte lsb = SPI.transfer(lowByte(command));


Serial.println(msb);
Serial.println(lsb);

digitalWrite(CS,HIGH);

delay(5000);

}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy