Pic16f877a

Discussion in 'Programmer's Corner' started by lpccorreia, Jun 23, 2011.

  1. lpccorreia

    Thread Starter New Member

    Jun 23, 2011
    5
    0
    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.
     
  2. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    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).
     
    lpccorreia likes this.
  3. RRITESH KAKKAR

    Senior Member

    Jun 29, 2010
    2,831
    89
    Hello,

    I only want to know what is the cost of this PIC kit??

    I am not hijacking thread...!!
     
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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
     
  5. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    Kind of, so always try to post in a new thread.....

    I don't think we mentioned any kind of PIC kit here.
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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.
     
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Well, yes you ARE hijacking.

    And you don't mention which PICKit you want, there is a version 1 2 and 3.

    Finally, I doubt you own the youTube site.
     
  8. lpccorreia

    Thread Starter New Member

    Jun 23, 2011
    5
    0
    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.
     
  9. stahta01

    Member

    Jun 9, 2011
    133
    21
    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: Jun 23, 2011
  10. stahta01

    Member

    Jun 9, 2011
    133
    21
    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.
     
    Last edited: Jun 23, 2011
  11. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    That link is not working,may be I should try after some time.
     
  12. stahta01

    Member

    Jun 9, 2011
    133
    21
  13. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    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..........
     
  14. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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?
     
  15. stahta01

    Member

    Jun 9, 2011
    133
    21
    @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.
     
  16. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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: Jun 23, 2011
  17. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Well, yeah... [​IMG] Huh. What is this. We only try to help here.[​IMG]
     
  18. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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.
     
  19. stahta01

    Member

    Jun 9, 2011
    133
    21
    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.
     
  20. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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.
     
Loading...