|
|
View previous topic :: View next topic |
Author |
Message |
blups
Joined: 05 May 2011 Posts: 10
|
CCS C compiler ver4.to ver.5 |
Posted: Thu Sep 19, 2013 4:49 am |
|
|
Hi guys,
I have some difficults by switching from C compiler ver4 to ver5.
Starting ver4 project with the new platform "CCS C Compiler" splits out the following message:
http://postimg.org/image/lzpuk15t5/
It seems to be not so big problem, because after that the compiler executes his procedures without any error messages. The new hex file is much bigger as the older one. It is no dramatic, but the UARTs doesn't work with the new hex.
Some ideas?
Much 10x in advance
GR |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Thu Sep 19, 2013 7:41 am |
|
|
As a 'comment', I'd suggest not opening V4 projects. Leave them so you can go back, and instead open the first source file, and create a new project. V5, uses a new project format, and tries to convert the older format when you open a V4 project. Once this is done, you can't compile with V4, without building a new project (though the compiler is meant to support this, it seems to give some problems). Hence I prefer to keep the old project and start 'anew'.
What V4 version did you have?. There have been several small changes during the V4 lifespan, and it may be that your V4 version is just giving a hiccup for the conversion. It does seem normally to work, from 'later' V4 versions.
Do you use interrupts for the comm's?. Do you do anything 'DIY' in the interrupt handling?. One 'big' change in V5, is that the data storage table for the interrupt handler is different. If you have anything like this, add:
near the top of your code, which will make the compiler use the V4 layout.
The defaults on some fuses have changed. Worth checking the fuse list at the end of the .lst file from V4, and comparing it with the one from V5. You may find something has changed here.
Generally, CCS5, seems pretty compatible with V4. It does produce fractionally larger code in general, but I've not seem a big increase, and 99.9% of projects seem to compile OK. However this is from 4.141. Several things from older compilers, do give problems.
What PIC?. Another poster had problems coming from a early 4.1xx version, since the behaviour on nested interrupts was changed here. Documented in the readme.txt for the next few versions, but not for V5.
Best Wishes |
|
|
blups
Joined: 05 May 2011 Posts: 10
|
... |
Posted: Tue Oct 08, 2013 5:43 am |
|
|
Hi Ttelmah,
mutch 10x for the response. In a fact I use interrupts for the Hardware UART1 and UART2.
#device ccs4 doesn't afect the situation.
I did simple things in the comm's interrupts like:
f.E.
Code: |
#int_RDA
void RDA_isr(void)
{
char ch;
#use rs232(baud=57600,parity=N,xmit=PIN_D11,rcv=PIN_D0,bits=8,UART1) // PC
ch=getch();
#use rs232(baud=57600,parity=N,xmit=PIN_B9,rcv=PIN_B8,bits=8,UART2) // Module
putc(ch);
}
#int_RDA2
void RDA2_isr(void)
{
char ch;
#use rs232(baud=57600,parity=N,xmit=PIN_B9,rcv=PIN_B8,bits=8,UART2) // Module
ch=getch();
#use rs232(baud=57600,parity=N,xmit=PIN_D11,rcv=PIN_D0,bits=8,UART1) // PC
printf("%x \n",ch);
}
|
RDA_isr works without any problems. I send a hex sequence of 5 elements (a9 05 6a 00 68).
The module reacts of the command and execute the requested command. It should respond with the sequence (a9 05 6a 64 04).
So at the first cycle of the RDA2 it prints only the first 3 elements(a9 05 6a), with the second cycle it prints (64 04 a9) and than nothing. The RDA continues to work properly and the module executes the command but RDA2 doesn't print anything.
So when I put small changes in the code :
Code: |
#int_RDA2
void RDA2_isr(void)
{
char ch;
#use rs232(baud=57600,parity=N,xmit=PIN_B9,rcv=PIN_B8,bits=8,UART2) // Module
ch=getch();
#use rs232(baud=57600,parity=N,xmit=PIN_D11,rcv=PIN_D0,bits=8,UART1) // PC
printf("%x",ch);
} |
without new line "\n", the RDA2 works without a problem!
Actualy I need much more time for evaluating some incoming data in the RDA2. Any ideas?
P.S.
I don't use any other interrupts!
The PIC is 24FJ128GB106
The old PCD is 4.112
The new one is 5.012 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Tue Oct 08, 2013 7:29 am |
|
|
That that ever worked (if it did), is amazing....
Several things in sequence:
1) Don't use #use RS232's in the code like this. Historically, you could use #use RS232 statements 'in line', to change the UART settings as you went along, _but_ using them inside an interrupt, will leave the code in an indeterminate state, with the default putc/getc, potentially routed to the wrong device. Switching to different pins/uart's, is what _streams_ are for.
Look at the manual, and fgetc/fputc.
Study the CCS examples, and code posted here. You will not find a single (working) example that tries to do things as you are doing....
2) Time. Remember that a rs232 interrupt implies there is one character waiting, and may be only one character time, till the next one arrives. Hence you really must get out of the interrupt handler in less than one character time. The larger hardware buffers on the PIC24, may slightly save you, but it is not the way to work. If you want to print inside and interrupt, then use interrupt driven buffered TX (look at ex_stisr.c).
As it stands, the code is fundamentally flawed. Don't blame the compiler... |
|
|
|
|
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
|