4 Bit LCD issue with interrupts


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default I did not understand why ?

    Quote Originally Posted by Darrel Taylor View Post
    Using BANKSEL or setting the bank manually does not update the PREV_BANK variable, so PBP can get lost from not knowing which bank it's really in.
    Clear as MUD.
    Thanks for the explanation.

    Using CHK?RP messes with the PREV_BANK variable. So if I use Banksel in my ASM routine (not within the main body of the program but ISR) would there be any problem ? If yes, then why ? Context is being restored automatically either through the shadow registers for High Priority or through your program if LP is used.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sougata View Post
    ... So if I use Banksel in my ASM routine (not within the main body of the program but ISR) would there be any problem ? If yes, then why ? Context is being restored automatically either through the shadow registers for High Priority or through your program if LP is used.
    Context/Shadow registers will ensure that when it returns from the interrupt ... those 3 register sets will have the same contents in them.

    But if values get written to the wrong BANK somewhere within the ISR, shadow registers can't help.

    It's especially important to maintain the proper PREV_BANK when using ASM in the Main program, since there are no Shadow registers to get everything back to normal when it's finished.

    And ALL ASM routines in the Main program that use any PBP macros like CHK?RP, RST?RP, MOVE?xx with other bank switching methods, should end with ...
    Code:
    ; for 16F's ...
      clrf  STATUS
    PREV_BANK = 0
    
    ; for 18F's
      clrf BSR
    PREV_BANK = 0
    Which resets PBP's banking system in preparation for the next statement.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Sougata,
    Just curious, are you using PBP 2.6 ?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default No, not yet

    Hi,

    No not yet.
    Regards

    Sougata

Similar Threads

  1. Quadrature encoder and ASM Interrupts. questions..
    By godfodder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th March 2013, 15:45
  2. first project, and yes, doesn`t work
    By bogdan in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 28th April 2009, 07:13
  3. Migrating from PIC16F690 to PIC18F4525 and having LCD issues
    By jblackann in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th June 2008, 21:05
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  5. 4 Bit Lcd Hookup
    By GEEZER in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th May 2005, 01:14

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