Just to note: the format string for this bad value is missing the "#" because it's part of the previous number block. I tried adding it in too, but that didn't effect the value at all. The value prints out all 0's, but you can see from both the convert ADC value and the Filtertempsingle value that the result should not be 0 for bit 0 to 15.
This is the UART output:
Gasvalue = 0x011a 0000 = 2139062143.390621430 (this is NOT correct)
ADC = 5.514245960 (this is correct)
Filtertempsingle = 18502740.000000000 (this is 0x011a5454 = 5.514245960 volts, which is correct; 0x011a0000 is wrong)
Code: Select all
long Getgaslong1;
int myIntegervalue;
myIntegervalue = 0xffff & Getgaslong1; // MIKROE Team: This variable doesn't work. Please see output file.
sprintf(Txt,"Gasvalue = %#.4x %.4x = %12.9f\r\n", (Getgaslong1>>16), myIntegervalue, Getgaslong1); // See below for alternate
UART1_Write_Text(Txt);
sprintf(Txt,"ADC = %12.9f\r\n", (ADC_RESOLUTION * Getgaslong1)); // ADC_RESOLUTION is 298.023223876953125e-9
UART1_Write_Text(Txt);
also tried this, but didn't help:
sprintf(Txt,"Gasvalue = %#.4x %.4x = %12.9f\r\n", (Getgaslong1>>16), (0xffff & Getgaslong1), Getgaslong1); // See above for primary
Thank you, Richard V