Questions tagged [byte-order]
The byte-order tag has no summary.
10 questions
2
votes
2
answers
2k
views
How to swap byte order?
Background
I'm reading a 24-bit ADC value into a uint32. Using SPI bus, here's the logic:
value = SPI.transfer(0); // read first 8 bits (MSB first)
value <<= 8; // shift ...
1
vote
1
answer
896
views
Sending multi-byte data over I2C between different processors
I have been attempting to read data from an ATTINY84 via an ESP8266. Both are programmed via the Arduino IDE, though as PlatformIO is a proxy for that, I'm not certain what version of the ATTINY core ...
3
votes
2
answers
23k
views
Problems on convert byte[] to String
I'm reading a RFID Card from RC522 and send the data to my computer. My problem is the conversion of byte[] to String or std::string.
#define SIZE_BUFFER 18
#define MAX_SIZE_BLOCK 16
byte ...
1
vote
4
answers
8k
views
Hex/Byte Reversing and Conversion
I'm working on an RFID system using a MFRC522 with this Library : https://github.com/miguelbalboa/rfid
Here's the code I have right now:
int A=(mfrc522.uid.uidByte[0]);
int B=(mfrc522.uid.uidByte[1]);...
0
votes
3
answers
351
views
How to map 6 bytes of raw data to long long type?
I'm trying to solve some problems for a contest, and I have a problem with it. I have to implement a function that has 3 arguments like this:
void foo(unsigned char* A, unsigned char* B, unsigned ...
0
votes
3
answers
758
views
4 consecutive bytes in buffer to unsigned long
I wonder if there's a smarter way to get these 4 consecutive bytes from a buffer, concatenated in a unsigned long.
// the timestamp starts at byte 40 of the received packet and is four bytes,
// or ...
1
vote
3
answers
1k
views
Problem with transmitting 2 byte data in correct way
I'm using Atmel Studio with Atmega328P.
I'm trying to send the decimal number 876 continuously from the micro-controller. This was just to learn.
To send 876 I need two bytes which is:
0x036C = ...
0
votes
4
answers
24k
views
How to cast float into four bytes?
I'm trying to save GPS coordinates to an EEPROM.
In this example I feed it the latitude of 56060066 as the argument float x
void writeFloat(unsigned int addr, float x)
{
byte seriesOfBytes[3];
*(...
1
vote
1
answer
2k
views
Using union to return a range of bits from a data frame: wrong approach?
I'm working on an adaptation of Jason Leyrer's Guitar Hero Library for Arduino. My version is for a DJ Hero controller, and I've also borrowed some code from this Arduino forum thread: topic=120527 (...
1
vote
1
answer
8k
views
Big endian or little endian?
I need to pass a 16-bit long address (for an external EEPROM) to a function (twi_writeTo) in a buffer.
I am currently doing this
byte buffer[2];
buffer[0] = (byte)(eeaddress >> 8);
buffer[1] = (...