bigdogguru
Administrator
- Joined
- Mar 12, 2010
- Messages
- 9,821
- Helped
- 2,350
- Reputation
- 4,694
- Reaction score
- 2,272
- Trophy points
- 1,413
- Location
- Southwest, USA
- Activity points
- 62,395
In post #14 he wrote
Alex
What compiler are you using Sahu?
You're on the right track but I still see several syntax errors. After you tell the compiler, I can clean it up the syntax.
BigDog
error: 102****342****There is not enough ROM space****__Lib_MathDouble.c
error: 27****392****Address must be greater than 0 main****MyProject.c
error: 27****392****Address must be greater than 0 main****MyProject.c
error: 27****392****Address must be greater than 0 main****MyProject.c
error: 27****392****Address must be greater than 0 main****MyProject.c
error: 27****392****Address must be greater than 0 main****MyProject.c
0 1 mikroCPIC1618.exe -MSF -DBG -pP[COLOR="#FF0000"]16F887[/COLOR] -DL -O11111114 -fo8 -N"C:\Documents and Settings\Administrator.BDG\My Documents\Projects\MikroC\Sahu\sahu.mcppi" -SP"C:\Program Files\Mikroelektronika\mikroC PRO for PIC\defs\" -SP"C:\Program Files\Mikroelektronika\mikroC PRO for PIC\Uses\P16\" -SP"C:\Documents and Settings\Administrator.BDG\My Documents\Projects\MikroC\Sahu\" "sahu.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_Conversions.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_88X.mcl" "__Lib_EEPROM.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl"
[COLOR="#FF0000"]0 1139 Available RAM: 352 [bytes], Available ROM: 8192 [bytes] [/COLOR]
0 122 Compilation Started P16F887.c
960 123 Compiled Successfully P16F887.c
0 126 All files Preprocessed in 63 ms
0 122 Compilation Started sahu.c
173 123 Compiled Successfully sahu.c
0 127 All files Compiled in 31 ms
[COLOR="#FF0000"]0 1144 Used RAM (bytes): 16 (5%) Free RAM (bytes): 336 (95%) Used RAM (bytes): 16 (5%) Free RAM (bytes): 336 (95%)
0 1144 Used ROM (program words): 1361 (17%) Free ROM (program words): 6831 (83%) Used ROM (program words): 1361 (17%) Free ROM (program words): 6831 (83%)[/COLOR]
0 125 Project Linked Successfully sahu.mcppi
0 128 Linked in 187 ms
0 129 Project 'sahu.mcppi' completed: 421 ms
0 103 Finished successfully: 13 Aug 2011, 22:48:34 sahu.mcppi
Sahu,
I have corrected the syntax errors and successfully compiled your program. However, the main problem you're encountering is:
The 16F676 has 1k words of flash (ROM) memory for program storage, the program compiled consumes 1361 words. The lack of available program memory is generating the error is red above. Therefore you'll need a different model PIC if you want to program it with this compiled code.
The compiler log:
Code:0 1 mikroCPIC1618.exe -MSF -DBG -pP[COLOR=#FF0000]16F887[/COLOR] -DL -O11111114 -fo8 -N"C:\Documents and Settings\Administrator.BDG\My Documents\Projects\MikroC\Sahu\sahu.mcppi" -SP"C:\Program Files\Mikroelektronika\mikroC PRO for PIC\defs\" -SP"C:\Program Files\Mikroelektronika\mikroC PRO for PIC\Uses\P16\" -SP"C:\Documents and Settings\Administrator.BDG\My Documents\Projects\MikroC\Sahu\" "sahu.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_Conversions.mcl" "__Lib_Sprinti.mcl" "__Lib_Sprintl.mcl" "__Lib_Time.mcl" "__Lib_Trigonometry.mcl" "__Lib_Button.mcl" "__Lib_Manchester.mcl" "__Lib_OneWire.mcl" "__Lib_PS2.mcl" "__Lib_Sound.mcl" "__Lib_SoftI2C.mcl" "__Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "__Lib_ADC_88X.mcl" "__Lib_EEPROM.mcl" "__Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" [COLOR=#FF0000]0 1139 Available RAM: 352 [bytes], Available ROM: 8192 [bytes] [/COLOR] 0 122 Compilation Started P16F887.c 960 123 Compiled Successfully P16F887.c 0 126 All files Preprocessed in 63 ms 0 122 Compilation Started sahu.c 173 123 Compiled Successfully sahu.c 0 127 All files Compiled in 31 ms [COLOR=#FF0000]0 1144 Used RAM (bytes): 16 (5%) Free RAM (bytes): 336 (95%) Used RAM (bytes): 16 (5%) Free RAM (bytes): 336 (95%) 0 1144 Used ROM (program words): 1361 (17%) Free ROM (program words): 6831 (83%) Used ROM (program words): 1361 (17%) Free ROM (program words): 6831 (83%)[/COLOR] 0 125 Project Linked Successfully sahu.mcppi 0 128 Linked in 187 ms 0 129 Project 'sahu.mcppi' completed: 421 ms 0 103 Finished successfully: 13 Aug 2011, 22:48:34 sahu.mcppi
I actually compiled your code use the PIC16F887 as a target, so change accordingly.
Attached is the entire zipped project folder.
BigDog
better to use integer data types instead of float type=?I would think that it would be better to use integer data types instead of float type.
Hope this helps.
Tahmid.
if((ch<=4.60)&&(ch>=1.40))
if((ch<=4600)&&(ch>=1400))
ch =(float)tlong/1000; // Extract volts (thousands of millivolts)
ch = tlong // Extract volts (thousands of millivolts)
For using the 4600 and 1400, statements before that need to be changed.
Changing the part where the ADC result is processed to a value that is to be used for checking and comparison, etc.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?