DT Instant Interrupt counting


Closed Thread
Results 1 to 13 of 13
  1. #1

    Default DT Instant Interrupt counting

    I am trying to use 16f689 to count the number of events ocurring on RA2. Since I don't know when the "events" will occur, I need to use interrupts. I think Darrel Taylor's Instant Interrupts will be perfect for this. While trying to compile the code below, I get the following error message:

    ERROR: Variable wsave3 position request 416 beyond RAM_END 367.


    @ DEVICE pic16f689,wdt_off
    TRISC = %00000000
    TRISA = %000100
    TRISB = %0000

    Include "modedefs.bas"
    INCLUDE "DT_INTS-14.bas" 'Darrel Taylor's instant interrupts
    INCLUDE "ReEnterPBP.bas" 'Darrel Taylor's re-entry for PBP routines

    GIE VAR INTCON.7 'GLOBAL INTERRUPTS ENABLE
    PEIE VAR INTCON.6 'PERIPHERAL INTERRUPT ENABLE
    INTE VAR INTCON.4 'RA2/INT EXTERNAL INTERRUPT ENANBLE
    INTF VAR INTCON.1 'RA2INT FLAG BIT

    B VAR PORTA.2

    VALUE VAR WORD
    VALUE=0

    '***** SETUP INTERRUPTS *****
    GIE=1 'ENABLE GLOBAL INTS
    PEIE=1 'ENABLE PERIPHERAL INTS
    INTE=1 'ENABLE RA2 EXTERNAL INTS

    Define LCD_DREG PORTC 'Set LCD data port
    DEFINE LCD_DBIT 0 'Set LCD starting data bit
    DEFINE LCD_RSREG PORTC 'Set LCD register select port
    DEFINE LCD_RSBIT 4 'Set LCD register select bit
    DEFINE LCD_EREG PORTC 'Set LCD enable port
    DEFINE LCD_EBIT 5 'Set LCD enable bit
    DEFINE LCD_BITS 4 'Set LCD bus size
    DEFINE LCD_LINES 2 'Set LCD number of lines

    '**** INITIALISE INSTANT INTERRUPTS ***********
    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler INT_INT, _ROUTINE, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    @ INT_ENABLE INT_INT ;Enable external interrupts

    '****** MAIN PROGRAM ********************************************
    '============== INTERRUPT ROUTINE ==============================
    ROUTINE:

    VALUE = VALUE+1
    IF VALUE < 1000 THEN GOTO ROUTINE

    GOSUB LCD

    @ INT_RETURN
    '================================================= =========================
    LCD:
    lcdout $FE,1,DEC VALUE 'SHOW VALUE ON DISPLAY
    RETURN
    '================================================= =========================

    END

    Can someone help, please? Thank you!

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jderson View Post
    ERROR: Variable wsave3 position request 416 beyond RAM_END 367.



    Can someone help, please? Thank you!
    I will try, not every chip has that address available. Open Darrels code and insert a semicolon just before the call to WSAVE3, he gives you instructions in the comments above that.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thanks Joe. I commented out the offending line, and also the "T" line in the "Reenter" program. It now tries to assemble, but comes back saying "unknown processor 16f689". I removed the line at the top of my program about the WDT, but it still does the same thing. How does it know I'm using a 16f689?

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jderson View Post
    Thanks Joe. I commented out the offending line, and also the "T" line in the "Reenter" program. It now tries to assemble, but comes back saying "unknown processor 16f689". I removed the line at the top of my program about the WDT, but it still does the same thing. How does it know I'm using a 16f689?
    Because you selected that processor in Microcode Studio, up at the top. When it compiles it includes the appropriate files for that processor. Oh and this too @ DEVICE pic16f689,wdt_off,
    Note: you must use the MPASM assembler with Darrel's includes.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I removed the @DEVICE line, and I have MPASM enabled. It is MPASM that is generating the errors. I think the problem has to do with where all of the various components are located, relative to one another. (MPASM can't find the P16F689.INC file) I'm still reading.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Try this for your config statement:
    @__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF & _BODEN_OFF
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Thanks for trying Joe, but that didn't do it. I think there's something fundamentally wrong, as the compiler doesn't know about 16f689.

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jderson View Post
    Thanks for trying Joe, but that didn't do it. I think there's something fundamentally wrong, as the compiler doesn't know about 16f689.
    I don.t know what version you are using, look into your PBP directory and see if you have a file16F689.inc, also see if the code compiles with a similar chip. OK here is the data sheet:http://ww1.microchip.com/downloads/e...Doc/41262B.pdf
    Last edited by Archangel; - 9th March 2008 at 19:21.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9


    Did you find this post helpful? Yes | No

    Default

    Yes, the file is there. And I already have 2 copies of the data sheet, thank you!
    Here are the first three error messages:

    Error [132]c:\pbp\16f689.inc 20: Unknown processor (16f689)
    Message [301] c:\progra~1\mecani~\mcs\p16f689.inc 32: MESSAGE: (Processor header file mismatch. Verify selected processor.)
    Error [131]c:\pbp\16f689.inc 22: Processor type is undefined.

    Many more errors.

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    PBP version?
    MPLAB version?
    MCS version?

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


    Did you find this post helpful? Yes | No

    Default

    If you have installed the latest version of MPLAB,
    the MPASM files should be located in the C:\program files\microchip\mpasm suite folder.

    Sometimes the Find Automatically button doesn't find the correct folder.

    In MCS, go to the View | Compile and Program Options | Assembler Tab

    Click the Find Manually ... button and point it to
    C:\program files\microchip\mpasm suite

    Then check the Use MPASM checkbox.
    DT

  12. #12


    Did you find this post helpful? Yes | No

    Default

    PBP v 2.50A
    MPASM v 02.15
    MCS v 3.0.0.5

  13. #13


    Did you find this post helpful? Yes | No

    Default

    Darrel- Thank you, that fixed the compiling problem!

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Ping Darrel Taylor - Timer0 Instant Interrupt
    By JEC in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th January 2007, 11:20
  4. Replies: 1
    Last Post: - 2nd November 2006, 23:24
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 1

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