strange int behaviour


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi tom,

    The 16F876 has 8K of program space.

    PBP automatically inserts an Interrupt "Stub" for you if the program space is greater than 2K. Why?, I don't know. The "Stub" is identical to what you have at the beginning of "myint", and it's all done before getting to "myint". Then once in "myint" it tries to save them again, but now the registers have been modified. When they get restored after the interrupt, something will have the wrong value, affecting the main PBP program.

    By testing for the code size first you can avoid the problem. Or, since you know the code size is larger than 2K, you can just leave that part out entirely.
    Code:
        IF (CODE_SIZE <= 2)
            movwf   wsave 
            swapf   STATUS,W
            clrf    STATUS
            movwf   ssave
            movf    PCLATH,W
            movwf   psave
        endif
    Last edited by Darrel Taylor; - 15th November 2005 at 09:09.
    DT

Similar Threads

  1. Strange Behaviour - Simple code+DT_INT+16F676
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th February 2010, 18:53
  2. Strange behaviour of my PBP code.
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th August 2009, 20:20
  3. Strange Serout Behaviour
    By bluesmoke in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th August 2009, 04:12
  4. Strange ADC behaviour
    By ruijc in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 12th December 2007, 20:03
  5. Strange behaviour from PIC16F877 on TMR0
    By mikebar in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 19th August 2006, 01:31

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