Questions tagged [byte-order]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
2 answers
1k 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 bits ...
hazymat's user avatar
  • 121
1 vote
1 answer
674 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 ...
user avatar
3 votes
2 answers
20k 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 ...
Augusto's user avatar
  • 131
1 vote
4 answers
7k 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]);...
AlfroJang80's user avatar
0 votes
3 answers
295 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 ...
qqq1ppp's user avatar
0 votes
3 answers
650 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 ...
neurino's user avatar
  • 101
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 = ...
floppy380's user avatar
  • 245
0 votes
4 answers
23k 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]; *(...
blarg's user avatar
  • 167
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 (...
rozling's user avatar
  • 13
1 vote
1 answer
7k 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] = (...
fuenfundachtzig's user avatar