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

From 16f to 18f

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



Joined: 17 Oct 2011
Posts: 23
Location: Iran-tehran

View user's profile Send private message Send e-mail

From 16f to 18f
PostPosted: Tue Nov 27, 2012 11:52 pm     Reply with quote

Hi all,
I have wrote a program for a 16f877a mcu, but now I have not enough Ram and Rom for the rest of program.
I decide to use a PIC18f46k80 with 64KB ROM. I saw datasheet and the pins are same (except pin_a4). Now I want to know is it possible to write my program on this new PIC (with only a INCLUDE changing) ?
thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Wed Nov 28, 2012 2:36 am     Reply with quote

Depends totally on how your code is written.
For 90% of stuff, 'yes'. However if you have used any #byte register definitions, then these will need changing (this is where uysing getenv, rather than hard coding register addresses helps - makes the code much more portable). Also the defines used to configure many peripherals will have changed, especially because of little hardware differences (for instance Timer0, on your older PIC, was 8bit - on the new PIC this is selectable). Remember also you have the PLL available, so depending on what crystal you were using on the older PIC, you may well be able to run 4* as fast. The only differences about RA4, is on the 877, it is effectively 'open collector', so needs a pull up resistor if used as an output. On the PIC18, it is a normal I/O pin, and if you use the comparator, this comes out on a different pin.
If you do a search in the forum, there have been several threads asking this type of question. Many users have code that literally only needed a few lines changed.

Best Wishes
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed Nov 28, 2012 5:42 am     Reply with quote

Hi,

And, of course, you'll need a new compiler for the 18 series parts!

John
mhjccsinfo



Joined: 17 Oct 2011
Posts: 23
Location: Iran-tehran

View user's profile Send private message Send e-mail

thanks
PostPosted: Wed Nov 28, 2012 7:43 am     Reply with quote

thanks a lot
program worked after #bit and #byte instructions changing
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