• AVR Freaks

Hot!Assembly code error.

Page: 12 > Showing page 1 of 2
Author
AMPS
Super Member
  • Total Posts : 501
  • Reward points : 0
  • Status: offline
2020/01/15 20:59:05 (permalink)
0

Assembly code error.

i have simple code written on PIC16F886. I posting part of it .  whem i compile the code i used to get below error.
 
 
Error message
Message[302] PIC16F886.ASM 140 : Register in operand not in bank 0. Ensure that bank bits are correct.

 
for this error what i need to do.
 
 
post edited by AMPS - 2020/01/16 01:02:50

Amps
*.*.*.*.*.*.*.*.*.*.*.*.*
#1

32 Replies Related Threads

    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/15 21:15:33 (permalink)
    0
    A "Message" is not an "Error".
    It's just advising you that this register is not in bank 0, and it's your job to ensure the right bank is selected.
    MPASM does NOT attempt to track which bank is selected, so it does not know if you have done it correctly or not.
    It's not a very useful message, so I always disable it.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    AMPS
    Super Member
    • Total Posts : 501
    • Reward points : 0
    • Status: offline
    Re: Assembly code error. 2020/01/15 21:31:05 (permalink)
    0
    even i changed the bank and select proper same error is continuing. How can i eliminate the error.
     
    Can i u show me simple example of correcting it. i tried multiple way error comes at this point
     
    BSF PCON,NOT_POR ;Power-On reset? btfss 
     BSF PCON,ULPWUE ;Power-On reset? btfss 

     
    post edited by AMPS - 2020/01/16 01:03:40

    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    #3
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/15 21:47:29 (permalink)
    +1 (1)
    ajitnayak87
    even i changed the bank and select proper same error is continuing. How can i eliminate the error.

    You didn't read my answer.
    IT IS NOT AN ERROR.
     
    To suppress the message, just add this line to the start of your ASM file.
            errorlevel      -302    ;suppress "not in bank-0" messages


    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/15 21:52:06 (permalink)
    +1 (1)
    If you don't want to suppress them, then this will stop it reporting them
        BANKSEL PCON    ;this is the safer way to set RP0 and RP1
        BSF (PCON & 7Fh),ULPWUE ;Power-On reset? btfss


    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #5
    AMPS
    Super Member
    • Total Posts : 501
    • Reward points : 0
    • Status: offline
    Re: Assembly code error. 2020/01/15 22:55:06 (permalink)
    0
    In some of location it went message.what about below msg. my project compile successfully.
    weather msgs affect my programs.
     
    I have small issue. actually my project running on PIC16F883 ., considering future memory expansion i have changed to pic16F886
    one of function used to work on PIC16F883 not working on pic16F886. i found pic16F883/pic16f886 memory bank selection.
    if use pic16f883 my product work properly.but not on pic16f886.
    is there any changes in config setting while code migrate from 883-886
    SM 614 : Using default destination of 1 (file).

    Here also i am getting msgs 
     
    Crossing page boundary -- ensure page bits are set.

     
    pagesel manipl2
    call manipl2
    bsf PCLATH,3

     
    post edited by AMPS - 2020/01/15 23:17:47

    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    #6
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/15 23:14:58 (permalink)
    0
    What is the assembly line generating that error?
    It means you forgot to add the ",f" or ",w" suffix to an instruction that needs it.
    The message says that it assumes you meant ",f".
     
    In the PIC16F886 code, are you still only using one page of memory, or has it crossed over into a second page?
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #7
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/15 23:24:41 (permalink)
    0
    ajitnayak87
    ...
    Here also i am getting msgs 
     
    Crossing page boundary -- ensure page bits are set.

     
     
    pagesel manipl2
    call manipl2
    bsf PCLATH,3
     


    How are you dividing your code amongst the pages?
    I assume you are using absolute mode, not relocatable mode.
    Which page is that code in
    Which page is the "manipl2" function in?
     
    rather than "bsf PCLATH,3", it's safer to always do "pagesel $"
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    AMPS
    Super Member
    • Total Posts : 501
    • Reward points : 0
    • Status: offline
    Re: Assembly code error. 2020/01/15 23:31:08 (permalink)
    0
    Here is my code 

     
    decp btfsc pfs
    goto outp
    decfsz spur1
    goto decp
    decfsz dbnc1
    goto decp
     

    error
     
     
    post edited by AMPS - 2020/01/16 01:04:32

    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    #9
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/15 23:44:28 (permalink)
    0
    decfsz spur1
    should be
    decfsz spur1,f


    You did not answer all my questions about your page selection code.
    You must not allow your code to run across a page boundary. In absolute mode, use ORG statements to control where the page breaks occur.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #10
    AMPS
    Super Member
    • Total Posts : 501
    • Reward points : 0
    • Status: offline
    Re: Assembly code error. 2020/01/15 23:57:38 (permalink)
    0
    This how page selected.
    My question is i have project on PIC16F883 working fine. Recently i have changed to PIC16F886. when i changed to 886 i am getting small issue. that code will hang. if i replace with 883 it works fine.since bank selection are almost same . why this difference of hang
     
    In my code i have not change anything expect this line

    LIST P=PIC16F886 ; list directive to define processor
    #include <p16f886.inc> ; processor specific variable definitions

     
    Page setting

    pg800
    ORG 0x800
    bcf PCLATH,4
    bsf PCLATH,3


    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    #11
    AMPS
    Super Member
    • Total Posts : 501
    • Reward points : 0
    • Status: offline
    Re: Assembly code error. 2020/01/16 00:01:47 (permalink)
    0
    can you set an example for absolute mode and  relocatable mode.
    Considering the above method.
     

    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    #12
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/16 03:42:46 (permalink)
    0
    ajitnayak87
    ...
    Page setting

    pg800
    ORG 0x800
    bcf PCLATH,4
    bsf PCLATH,3


    I don't know what you expect that code to do.
    The "pg800" label is before the ORG line, so it will have the address of the next unused address in the PREVIOUS page.
    The first two instructions after the ORG are pointless, as you have to have set those bits already to get to that address.
    What exactly is failing when you change processors?
    Have you tried single stepping the code in the debugger?

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #13
    AMPS
    Super Member
    • Total Posts : 501
    • Reward points : 0
    • Status: offline
    Re: Assembly code error. 2020/01/17 20:39:50 (permalink)
    0
    I have simple question. My project is running on PIC16F883 from last few year . Now i wanted to change over to PIC16F886 . The code written in assembly level.
     
    when i changed the code ,below line only i have changed.i have checked bank they are almost same.but when i change the code pic16f886 . one of my function is not working.my micro-controller hangs after few cycle. if i change back to pic16f883 its will work normally.Is there any suggestion on this.
    LIST P=PIC16F886 ; list directive to define processor
    #include <p16f886.inc> ; processor specific variable definitions

    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    #14
    pcbbc
    Super Member
    • Total Posts : 1507
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: Assembly code error. 2020/01/17 21:04:29 (permalink)
    0
    I have no idea how you expect us to diagnose your problem from that. Obviously the real problem is not in which include file you use but elsewhere in your code.
    1. Answer ric’s questions
    2. Post your entire code
    #15
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/17 21:47:54 (permalink)
    0
    Yup, I am guessing that the code has been bad all along, but for some reason you got away with it on the smaller chip, but now it's tripping you up.
    We cannot guess WHAT you have done if we can't see the code. The snippets you are posting are not the core problem.
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #16
    1and0
    Access is Denied
    • Total Posts : 10346
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Assembly code error. 2020/01/18 01:55:08 (permalink)
    0
    It looks like OP is using absolute mode by using the ORG directive. If the assembly code is written properly, changing it from 16F883 to 16F886 only will assemble to a hex file that is identical. ;)
     
    #17
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/18 02:07:25 (permalink)
    0
    Alternatively, if the PIC16F883 code was setting PCLATH,4 when it shouldn't have, it may have been ignored by the PIC16F883, but not by the 886.
    The datasheet is strangely silent about what happens if you address non-existent code memory on these devices.
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #18
    1and0
    Access is Denied
    • Total Posts : 10346
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Assembly code error. 2020/01/18 02:22:36 (permalink)
    0
    ric
    The datasheet is strangely silent about what happens if you address non-existent code memory on these devices.

    My guess they will execute as opcode 0x3FFF (ADDLW 0xFF) or 0x0000 (NOP).
    #19
    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Assembly code error. 2020/01/18 02:25:19 (permalink)
    0
    or option 3, if the address bit isn't implemented at all, you may get another copy of pages 0 and 1
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5