Hey guys, im a bit stuck atm in trying to convert my ADC data to hex values so that it can show up on terminal (ive already made a code for terminal).
I've found this code and added it to my code but I don't really understand how the code works or how it converts. If someone could somehow explain it to me or if there's a simpler way of doing it, that would great!
Thanks
[send_usart is me sending it to terminal. ]
I've found this code and added it to my code but I don't really understand how the code works or how it converts. If someone could somehow explain it to me or if there's a simpler way of doing it, that would great!
Thanks
[send_usart is me sending it to terminal. ]
Code:
void ADC_Hex_USART (float readadc)
{
unsigned char Index_Counter =0; // not sure what this does
char Hex_decimal[16];
float Voltage_Value = readadc;
printf(Hex_decimal, "Volts = %.3f", Voltage_Value);
while(Hex_decimal[Index_Counter] != '\0') //not sure what !='\0' does as well.
{
send_usart(Hex_decimal[Index_Counter]);
Index_Counter++;
}