CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem with compiler

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

Problem with compiler
PostPosted: Thu Sep 19, 2013 8:27 am     Reply with quote

Hi to all,
I use PIC18F4525 with CCS V3.249 compiler. It work really fine.
Now, after compiled same code with V4.35 I found problem in I2C bus used for RTC and LCD display.
Really, I don't use "#use i2c" function but I set I2C registers manually based on my use.

Where's possible difference ?
Registers, timing and all are the same. Just changed compiler release.

Thanks for help,

Regards,
Fabrizio
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 19, 2013 8:45 am     Reply with quote

Quote:
I use PIC18F4525 with CCS V3.249 compiler. It work really fine.
Now, after compiled same code with V4.35

Post the real version number. Example of version numbers:
http://www.ccsinfo.com/devices.php?page=versioninfo
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Thu Sep 19, 2013 9:06 am     Reply with quote

As PCM programmer says, post the actual version number.
If it is 4.035, then 'give up'. This was before V4 started working for anything but basic operations. Good 'working' versions start around 4.07x.

However, one key 'possible difference'. Do you use pointers?.
V4, switches to the proper C syntax for these, so incrementing a pointer to an int16, increments the memory location accessed by 2. V3, used a CCS 'incorrect format', and incremented pointers by 1. So if using pointers to access bytes, you have to cast them to (char *).

Best Wishes
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Thu Sep 19, 2013 9:16 am     Reply with quote

I'm sorry, release of compiler is V4.135.

I have in the same i2c bus one display and one RTC.
Communication with RTC is ok but I have problem with slave LCD.
Slave LCD use PIC16F690.

I haven't any problem with CCS V3.249.

Regards,
Fabri
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 19, 2013 10:53 am     Reply with quote

You probably need to post the driver code for the LCD. Also post a
test program that calls the functions in the LCD. Make sure that the
posted code will compile without errors. In other words, post the LCD
driver and a test program to call it. Put in the #include for the PIC,
#fuses, and #use delay(), etc.
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Thu Sep 19, 2013 11:41 am     Reply with quote

I'll do some new test and I'll post driver.

I don't use pointer but I possible problem may be in syntax or type of variables used. I2c routine work fine with RTC. I also checked with oscilloscope I2c signal.....

Thanks for help,

Fabri
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Fri Sep 20, 2013 1:13 am     Reply with quote

Ok... I solved.
It was in firmware wrote over 5 years ago. I used "hi(data)" way to get hi side of long variable "data". In CCS V4.135 seems this doesn't work. I used "make8" function to have hi and low of variable "data".


Thanks,
Fabri
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Fri Sep 20, 2013 1:22 am     Reply with quote

I'd suspect the routine 'hi', used a pointer to access the high byte.
This is one of the 'standard' transition problems.
A routine like:
Code:

#define hi(x) (*(&x+1))


Will give you the high byte of a variable in a V3 compiler, but on V4, needs to change to:
Code:

#define hi(x) (*((char *)&x+1))


Make8, is more efficient anyway.

Best Wishes
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Fri Sep 20, 2013 1:40 am     Reply with quote

Yes Ttelmah,

When you talk me about pointers I check variables and way of I used them.
I wrote this firmware over 5 years ago so I don't remember, and how, I decided to use tihs way to get hi side of variable.

Thanks again your precious help,

Regards,
Fabri
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Fri Sep 20, 2013 1:44 am     Reply with quote

Nice that the problem was (in the end), obvious, and quickly found. Smile

The performance of the later V4 compilers is pretty good, with better handling of more complex types, and some extras over V3, and particularly support for a lot more chips, so it's worth moving forward.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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