Pic16f877a

Thread Starter

lpccorreia

Joined Jun 23, 2011
5
Dear all,

I'm new here and I would like know if you can help me.
I'm using a program with a pic16f871 (but I have no space) and I change the pic to a pic16f877.
This program controls a compact disk player and is working very well.
Now I whant to use the space I have in the pic16f877 using it's linker.
The program have no errors but do not work al all.
Can you please give me some ideas to work with.
Thank you.
 

debjit625

Joined Apr 17, 2010
790
Your question is not so much clear........
Post you code with the name of your development tools i.e.. in which compiler and IDE you are using and as well as the programmer,schematic and current PIC you are working with (I think its 16F877A).
 

t06afre

Joined May 11, 2009
5,934
Hello,
I am not hijacking thread...!!
No big deal for me at least. But yes you are hijacking thread. As you are posting a question in a thread that have nothing to do with the OP question....;).
Why did you not start a new thread instead. That is the correct thing to do best for the OP(of this thread) and you
 

ErnieM

Joined Apr 24, 2011
8,415
The program have no errors but do not work al all.
Can you please give me some ideas to work with.
Thank you.
First you may want to carefully review each spec sheet for the two processors and see if you need to make any changes for A to run in B.

But as that is the obvious first step you already skipped, drop the code into the debugger and see what fails.
 

Thread Starter

lpccorreia

Joined Jun 23, 2011
5
Ok. If you to this site http://bergrans.despinnerij.nl/ you will understand my problem.
The pic16f871 is full and I whant do something more, so I pick de pic16f877 or 877a,
and with the 877 it works using the linker of the 871. The problem is when I whant to use the linker of the 877 it compiles wirh no errors but simply does not work at all.
I do not know assembler very much but I know how to read a program and understand it very well (I too do some cobol programing) but something is note ok.
Hove I was more clear.
Thank you.
 

stahta01

Joined Jun 9, 2011
133
What do you mean by the word "linker" of the 877 or 871?
Edit: I am guessing by downloading the file you mean linker script file.
(I have never used a linker script file; not even positive if that is the correct name for file CDP-1_16f871.lkr)

Tim S.
 
Last edited:

stahta01

Joined Jun 9, 2011
133
I tried to fix linker script and ran into a problem that is not fixable without a lot of knowledge of the program code.
(It happened after using new linker script and new inc file.)

The program used shared memory (memory in same address across all banks.)
The 877a does not have enough shared memory.
Look for "UDATA_SHR" in the asm files.
Edit: Look at page "register file map" in the datasheets.

Note: This is a fixable problem; but requires more time and effort than I am going to spend on learning this area.

Edit: Attached modified Linker Script (This the first time I have worked with Linker Scripts; it likely has a mistakes in it.)

Tim S.
 

Attachments

Last edited:

debjit625

Joined Apr 17, 2010
790
Am I the only one to have problem with that url ? I cant even download the source code zip file link provided by stahta01.

I can access everything expect that url..........
 

t06afre

Joined May 11, 2009
5,934
Do you know why the author do not use the PIC supplied lkr file. To me this sounds somewhat dogy. Why do you not use Microchip supplied lkr file for 16f877 chip instead. Usealy you do not have to even think about the lkr file. If you just create a new project MPLAB will sort this out for you.
Is it the code size or the RAM size that give you problems?
 

stahta01

Joined Jun 9, 2011
133
@debjit625: The source is multiple asm files with an lkr and inc file.

The code is not really that well written(but it is many times better than the Students I grade); and, the site is well done. The person appears to be mainly an hardware expert, who wrote some software.

He has had several people build using his directions; so, I consider his a very well documented project. I have not read much of the site.

Tim S.
 

ErnieM

Joined Apr 24, 2011
8,415
lpccorreia said:
Doctor, it hurts when I do this.
The Doctor said:
Then don't do that!
No, you don't need to play with the linker script. You need to define the processor, and there are macros to do that in MPASM.

Go and open up "16F877ATEMP.ASM" which you will find in "C:\Program Files\Microchip\MPASM Suite\Template\Code" Take a look at lines 33 thru 36.

THAT is what you need to insert into your .asm file, replacing the existing definitions for list, #include, and __CONFIG. Note your config parameters may be different!

Also go up to the menu and click into Configure | Select device and select the device you are actually using.

Delete the linker reference from the project, MPASM will pick the correct linker.

See if that works, then report back.
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,415
OK, I stand corrected, it DOES need a custom linker script. After changing the target processor, cleaning up the duplicate definition of RC5, the dam thing built clean.

I have no idea if it works.
 

stahta01

Joined Jun 9, 2011
133
OK, I stand corrected, it DOES need a custom linker script. After changing the target processor, cleaning up the duplicate definition of RC5, the dam thing built clean.

I have no idea if it works.
NO, it will very likely NOT work; if you fix the Linker Script to match the processor there is NOT enough shared memory (same address in all banks).

Tim S.
 

t06afre

Joined May 11, 2009
5,934
It could also be a bank selection problems. Instead of using the the bank0 and bank1 macros. It is better to use the banksel directive in MPLAB ASM. That makes the code more portable. If you are going to port this code to 16f877(a). The first step would be to ensure that you use the correct memory bank throughout the code.
 
Top