|
|
@ -18,22 +18,11 @@ char nibble_to_hex(uint8_t i) //Conversion to hex format
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t jun_nibble(uint8_t i) //Extracting the junior Nibble
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return i & 0x0f;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t sen_nibble(uint8_t i) //Extracting the senior Nibble
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (i & 0xf0) >> 4;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void print_in_hex(uint8_t byte)
|
|
|
|
void print_in_hex(uint8_t byte)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//uint8_t upper_nibble = sen_nibble(byte);
|
|
|
|
cout << nibble_to_hex(byte >> 4)
|
|
|
|
//uint8_t lower_nibble = jun_nibble(byte);
|
|
|
|
<< nibble_to_hex(byte & 0xf)
|
|
|
|
//cout << nibble_to_hex(upper_nibble) << nibble_to_hex(lower_nibble) << endl;
|
|
|
|
<< endl;
|
|
|
|
cout << nibble_to_hex(sen_nibble(byte)) << nibble_to_hex(jun_nibble(byte)) << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
@ -58,11 +47,9 @@ int main()
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t byte = 0xce;
|
|
|
|
uint8_t byte = 0xce;
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "Jun: " << jun_nibble(byte) << endl;
|
|
|
|
|
|
|
|
//cout << "Sen: " << sen_nibble(byte) << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print_in_hex(byte);
|
|
|
|
print_in_hex(byte);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cout << "Press any key for exit... ";
|
|
|
|
cout << "Press any key for exit... ";
|
|
|
|
cin.get();
|
|
|
|
cin.get();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|