Hi guys,
I have what I think must be a pretty basic question for a veteran programmer.
I have a really basic function that fills a 256bytes buffer with simple data:
void init_buffer()
{
for (int x=0;x<256;x++)
{
buff[x] = x;
}
}
Then, for debugging purposes, I have a small bit of code that reads the buffer and print it to the serial console in rows of 32 HEX values:
Serial.println("Buffer BEGIN:");
int cnt = 1;
int i;
for(i=0;i<256;i++) {
if (cnt == 32)
{
Serial.println("\n");
cnt = 1;
}
Serial.print(buff[i], HEX);
Serial.print(" ");
cnt++;
}
Serial.println("\nBuffer END\n");
It works, BUT... starting with the 128th value 0x80, it pads the value with Fs on the left:
7C 7D 7E 7F FFFFFF80 FFFFFF81 ...
I'm pretty sure there is a very logical, simple and obvious reason for this, but unfortunately, I don't have a clue about it...
Could anyone shed some lights on this please?