View previous topic :: View next topic |
Author |
Message |
ccsHowTo
Joined: 01 Mar 2020 Posts: 5
|
Difference V4 to V5 ? |
Posted: Sun Mar 01, 2020 11:47 am |
|
|
I have a project with a communication stack for modbus working under CCS V4.25 since 2009.
Ported this project to V5 (newest version) with no changes to the source code - failed to work. If I debug the receive buffer - the contents is scrambled under V5.
Took the project back to V4 - open by double clicking the project.PJT - download - fine again.
It does not matter if you debug the program with the ccs IDE's or if you use MPLAB 8 (for V4) or MPLAB C IPE (for V5) to program the controller. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 01, 2020 11:53 am |
|
|
Post your PIC. |
|
![](templates/subSilver/images/spacer.gif) |
ccsHowTo
Joined: 01 Mar 2020 Posts: 5
|
Microcontroller used - PIC16F886 |
Posted: Sun Mar 01, 2020 12:16 pm |
|
|
I use the PIC16F886 ..
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19375
|
|
Posted: Sun Mar 01, 2020 1:35 pm |
|
|
Do you do any custom interrupt handling?. The format of saved data
in the ISR changes with V5.
Also CCS 5 fixes the interrupts being disabled in some printf statements.
Some fuses change names in CCS 5, and the defaults are changed to
match what the chip defaults to. You need to look at the fuses from the
V4 compile and ensure you set the fuses to match this. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 01, 2020 1:38 pm |
|
|
ccsHowTo wrote: | CCS V4.25 since 2009.
|
One more thing. Clarify your compiler version. Do you have 4.025 or 4.125 ? |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9176 Location: Greensville,Ontario
|
|
Posted: Sun Mar 01, 2020 2:12 pm |
|
|
re: ...
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
you NEED to add 'ERRORS' to the options, unless YOU handle UART overflow.... |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19375
|
|
Posted: Mon Mar 02, 2020 1:37 am |
|
|
Also, are you using the modbus.c from the old compiler or the new?. If the
new, this needs MODBUS_PROTOCOL #defined as
MODBUS_PROTOCOL_SERIAL to be compatible with the older driver. This didn't
support MODBUS_RTU now it does, and the defines needed have changed
to add support for this. |
|
![](templates/subSilver/images/spacer.gif) |
jeremiah
Joined: 20 Jul 2010 Posts: 1329
|
|
Posted: Mon Mar 02, 2020 3:09 pm |
|
|
Also since you say the contents are scrambled, this could suggest either a UART setup or clock setup problem.
How did you verify your clock settings were correct? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 02, 2020 5:20 pm |
|
|
Also, when you were running vs. 4.025, did you copy the PIC's .h file
into your project folder ? There can be substantial differences between
some of the constants in the PIC .h files between compiler versions.
CCS can add features to functions and change constants or their meaning.
If you did this, remove the old vs. 4.025 PIC .h files, and let the vs. 5
compiler pick up the correct vs. 5 .h file for it.
Also, you said things are scrambled. I smell pointer arithmetic. It's a
possibility. Post any code where you're doing pointer arithmetic. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9176 Location: Greensville,Ontario
|
|
Posted: Tue Mar 03, 2020 5:39 am |
|
|
I have to ask, why, did you change compiler versions ? You were cutting and compiling fine BEFORE. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 03, 2020 6:21 am |
|
|
Temtronic, this is a bogus post of yours. It's done just because you are
bored. The truth: He has an ancient version, 4.025, left over from Feb.
19, 2007. There are tons of reasons to go to version 5. Let's list them.
New library code added:
#use pwm()
#use capture()
#use timer() allows creation of timer ticks.
These new libraries make it easy to use the PIC's features without calling
a lot of setup functions. Just like #use rs232() makes it really easy to use
serial comms.
Enhanced features added:
#use rs232() flow control (RTS/CTS), and transmit and receive buffers.
#use SPI() streams added
pin_select() function added (in addition to #pin_select directive).
Compiler efficiency:
Vs. 5 reduces ROM usage in the compiled code by about 20% compared
to the older vs. 4 compiler. Temtronic, that alone is worth upgrading.
IDE
Many new features, for those who use the IDE.
Other non-documented features
Lots of little things work better or have been slightly enhanced.
You can tell this by comparing the manual sizes. The current CCS manual
is 622 pages. The latest vs. 4 compiler manual only has 382 pages.
Admittedly, the new manual incorporates PCD, but there are still many
pages of new stuff. June 2012 CCS manual:
https://t1.daumcdn.net/cfile/tistory/184FAE3A5102B90E20?download |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19375
|
|
Posted: Tue Mar 03, 2020 7:47 am |
|
|
Must admit though that it should not actually be that hard to move between the versions. A number of things apply:
1) There is some custom code that was generated to fix issues with the V4
compiler. 4.025, is early enough that this could be the case.
2) Possibility that the clock setup is wrong. As I said early on, look at
the fuses actually being used with the V4 version and verify these are the
same on the V5 version. There have been quite a few changes to the fuse
default behaviour.
3) Possibility of incorrect pointer handling.
I must admit I'd put my money on '2', followed by '3'.
I've ported a lot of old V3 and V4 code up to modern compilers and have never
seen any major issues. |
|
![](templates/subSilver/images/spacer.gif) |
|