Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Darrel,

    I Ported it to MCS ...

    ERROR : MACRO BUFFER OVERFLOW ...

    Which looks sililar to the error MPASM raised.

    ??????????

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Lightbulb

    HI,Darrel,

    a special character compiler do not like ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    I Ported it to MCS ...

    ERROR : MACRO BUFFER OVERFLOW ...
    That error only happens when compiling with PM.
    Switch to MPASM for an 18F452.

    Normally it will warn you when compiling 18F programs with PM.exe. But I think the macro overflow causes too many errors before it gets to that warning, so you don't see it in MCS.
    <br>
    DT

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    That error only happens when compiling with PM.
    Switch to MPASM for an 18F452.

    Normally it will warn you when compiling 18F programs with PM.exe. But I think the macro overflow causes too many errors before it gets to that warning, so you don't see it in MCS.
    <br>
    Ooooops, sorry.

    Compiled fine in MCS ...

    Great mistery ... for sure !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Unhappy

    Hi,

    Result is the same with " T-Elapsed_18" ... straight out of the Package ...

    Executing: "C:\Program Files\Microchip\MPLAB IDE\PBP\PBPMPLAB.BAT" -ampasmwin -k# -p18F452 "T_Elapsed-18.bas"
    Executing: "C:\Program Files\Microchip\MPLAB IDE\PBP\PBPW.EXE" -ampasmwin -k# -p18F452 "T_Elapsed-18.bas"
    PICBASIC PRO(TM) Compiler 2.60, (c) 1998, 2009 microEngineering Labs, Inc.
    All Rights Reserved.

    ERROR: Unable to execute mpasmwin.Message[301] C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PBP\18F452.INC 23 : MESSAGE: ( PENSEZ à INDIQUER la BONNE CONFIGURATION ... )
    Message[301] C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PBP\18F452.INC 24 : MESSAGE: ( PENSEZ à INDIQUER la BONNE CONFIGURATION ... )
    Error[116] C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\T_ELAPSED-18.ASM 609 : Address label duplicated or different in second pass (Z00022)
    Error[116] C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\T_ELAPSED-18.ASM 672 : Address label duplicated or different in second pass (Z00023)
    Error[116] C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\T_ELAPSED-18.ASM 725 : Address label duplicated or different in second pass (Z00024)
    Error[116] C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\T_ELAPSED-18.ASM 756 : Address label duplicated or different in second pass (Z00025)
    Halting build on first failure as requested.
    BUILD FAILED: Fri Aug 21 12:08:46 2009
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Lightbulb

    Strange thing ...

    DT 14 bits interrupts Examples Compile fine ( With MPLAB ), but NOT 16 bits interrupts Examples ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    No wonder I don't like MPLAB.

    The problem seems to have something to do with the -k# command line option. (new option for pbp2.60)
    If I use the same batch file that MPLAB uses ... PBPMPLAB.BAT
    Then this command gives me the same errors you reported.
    c:\PIC\PBP260\PBPMPLAB.BAT -ampasmwin -k# -p18F452 "Tracteur.bas"
    If I remove the -k# option it compiles fine.

    I haven't found a way to remove it from within MPLAB.
    And I think if you did, you wouldn't be able to debug in MPLAB.

    Added: In the PBP manual it only shows -k- and -k+. -k# doesn't even seem to be a valid option.
    Not that it matters much, because it fails with either -k- or -k+ too.
    Last edited by Darrel Taylor; - 22nd August 2009 at 02:15. Reason: -k+-
    DT

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


    Did you find this post helpful? Yes | No

    Lightbulb Oh ok!

    I see exactly what's happening now.
    This is one for meLabs to solve.

    In an attempt to produce the COFF information for debugging with MPLAB, ... PBP with the -k option places Z????? Labels on every line of code ... including the "ASM" or @ lines.

    If the program has any ASM macros in it (like DT_INTS), you can normally jump in and out of ASM anytime you need to within that macro.

    But with it putting labels at the "ASM" statements, ... when those macros get used (more than once) it duplicates labels that were not in the original program.

    For instance with this macro ...
    Code:
    ASM
    MyMacro  macro
       ; asm statements here
      ENDASM
       ; PBP statements here
      ASM  ; This statement creates a label in the middle of a macro.
      endm
    ENDASM
    
    @ MyMacro  ; The first time it's used is OK
    @ MyMacro  ; the second time or more duplicates that label
    I'll send a report to support at melabs.com
    DT

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Unhappy

    Quote Originally Posted by Darrel Taylor View Post

    If I remove the -k# option it compiles fine.

    .
    Hi darrel ...

    YES ... but BUILD fails ... no HEX generated, halas.

    Bouhouuuuu ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  10. #10


    Did you find this post helpful? Yes | No

    Unhappy

    I've been wondering what it would take...or if anyone has managed to change the Timereload (External Constant), to a variable that can be altered in the main program...
    Actually, I would like to load this value from eeprom on startup, but I am at a loss for how to go about this short of learning asm...


    ;---Reload Timer1------ (T1 asm interrupt handler)
    ASM
    ReloadTMR1
    MOVE?CT 0, T1CON, TMR1ON ; 1 stop timer
    MOVLW LOW(TimerReload) ; 1 Add TimerReload to the
    ADDWF TMR1L,F ; 1 value in Timer1
    BTFSC STATUS,C ; 1/2
    INCF TMR1H,F ; 1
    MOVLW HIGH(TimerReload) ; 1
    ADDWF TMR1H,F ; 1
    MOVE?CT 1, T1CON, TMR1ON ; 1 start timer
    INT_RETURN
    ENDASM

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Michael Wakileh View Post
    I've been wondering what it would take...or if anyone has managed to change the Timereload (External Constant), to a variable that can be altered in the main program...
    Actually, I would like to load this value from eeprom on startup, but I am at a loss for how to go about this short of learning asm...


    Code:
    ;---Reload Timer1------   (T1 asm interrupt handler)
    ASM
    ReloadTMR1
        MOVE?CT  0, T1CON, TMR1ON     ;  1     stop timer
        MOVLW    LOW(TimerReload)     ;  1     Add TimerReload to the 
        ADDWF    TMR1L,F              ;  1     value in Timer1
        BTFSC    STATUS,C             ;  1/2
        INCF     TMR1H,F              ;  1
        MOVLW    HIGH(TimerReload)    ;  1
        ADDWF    TMR1H,F              ;  1
        MOVE?CT  1, T1CON, TMR1ON     ;  1     start timer
      INT_RETURN
    ENDASM
    I'm sure there are a number of ways to do it, but a direct translation of that routine might look like this ...
    Code:
    TimerReload VAR WORD BANK0
    
    ASM
    ReloadTMR1
        MOVE?CT  0, T1CON, TMR1ON     ;  1     stop timer
        MOVF     _TimerReload,w       ;  1     Add TimerReload to the 
        ADDWF    TMR1L,F              ;  1     value in Timer1
        BTFSC    STATUS,C             ;  1/2
        INCF     TMR1H,F              ;  1
        MOVF     _TimerReload + 1,w   ;  1
        ADDWF    TMR1H,F              ;  1
        MOVE?CT  1, T1CON, TMR1ON     ;  1     start timer
      INT_RETURN
    ENDASM
    Then TimerReload is a PBP word variable.
    You can calculate it or read it from EEPROM as desired.
    DT

  12. #12


    Did you find this post helpful? Yes | No

    Smile IOC handler

    Thanks Darrel! works great!


    I've been experimenting with the interrupt system lately and although its not relevant for my purposes, I noticed something I can't explain...
    I'm guessing it has something to do with the port variables saved...

    I have a pic12f683
    Led1 GPIO.1 toggled by 1Hz Timer1 interrupt (...in my case via external crystal)
    Led2 GPIO.2 toggled by IOC/RB interrupt.
    The RB interrupt also starts or stops the timer...allowing for control of the blinking LED1. This part works however LED2 only turns off briefly when the button is pressed.

    Things work normal if a flag bit is "toggled" and the Leds are controlled in the main program...

    Code:
    RBPortIntPBP:
    'toggle gpio.2
    if T1CON.0 = 0 then
    TOGGLEFLAG = 1              'attempt doing this via main handler
    else
    TOGGLEFLAG = 0
    endif
    pause 300
    @ INT_RETURN


    Can anyone explain, and is there away to do this from within the handler?

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 6

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

Tags for this Thread

Posting Permissions

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