|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
CCS compiler/linker question |
Posted: Sun Jul 10, 2005 9:35 am |
|
|
hi,
I really need your help to explain the problem that I observed:
I have CCS PCH C Compiler, Version 3.224 and I work on a large project with based on PIC18F8720. Recently, The newest build have some problem. There is a function displays a Non-Zero defined constant on a LCD. In the newest build, when the function displays the Non-Zero defined constant on the LCD, the LCD displays a zero value for that Non-Zero defined constant.
The display problem goes away if I add in my build a dummy int16 variable ( just declare and define the variable without using it anywhere).
When I look in the symbol file, the problem function is located at:
0078A2 SensorVssStartCalibration.
But when I add in dummy int16 variable in the build. The symbol file, the problem function is located at:
007652 SensorVssStartCalibration
This is kind of weird to me. I think if I declare a new dummy variable in the build, the address location of SensorVssStartCalibration should be moved up and get bigger, but in my case, the address gets smaller???
By adding a dummy variable, the display problem goes away???
Thanks,
Tom |
|
|
valemike Guest
|
|
Posted: Sun Jul 10, 2005 9:44 am |
|
|
Does the problem happen in 3.225 and above? What about 3.223 and below?
Are you absolutely sure that you are not assigning and/or comparing two unequally sized variables -- such as int16 to int8 (or char, int, long), without casting? |
|
|
Guest
|
|
Posted: Sun Jul 10, 2005 1:46 pm |
|
|
valemike,
I might have some improper assignment between int16 and int8, but I am not sure how is that related to what I have been observed.
I have this defined value:
#define DEFAULT_DISTANCE_FOR_VSS_CALIBRATION_METER 3218
In one of my display function, I have this line of code:
printf(lcd_putc, "Stop At %4lum",DEFAULT_DISTANCE_FOR_VSS_CALIBRATION_METER);
In the good build, the LCD displays :"Stop At 3218m"
In the bad build, the LCD displays :"Stop At 0m"
but If I just declare a dummy varible in the bad build, then the LCD displays correctly :"Stop At 3218m".
T |
|
|
valemike Guest
|
|
Posted: Sun Jul 10, 2005 2:46 pm |
|
|
Look at the Compiler Update info:
Quote: |
3.225 Some formatting issues with %LD are fixed
|
I don't know if the above fix may help your problem.
I compiled a test program using printf to Hyperterminal, and the output was correct:
Code: |
#include <18F448.h>
#device ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP,PUT
#use delay(clock=4000000)
#case
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#ignore_warnings 202
#define DEFAULT_DISTANCE_FOR_VSS_CALIBRATION_METER 3218
void main(void)
{
printf("Stop At %4lum",DEFAULT_DISTANCE_FOR_VSS_CALIBRATION_METER);
while(1);
}
|
I haven't played much with LCDs on a PIC, and I don't know if that is the problem.
-Mike |
|
|
bill147
Joined: 26 Oct 2004 Posts: 13
|
|
Posted: Sun Jul 10, 2005 7:49 pm |
|
|
I had a similar problem using printf when using a long int. The memory space used by printf was across a page break. By adding a dummy variable the memory space for the printf was changed.
This problem was supposed to be fixed version 3.226.
The only problem is that version 3.226 introduced other problems. One of them is that I2C slow speed no longer works.
Bill |
|
|
Ttelmah Guest
|
|
Posted: Mon Jul 11, 2005 7:48 am |
|
|
bill147 wrote: | I had a similar problem using printf when using a long int. The memory space used by printf was across a page break. By adding a dummy variable the memory space for the printf was changed.
This problem was supposed to be fixed version 3.226.
The only problem is that version 3.226 introduced other problems. One of them is that I2C slow speed no longer works.
Bill |
Have you tried specifying the 'speed', as opposed to just using fast/slow?.
The way speeds are set, was changed on this version, and the old syntax, seems to cause problems, but adding the speed, worked for me.
Best Wishes |
|
|
Guest
|
|
Posted: Mon Jul 11, 2005 11:15 am |
|
|
bill147,
Thank you so much for sharing this. You have no idea how much I appreciate your answer.
T |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|