Getting error in software

Thread Starter

mystery67

Joined Nov 14, 2017
3
C:
void fnCalc_Disp_pH (int itempe)
{ float fpHread=0;
int k;
// Now Calc ph !
fnADCInit(5,'h');

for(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;

}
ERRORS ARE AS:

0 1 mikroCPIC1618.exe -MSF -DBG -pP16F877A -DL -O11111114 -fo20 -N"G:\ph_meter\main.mcppi" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for PIC\Defs\" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for PIC\Uses\P16\" -SP"G:\ph_meter\" -SP"D:\ph_meter\" "main.c" "__Lib_Math.mcl" "__Lib_MathDouble.mcl" "__Lib_System.mcl" "__Lib_Delays.mcl" "__Lib_CType.mcl" "__Lib_CString.mcl" "__Lib_CStdlib.mcl" "__Lib_CMath.mcl" "__Lib_MemManager.mcl" "__Lib_Conversions.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Keypad4x4.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_A_C.mcl" "__Lib_EEPROM.mcl" "__Lib_FLASH_RW.mcl" "__Lib_I2C_c34.mcl" "__Lib_PWM_c21.mcl" "__Lib_SPI_c345.mcl" "__Lib_UART_c67.mcl" "__Lib_PortExpander.mcl" "__Lib_CANSPI.mcl" "__Lib_CF.mcl" "__Lib_GlcdFonts.mcl" "__Lib_Glcd.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" "__Lib_RS485.mcl" "__Lib_S1D13700.mcl" "__Lib_T6963C.mcl" "__Lib_SPIGlcd.mcl" "__Lib_SPILcd.mcl" "__Lib_SPILcd8.mcl" "__Lib_SPIT6963C.mcl" "__Lib_EthEnc28j60.mcl" "__Lib_EthEnc24j600.mcl" "__Lib_TouchPanel.mcl"
0 1501 Specified search path does not exist: 'D:\ph_meter'
0 1139 Available RAM: 352 [bytes], Available ROM: 8192 [bytes]
0 122 Compilation Started stdlib.h
256 315 Invalid expression main.c
253 402 ; expected, but 'float' found main.c
256 424 '}' expected ';' found main.c
262 371 Specifier needed main.c
262 396 Invalid declarator expected'(' or identifier main.c
262 371 Specifier needed main.c
262 300 Syntax Error: ')' expected, but '>' found main.c
262 300 Syntax Error: ')' expected, but '-' found main.c
263 300 Syntax Error: ')' expected, but ';' found main.c
271 393 'fnDispNum ' Identifier redefined main.c
273 402 ; expected, but '=' found main.c
273 393 'gcSSEGdispHexCode' Identifier redefined main.c
273 312 Internal error '' main.c
0 102 Finished (with errors): 15 Nov 2017, 23:00:22 main.mcppi

I am new to allaboutcircuits.Kindly guide me what the things i need to change in this function. I am using mikroc pro for pic and pic16f877a as my controller. I need help urgently.
 
Last edited by a moderator:

JohnInTX

Joined Jun 26, 2012
4,787
Welcome to AAC!
Sorry but it isn't possible to debug the code because you did not post it all. I can offer a few general observations:
Errors like
0 1501 Specified search path does not exist: 'D:\ph_meter' mean that the compiler can't find all the files it needs. This can be a typo in the filename or a result of moving the MikroC project file to another computer. I like to create a new project on the computer to be used.
Note that in C, the first few errors can cause many of the others. Fix the first few and recompile.

Errors like:
256 315 Invalid expression main.c
253 402 ; expected, but 'float' found main.c
256 424 '}' expected ';' found main.c

are usually a result of typographic errors but can also be due to mixing data types etc. Start at the top of the list and work down. Read the descriptions of the errors and compare to the code. The middle line above says that the compiler expected a ';' but found something else - inspect the code and fix up the syntax.

The other errors like
271 393 'fnDispNum ' Identifier redefined main.c
look like fnDispNum is used in more than one place or there is a syntax error. Search on 'fnDispNum' to find all the places it occurs. There should be ONE function with that name only.

Fix the syntax errors first.

Good luck!
 

MrSoftware

Joined Oct 29, 2013
2,200
Start here:

256 315 Invalid expression main.c
253 402 ; expected, but 'float' found main.c

Look at line 315 in main.c, the compiler doesn't understand something on that line. Don't worry about any errors after that until you correct the problem on line 315. Only some of your code is posted so I have no idea what's on your line 315.
 
Top