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

16F877 to 18F452 /18F4520

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



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

16F877 to 18F452 /18F4520
PostPosted: Thu Feb 02, 2006 2:00 am     Reply with quote

Just a quick question for anybody who has been in this situation. I've have a project that needs to be ported from an 877 to a 452 or 4520 since 877 are going out of style. My first question is, should my code theoretically port over with no mods as long as I don't use any direct memory addressing. And is there a significant difference between the 452 and 4520.

I will look at the datasheets in detail later, but I was just trying to get a heads up on this topic.

Thanks
aopg64



Joined: 17 Oct 2005
Posts: 28
Location: Hampshire, UK

View user's profile Send private message

PostPosted: Thu Feb 02, 2006 3:57 am     Reply with quote

Hi, I'm doing something similar from 16F876A to 18F2520. Unfortunately it's not a straight port over so far:
1) EEPROM locations different
2) SFR registers different
3) WDT not dynamically changeable any more
4) Device file constant names changed, e.g ADC ones, and if you don't pick the right one you end up chasing your tail for a day wondering why things don't work any more.

Those have been my problems so far. No doubt there'll be more!
Confused

Nige
_________________
No comment! (Can't think of anything interesting to say!)
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Feb 02, 2006 10:03 am     Reply with quote

One of the best features of PIC + CCS is portability and flexibility.
I made a debugging board to adapt the 16F8xx & 18F4x2 to the ICD.

Changing only one jumper AND selecting the processor family
it is possible to start running with any of them.

I use this common header:
Code:
 
#case

//#define PIC16     Change ICD Jumper !!!
#define PIC18  //   Change ICD Jumper !!!

#ifdef  PIC16

#include <16F877.H>
#device ICD=TRUE
#fuses NOWDT,XT, NOPROTECT, BROWNOUT, PUT, DEBUG, NOLVP

#else   

#include <18F452.H>
#device ICD=TRUE
#fuses NOWDT,WDT128,XT, NOPROTECT, NOOSCSEN, BROWNOUT, BORV20, PUT, STVREN, \
NODEBUG, NOLVP, NOWRT, NOWRTD, NOWRTB, NOWRTC, NOCPD, NOCPB,
\NOEBTR, NOEBTRB

#endif

#define Xtal 4000000

#use delay(clock=Xtal)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,enable=PIN_C5,bits=8,errors)


If you are using ICD, be aware that 18F use different pinīs than 16F.


Nige wrote:
Quote:

Hi, I'm doing something similar from 16F876A to 18F2520. Unfortunately it's not a straight port over so far:
1) EEPROM locations different
2) SFR registers different
3) WDT not dynamically changeable any more
4) Device file constant names changed, e.g ADC ones, and if you don't pick the right one you end up chasing your tail for a day wondering why things don't work any more.


Microchip claims that the 18F452 is pin compatible with the 16F877, wich is different to say that
it has the same internal architecture. Anyway I don't know any other microcontroller where you
gain a x4 upgrade factor with minimum changes like this.


Humberto
Eugeneo



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

PostPosted: Thu Feb 02, 2006 11:33 pm     Reply with quote

Good stuff. I've now have a working 4520. Now I've got to test it to death.

Thanks for the great heads up guys.
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