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!
Bookmarks