PIC18F4520 assembly programe error.

Discussion in 'Embedded Systems and Microcontrollers' started by thar07, Sep 23, 2015.

  1. thar07

    Thread Starter Member

    Jan 3, 2015
    71
    0
    i wrote this program to toggel the output of Port d in the proteus and it is running perfectly. But when i complied it with MPASMWIN it shows the following errors. Could you please tell me what wrong with this ?




    lst file

     
  2. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,997
    3,756
    Register names are case sensitive. PORTB, TRISB
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    The assembler could not find the include file which defines things. This usually happens for one of two reasons:
    1. The include file "p18f4520inc" is not located in the folder where the assembler is looking for it, or
    2. The assembler has no idea where to look for the include file.
    What you need to do is review the documentation to find out how such things are done.
     
    Last edited: Sep 24, 2015
  4. thar07

    Thread Starter Member

    Jan 3, 2015
    71
    0
    How to correct those errors ?
     
    Last edited: Sep 24, 2015
  5. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    How to correct those errors requires understanding what the assembler is trying to do. Understanding what the assembler is trying to do requires that you:

    "... review the documentation to find out how such things are done."

    which is what I told you in my previous post.

    In other words you must place the include file where the assembler can find it, or you must give the assembler the path to the folder where the include file is located.
     
    Last edited: Sep 24, 2015
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Once you get the path to your include files settled your next errors will come from your list of equates. At best these will produce warnings for delicate definitions, at worst they will yield hard errors. Best remove them and let the include file do that part of the heavy lifting.

    How are you using the assembler? It works easily inside MPLAB where setting like the device being used (which is in your list of errors) will be set for you when you walk thru the new project wizard.
     
    Last edited: Sep 25, 2015
    thar07 likes this.
  7. dannyf

    Well-Known Member

    Sep 13, 2015
    1,778
    360

    Using assembly is preferred if you have lots of free time or free money, or you want to push the performance envelope.

    Otherwise, it is far better to code in C.
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    Who asked you for that pearl of wisdom?
     
  9. dannyf

    Well-Known Member

    Sep 13, 2015
    1,778
    360
    For example, your asm code can be simply done in C as

    Code (Text):
    1.  
    2.   OUT_PORT ^= OUT_MASK; // flip out_mask
    3.  
    The code itself is quite self explanatory and will work for all mcus -> much more portable than your assembly.
     
Loading...