View previous topic :: View next topic |
Author |
Message |
Henk
Joined: 22 Mar 2004 Posts: 6 Location: JOHANNESBURG, SOUTH AFRICA
|
16F877 to 18F425 migration problems |
Posted: Thu Nov 11, 2004 6:23 am |
|
|
Hi.
I have run out of program space on a pic16F877 , so have loaded the code into a pic18f425, same hardware, including 4mhz xtal.
The code compiled and loaded (using MPLAB ICD 2) with no errors, but doesn't execute. I have checked the clock with a scope, and even tried setting to HS (this still OK for 18F425 at 4mhz). Only activity on the chip is the clock inputs, no other pins change state. Any ideas? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Nov 11, 2004 7:28 am |
|
|
Quote: | The code compiled and loaded (using MPLAB ICD 2) with no errors, but doesn't execute. |
This is with the PCH compiler, right?
Quote: | and even tried setting to HS (this still OK for 18F425 at 4mhz). |
No, should be XT
Write a small "test" program with the new chip and see if it does anything.
Also make sure that you have NOLVP in the fuses. I believe the LVP pin changed on the 18's and this will cause you problems if you don't disable it. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Nov 11, 2004 8:35 am |
|
|
These are totaly different processors,.. Did you change the references to port locations and OTHER processor specific items?
ie: port A on 16F877A = 0x005
port A on 18F452 = 0xF80
There are alot of things that might need to be changed.
Did you change these?? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Nov 11, 2004 8:50 am |
|
|
Timer0 is 16bits also but has an 8bit mode as well. |
|
|
Henk
Joined: 22 Mar 2004 Posts: 6 Location: JOHANNESBURG, SOUTH AFRICA
|
|
Posted: Thu Nov 11, 2004 2:24 pm |
|
|
Thanx Mark. As advised, a simple test program runs correctly on the existing hardware.
Seems, however, to be some incompatibility with the running of the LCD routine on the new processor, although it runs perfectly on the 877. Addressing is taken care of in the include file 18F452.h, which I also checked against the data sheets.My application program code begins with messages to a 2x16 display, so this gave the impression that the processor was not running. Is this a known problem with the 452? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Nov 11, 2004 2:43 pm |
|
|
Only the problems mentioned hear are the ones that I have seen. Take a baby step and write a simple program to write to the display to make sure those routines are good. |
|
|
Henk
Joined: 22 Mar 2004 Posts: 6 Location: JOHANNESBURG, SOUTH AFRICA
|
|
Posted: Sat Nov 13, 2004 12:44 am |
|
|
Got it. You were both right. Clever Henk deleted some lines in the standard LCD.C routine to save code space, and set portD address at 8 for 16F877.
thanks again. |
|
|
|