Getting error in this function

Why am i getting so many errors ?

  • mail with complete details

    Votes: 0 0.0%
  • anything needed today complete details to resolve this

    Votes: 0 0.0%

  • Total voters
    0
Status
Not open for further replies.

Thread Starter

mystery67

Joined Nov 14, 2017
3
void fnCalc_Disp_pH (int itempe)
{
// Now Calc ph !
fnADCInit(5,'h');

float fpHread=0;

for(char k=0;k<8;k++)
{
fpHread=fpHread+fnADCConv1024Avg();

// before going any further,check if the mode flag was raised
// if yes,then just return to the calling function
if(cModeFlag==1)
{
cModeFlag=0; // reset flag for future use
return;
}

}

// Average of the 8 averages
fpHread=((int)fpHread>>3);

// Now that we have the average of thousands of readings
// Lets interpret it !
// convert to mV
fpHread =((((fpHread/1023)*(5000)))/5);
// Calc actual mV (since sensor's ground is raised by 0.5V)
fpHread=fpHread-500;
//******************************************************************
// COMPENSATE FOR 0mV OFFSET
//******************************************************************


//******************************************************************
// THE BELOW CODE COMMENTED OUT AS IT COMPENSATES BY AFTER
// CONSIDERING THE OFFSET POLARITY
// IN THE LATEST READINGS,I'VE FOUND OUT THAT THE OFFSET REAMINS MORE OR LESS
// THE SAME FOR -VE OR +VE READINGS. MORE IMPORTANTLY,THE Pt100 INJECTS A STEADY OFSET OF ABOUT 28mV
// AND THAT HAS TO BE COMPENSATED FOR EVERY WHERE
// SO JUST SUBTRACT THE 0mV OFFSET FROM ALL READINGS !!!
/* Generally,the 0mV offset is +ve and is not reflected in basic sol.
But , hypothetically,there could be a scenario where this was -ve
So we check the offset first. If it's positive,then we applyy it
only to +ve mV values (acids)
Else we apply it ONLY to -ve mV (basic sol)

if( gf7pHOffset > 0 )
{
if(fpHread > 0)
{
fpHread=fpHread - gf7pHOffset ;
}
}
else if( gf7pHOffset < 0 )
{
if(fpHread < 0)
{
fpHread=fpHread - gf7pHOffset ;
}
}
*/



fpHread=fpHread - gf7pHOffset ;


//******************************************************************
// COMPENSATE FOR 4 pH OFFSET WHICH IS ACTUALLY THE TEMP OFFSET
// This,again,has to be done for all values !!!
//******************************************************************

fpHread=fpHread + (fpHread*gfOffsetPermV) ;


// Smoothen out the jitter
// If new reading is less than old one,then display the old one itself
// but also store the new reading
if (fpHread < gfpHOldVal)
{
float fTempVar=fpHread; // temp. store new reading
fpHread=gfpHOldVal; // New reading is less. So replace it with old reading
gfpHOldVal = fTempVar; // Insert new reading as the next "old reading"
}
else
{ gfpHOldVal=fpHread ; }


//******************************************************************
// Temperature compensation
//******************************************************************
fnSetpHSlope(itempe);


// CODE FOR "BANDING"
// "band" for 7 pH
if((fpHread > (-6))&&(fpHread < (6)))
{ fpHread = 0 ; }

// "band" for 4 pH
float f4Band = (3*pHSlope);
if( (fpHread >(f4Band-6)) && (fpHread<(f4Band+6)) )
{ fpHread = f4Band ; }

// "band" for 9.18 pH
float f9Band = -(2.18*pHSlope);
if( (fpHread >(f9Band-6)) && (fpHread<(f9Band+6)) )
{ fpHread = f9Band ; }



// display in .01 * pH
fpHread =((7-(fpHread/pHSlope))*100);

// Display pH
fnDispNum(fpHread);
// Add the decimal point
gcSSEGdispHexCode[2]=(gcSSEGdispHexCode[2])&(0B11111011);

// Disable the highest 7seg if ph<10
if ( fpHread < (1000) )
gcSSEGdispHexCode[3]=0xff;

}

I am using mikroc pro for pic as a compiler. can anyone help me in resolving this ?
 
Status
Not open for further replies.
Top