![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
mhjccsinfo
Joined: 17 Oct 2011 Posts: 23 Location: Iran-tehran
|
From 16f to 18f |
Posted: Tue Nov 27, 2012 11:52 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19368
|
|
Posted: Wed Nov 28, 2012 2:36 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Nov 28, 2012 5:42 am |
|
|
Hi,
And, of course, you'll need a new compiler for the 18 series parts!
John |
|
![](templates/subSilver/images/spacer.gif) |
mhjccsinfo
Joined: 17 Oct 2011 Posts: 23 Location: Iran-tehran
|
thanks |
Posted: Wed Nov 28, 2012 7:43 am |
|
|
thanks a lot
program worked after #bit and #byte instructions changing |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|