View previous topic :: View next topic |
Author |
Message |
TIMT
Joined: 02 Sep 2005 Posts: 49 Location: Nottingham, UK
|
migrating from 16f877a to 18f452 |
Posted: Tue Oct 11, 2005 10:19 am |
|
|
Hi there,
I'm in the process of converting an assembly code program to C with CCS. My current program is using a 16f877a which is rapidly getting filled up using C - Mostly because I'm doing things in C which I wouldn't have attempted to do in assembler! My question is, the larger (more memory) 18f452 seems to be pin for pin compatible with the 16f877a, can I just take my C code for the 16f877a, create a project for a 18f452 and pull it into this project (making changes to the header files etc..) ? or is it a bit more difficult than that?
I've only been using CCS for four weeks so go easy on me if this is an obvious question!
Regards Tim. _________________ Tim |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Tue Oct 11, 2005 10:39 am |
|
|
What you want to do should work. If I'm not mistaken, I believe that the 452 has an extra timer, timer 3, that the 877A doesn't have. You'll need to make sure that it powers up disabled; if not, you'll need to add code to disable it.
The only thing you need to watch out for is if you directly access any of the special function registers. For instance, I always put my buttons/keypad on port b, and I usually directly access port b in my code. For the 16 chips, port b is at address 6 (I think), but for the 18 chips, it's at address 0xF81. Minor changes like that.
The only other area where you may see some odd behavior is with the watchdog. You set it up differently in the 18 series than you do with the 16's.
Hope this helps. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Tue Oct 11, 2005 1:26 pm |
|
|
Quote: |
My question is, the larger (more memory) 18f452 seems to be pin for pin compatible with the 16f877a
|
There are minor differences, unless if you are using ICD. The most important is ICSP LVP pin:
in the 16F87x series is in PIN_B3,
in the 18F45xx series is in PIN_B5
If you have a new design in progress, there are a Microchip warning for using the 18F452,
it is Not recommended for new design. You will consider to use the device 18F4520
To know the difference migrating between 18F452 and 18F4520
http://ww1.microchip.com/downloads/en/DeviceDoc/39647a.pdf
Humberto |
|
|
TIMT
Joined: 02 Sep 2005 Posts: 49 Location: Nottingham, UK
|
16f877a to 18f452 migration |
Posted: Wed Oct 12, 2005 2:45 am |
|
|
Thanks for your replies, doesn't look like it should be too difficult! I think the lcd driver handles the different port locations. I didn't know the 452 was being superceeded by the 4520 I had heard some people have had problems with it. Might still use it though to begin with as I have one on order. I'll keep an eye on the timer3 settings when I set up the project.
It'll be good having 32k(16k) of memory to play with instead of trying to cram everything into 8k! Regards... _________________ Tim |
|
|
|