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

PCD Compiler - explorer 16 pic24 - bugs?

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



Joined: 27 Jun 2006
Posts: 39

View user's profile Send private message

PCD Compiler - explorer 16 pic24 - bugs?
PostPosted: Thu Aug 13, 2009 4:17 pm     Reply with quote

I am just getting started with the PIC24 and its compiler. I am using version 4.083. I have just begun testing on the explorer 16 board and have run into the following issues:

#use delay must be defined at half of the clock frequency where it should be using the actual external clock frequency. The clock is actually 8Mhz, but I had to enter 4Hz in order for the timing to work correctly.

The formatting using the printf state on lcd and rs232 formats as follows:
test UART2
1.239999

Are there many more issues that I will be running into with this compiler for the pIC24/30/33??

Here is the code that was tested:
Code:

#include <24fj128ga010.h>
#fuses NOJTAG,NOPROTECT,NOWRT
#fuses HS
#use delay(clock=4000000)
#use rs232(baud=9600, UART2, parity=n)

#include <lcd_explorer16.c>

void main(){
int i = 0;

lcd_init();

printf(lcd_putc,"\fhello world");
printf(lcd_putc,"\n%3f",1.24);

while(1){

output_a(0xff);
delay_ms(100);
output_a(0x00);
delay_ms(100);

if(i==10){
   printf("\n\rtest UART2\r\n%3f",1.24);
   i=0;
}//if
i++;
}//while
}//main


Last edited by fvnktion on Fri Aug 14, 2009 12:22 pm; edited 1 time in total
fvnktion



Joined: 27 Jun 2006
Posts: 39

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 9:24 am     Reply with quote

I would really like to get a general consensus on how much the PCD compiler is used and how well it is supported. I really dont want to dive too deeply here with the PCD if I am not going to be getting any support.

Maybe time to traverse over the mplab c30 compiler for this architecture? Or should I look into a upgrade to a newer version of the CCS? Or am i just overlooking something in my basic test program?

Has anyone had good results with this compiler with newer versions, older versions?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 11:25 am     Reply with quote

There aren't many people on the forum who provide support for PCD.
It's mostly FvM. It's better if you edit your title and prefix it with PCD
so he'll notice it. Example:
Quote:
PCD: explorer 16 pic24 compiler - bugs?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 1:01 pm     Reply with quote

I don't understand, what you're complaining about PCD's understanding of the %3f format specification. It's according to ANSI C, I think.
Quote:
If the precision is missing, it is taken as 6


The other point is, that you are apparently expecting PCD to generate code, that sets all clock related registers according to #use delay statement. That's not the case. While OSCON is set during processor reset from the configuration word (either default or as specified by #fuses statements), CLKDIV isn't touched by PCD, so the reset default applies. Consult the PIC24FJ128GA010 manual for details.

It's also instructive to check the actual configuration word settings, either in the PCD *.lst file or better in MPLAB, that is decoding it and also allows manual override for test purposes.
fvnktion



Joined: 27 Jun 2006
Posts: 39

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 1:23 pm     Reply with quote

Thanks for the reply. I will look into the timing setting of the registers.


My understanding, based on the ccs manual is that the %3f used in my printf should represent a precision of 3 and type float, but a precision of 6 is used. It also seems that the output in the case of precision 6 would be 1.240000 where the value of 1.24 was given. I suppose this could be due to the complex formatting of the float type?

How have you like the PCD in your uses to date?
Ttelmah
Guest







PostPosted: Fri Aug 14, 2009 2:54 pm     Reply with quote

You are misunderstanding the manual.

In C, the number in front of the decimal point, is the _minimum field width_. So %3f, simply says print a minimum of 3 characers as an output. Does not affect the precision (part after the decimal point at all...
Now normally the 'filler' (extra character sent to fill unused spaces), is a space. So %3f, will, if given '0', result in two spaces, then the single '0' character.

The precision, is the number _after the decimal_ point in the specifier.

So %.3f, gives three spaces after the decimal.

Now it is also common to not realise that there are quite a few locations already 'used' in the field width. There is a leading character 'reserved' to hold the sign, and the decimal point itself, also uses a location. Also, if a number won't fit in a space specified, extra locations will be used as needed.

Add the decimal point, and you should get what you want.

Best Wishes
fvnktion



Joined: 27 Jun 2006
Posts: 39

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 3:59 pm     Reply with quote

Very helpful.

Thank you.
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