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

migrating from 16f877a to 18f452

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



Joined: 02 Sep 2005
Posts: 49
Location: Nottingham, UK

View user's profile Send private message

migrating from 16f877a to 18f452
PostPosted: Tue Oct 11, 2005 10:19 am     Reply with quote

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! Smile
Regards Tim.
_________________
Tim
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Tue Oct 11, 2005 10:39 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 11, 2005 1:26 pm     Reply with quote

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

View user's profile Send private message

16f877a to 18f452 migration
PostPosted: Wed Oct 12, 2005 2:45 am     Reply with quote

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
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