I am coding an Android aplication. I have a SL13A Temperature Data Logger and I am trying to read temperature from the logger, but I don't really know how.
Here is the datasheet: http://www.mouser.com/ds/2/588/AMS_SL13A_Datasheet_EN_v4-371531.pdf
I am using the Get Temperature Command (command code 0xAD).
My code is like that:
NfcV nfcvTag = NfcV.get(tag);
try {
nfcvTag.connect();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "Could not open connection!", Toast.LENGTH_SHORT).show();
return;
}
try {
byte[] comReadTemp = new byte[]{
(byte) 0x00, // Flags
(byte) 0xAD, // Command: Get Temperature
(byte) 0xE0,(byte) 0x36,(byte) 0x04,(byte) 0xCA,(byte) 0x01,(byte) 0x3E,(byte) 0x12,(byte) 0x01, // UID - is this OK?
};
byte[] userdata = nfcvTag.transceive(comReadTemp);
tvText.setText("DATA: " + userdata.length);
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "An error occurred while reading!", Toast.LENGTH_SHORT).show();
return;
}
I am not sure what flags to set and if I put UID parameter in the command correctly.
And also my question is, how do I get temperature bits from command reply? In datasheet it is shown that first 8 bits of command reply are flags, next 16 bits are temperature, and last 16 bits are CRC. But it seems that I only get 3 bytes in reply (userdata.length
equals 3).
Any help would be appreciated.