Shift Function gives MPASM error


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    6

    Default Shift Function gives MPASM error

    I have a PIC18F2520 project which uses shift operators.

    e.g. B1 = B1 << 5
    (B1 is a byte variable)

    When it compiles, MPASM produces the following error result:

    ERROR[126] f:\pbp26\pbppic18.lib 662: Argument out of range (16388 not between 0 and 16383)

    If I comment out the shift function, the project compiles/assembles without error. Any shift function produces a similar error.

    I have to use MPASM so how can I perform a shift function.

    I am using PBP2.6a and MPASM v5.37.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    It would help if you would show your whole code.
    What is the value of B1?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2010
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    The value of B1 does not seem to affect the error message. I have tried forcing B1 to 1, 40 and 255 and the error message is the same.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This compiles fine here
    Code:
     
    B1  var BYTE 
    B1 = 255
    B1 = B1 << 5
    So the problem is someplace else.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2010
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I have just found that if I comment out the following include files, the shift function in the main program compiles/assembles without error.

    With the shift function omitted and these files included, the program compiles/assembles without error and runs perfectly so somehow one of them is affecting MPASM and shift functions.

    'INCLUDE "DT_INTS-18.bas"
    'INCLUDE "ReEnterPBP-18.bas"
    'INCLUDE "NewRXbuff.inc"

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What is
    'INCLUDE "NewRXbuff.inc"

    The other two if unchanged are good files.
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts