Questions tagged [uint8t]

uint8_t (C language - Type). uint8_t stores an 8-bit unsigned number, from 0 to 255. It is equal to unsigned char.

272 questions
-1
votes
1 answer

array of uint8_t and append data

hi to all i have this problem i have a array of uint8_t uint8_t command_Text[256] i read some data from adc, i use snprintf for convert the data float in uint8_t ` float aux; uint8_t value[4]; aux=(float)(HAL_ADC_GetValue(&hadc)) …
Ant
  • 281
  • 1
  • 4
  • 19
-1
votes
3 answers

String assignment to uint8_t in c

I am trying to assign string to uint8_t buffer in IAR, but I get a warning message. rx_buffer.rx_struct.RESP.RESPOND is struct field of uint8_t type. My code is: strncpy(rx_buffer.rx_struct.RESP.RESPOND, (uint8_t *)'NS,', 3); And the associated…
-1
votes
2 answers

How to copy uint8* to vector correctly

I am trying to make a vector of Uint8 from Uint8*, but for reason some of the values are not same. Here is my code. std::vector wav_vector = {}; Uint8* wav_buffer_; for (unsigned int i = 0; i < wav_length_; i++) { …
aak
  • 107
  • 1
  • 4
  • 12
-1
votes
2 answers

convert long int > 255 into a uint8_t array

I'm working with Particle Photon microcontroller and need to send a value >> 255 via TCP. I would need to convert this into an array of uint8_t so that I can use the client.write((int8_t *data), int sizeof(packet)); how can I achieve it?
-1
votes
1 answer

writing float array as reversed bytes each

I am going to create the byte array as desired output using iOS objective-C. The method is converting from static float array to int8_t array bytes array . When it comes to the implementation, I have found that all bytes for each float in the float…
Jeff Bootsholz
  • 2,971
  • 15
  • 70
  • 141
-2
votes
0 answers

Sign conversion error with std::uint32_t and std::uint8_t

I have a piece of code which assigns an 8-bit unsigned int (std::uint8_t) to a 32-bit unsigned int (std::uint32_t): std::uint32_t a{0}; std::uint8_t b{1}; a = b << 16; When I try to compile this with -Werror -Wsign-conversion -fsanitize=undefined,…
jjcasmar
  • 1,387
  • 1
  • 18
  • 30
-2
votes
2 answers

How to convert 32-bit binary value to int8_t array

I'm trying to covert a 32 bit binary value into int8_t array. I'm not sure how to do this, and I'm struggling to find any documentation explaining the process. I was thinking that each 8 bits represents an integer, and then that's the array, but I'm…
-2
votes
3 answers

Why does my data is cut when I have 0x00?

I want to copy an uint8_t array to a uint8_t pointer uint8_t temp_uint8_array[] = {0x15, 0x25, 0x32, 0x00, 0x52, 0xFD}; uint8_t* Buffer = temp_uint8_array; And now : Buffer = {0x15, 0x25, 0x32}; So I understand that my data is cut because of…
Clément
  • 37
  • 5
-2
votes
1 answer

Convert char* data to uint16_t* or uint16_t array in C

My Arduino program receives a char* text message like this: char* messageFromWebSocket = "4692\n4408\n656\n358\n662\n356\n658\n376\n656\n358\n662\n1394\n660\n1392\n636\n378\n632\n382\n638\n1418"; Now the IRremoteESP8266 library I used controls the…
misza
  • 13
  • 3
-2
votes
1 answer

How to convert a uint8_t array to a character array in C?

I have a uint8_t array which I want to be able to convert to a char array. i.e. uint_8 myInput [4] = {0, 233, 3, 1}; Which in bits it corresponds to: 00000000 00000011 11101001 00000001 And I would like to have an array of characters: char myChar…
-2
votes
1 answer

Bitwise operations performed on an 8 bit unsigned int

In the following code, bitwise operations are performed on an 8-bit unsigned integer. uint8_t i = 10; uint8_t j = i>>2; In this example, i is promoted to a signed int and value assigned to 8 bits unsigned int. Is it safe to int converted back to 8…
msc
  • 33,420
  • 29
  • 119
  • 214
-2
votes
1 answer

Map 10Bit buffer to 8Bit

I have a 10 bit SDI stream, when I receive it, it will be stored into uint8_t *buffer and off course when I read it I get completely different value from what expected, except for the first: 10Bit -> 00 0000 0001 | 00 0101 1010 → Hex: A5 10 8 Bit…
mattobob
  • 833
  • 4
  • 15
  • 37
-2
votes
3 answers

Are uint8_t , uint16_t guaranteed to be of the 8 and 16 bits respectively?

I do a simulation and want to keep the memory cost down and hence using uint8_t , uint16_t for the class members. Does cpp guarantee that they will be of 8 and 16 bits ? Is there an difference based on the architecture of the process that I should…
nnrales
  • 1,481
  • 1
  • 17
  • 26
-3
votes
1 answer

Why doesn't uint8_t and int8_t work with file and console streams?

$ file testfile.txt testfile.txt: ASCII text $ cat testfile.txt aaaabbbbccddef #include #include #include #include typedef uint8_t byte; // <-------- interesting typedef std::basic_ifstream
user1358
  • 623
  • 2
  • 8
  • 13
-4
votes
2 answers

Convert double to uint8_t*

I have a function that accepts uint8_t* which is supposed to be a string. I want to send a double to this function. I have tried this code below but it doesn't work. double a = 10.98 uint8_t* p = (uint8_t*) &a; printf("p: %u \n", p);…
xem
  • 125
  • 5
  • 17
1 2 3
18
19