keithdoxey
- 18th May 2016, 22:47
Hi All.
Between 2001 and 2009 I did an awful lot of PBP programming and wrote many programs however one thing I didnt use was DT Instant Interrupts.
I returned to Pic Basic programming in late 2014. At that time I upgraded to PBP3 as I needed support for newer more powerful processors. The other day I tried to add Instant Interrupts to a fairly complex program I am working on and it just likked it dead. I decided to go for the basic principles first and have tried to do the Hello World, Blinky and Elapsed Timer demos to no avail.
I have tried using DT-INTS-18 with an 18F452 and DT-INTS-14 with a 16F877.
With the 18F452 I can get the program below to compile and my LED2 in the main loop will toggle every second (just as a heartbeat so that I know the program is running) but ONLY if I comment out the line @ INT_ENABLE TMR1_INT. If that line is uncommented it just seems to crash, I dont get my LED2 flashing once a second and the LED1 that is supposed to be toggled by the timer interrupt does nothing either.
'************************************************* ***************
'* Name : Instant Interrupts Test.BAS *
'* Author : Keith Doxey *
'* Notice : Copyright (c) 2016 Indigo Electronics *
'* : All Rights Reserved *
'* Date : 05/05/2016 *
'* Version : 1.0 18F452 *
'* : *
'************************************************* ***************
;----[18F452 Hardware Configuration]--------------------------------------------
#IF __PROCESSOR__ = "18F452"
#DEFINE MCU_FOUND 1
#CONFIG
CONFIG OSC = HS ; HS oscillator
CONFIG OSCS = OFF ; Oscillator system clock switch option is disabled (main oscillator is source)
CONFIG PWRT = OFF ; PWRT disabled
CONFIG BOR = ON ; Brown-out Reset enabled
CONFIG BORV = 20 ; VBOR set to 2.0V
CONFIG WDT = ON ; WDT enabled
CONFIG WDTPS = 128 ; 1:128
CONFIG CCP2MUX = ON ; CCP2 input/output is multiplexed with RC1
CONFIG STVR = ON ; Stack Full/Underflow will cause RESET
CONFIG LVP = OFF ; Low Voltage ICSP disabled
CONFIG DEBUG = OFF ; Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
CONFIG CP0 = OFF ; Block 0 (000200-001FFFh) not code protected
CONFIG CP1 = OFF ; Block 1 (002000-003FFFh) not code protected
CONFIG CP2 = OFF ; Block 2 (004000-005FFFh) not code protected
CONFIG CP3 = OFF ; Block 3 (006000-007FFFh) not code protected
CONFIG CPB = OFF ; Boot Block (000000-0001FFh) not code protected
CONFIG CPD = OFF ; Data EEPROM not code protected
CONFIG WRT0 = OFF ; Block 0 (000200-001FFFh) not write protected
CONFIG WRT1 = OFF ; Block 1 (002000-003FFFh) not write protected
CONFIG WRT2 = OFF ; Block 2 (004000-005FFFh) not write protected
CONFIG WRT3 = OFF ; Block 3 (006000-007FFFh) not write protected
CONFIG WRTC = OFF ; Configuration registers (300000-3000FFh) not write protected
CONFIG WRTB = OFF ; Boot Block (000000-0001FFh) not write protected
CONFIG WRTD = OFF ; Data EEPROM not write protected
CONFIG EBTR0 = OFF ; Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTR1 = OFF ; Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTR2 = OFF ; Block 2 (004000-005FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTR3 = OFF ; Block 3 (006000-007FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTRB = OFF ; Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks
#ENDCONFIG
#ENDIF
;----[Verify Configs have been specified for Selected Processor]----------------
; Note: Only include this routine once, after all #CONFIG blocks
#IFNDEF MCU_FOUND
#ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
#ENDIF
DEFINE OSC 40 ' 40MHZ crystal (10MHz + 4*PLL)
LED1 VAR PORTB.1
LED2 var PORTD.0
INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $31 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main:
PAUSE 1000
toggle LED2
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
I dont know if its because I havent set some things up first or if I have things in the wrong order but I am starting to tear my hair out.
The DT-INTS-14 version with the 16F877 wont even compile. I get the following errors....
ASM Error - Symbol not previously defined (wsave)
ASM Error - Symbol not previously defined (INT_ENTRY)
followed by a whole load more.
I have searched this forum and read many threads and also googled but still cant get it to work
What are the latest version of the DT INT files as all the ones I have found predate the launch of PBP. The 14 files are from a zip file V1.1 and the 18 files I have V3.3 and 3.4 both of which I have tried with the same unsuccessful results.
Sadly Darrel is no longer with us for me to pick his brains so I would be extremely grateful if someone could point me in the correct direction so that I can get everything working. The more I read about Instant Interrupts the more I want to use them.
Thanks in advance
Between 2001 and 2009 I did an awful lot of PBP programming and wrote many programs however one thing I didnt use was DT Instant Interrupts.
I returned to Pic Basic programming in late 2014. At that time I upgraded to PBP3 as I needed support for newer more powerful processors. The other day I tried to add Instant Interrupts to a fairly complex program I am working on and it just likked it dead. I decided to go for the basic principles first and have tried to do the Hello World, Blinky and Elapsed Timer demos to no avail.
I have tried using DT-INTS-18 with an 18F452 and DT-INTS-14 with a 16F877.
With the 18F452 I can get the program below to compile and my LED2 in the main loop will toggle every second (just as a heartbeat so that I know the program is running) but ONLY if I comment out the line @ INT_ENABLE TMR1_INT. If that line is uncommented it just seems to crash, I dont get my LED2 flashing once a second and the LED1 that is supposed to be toggled by the timer interrupt does nothing either.
'************************************************* ***************
'* Name : Instant Interrupts Test.BAS *
'* Author : Keith Doxey *
'* Notice : Copyright (c) 2016 Indigo Electronics *
'* : All Rights Reserved *
'* Date : 05/05/2016 *
'* Version : 1.0 18F452 *
'* : *
'************************************************* ***************
;----[18F452 Hardware Configuration]--------------------------------------------
#IF __PROCESSOR__ = "18F452"
#DEFINE MCU_FOUND 1
#CONFIG
CONFIG OSC = HS ; HS oscillator
CONFIG OSCS = OFF ; Oscillator system clock switch option is disabled (main oscillator is source)
CONFIG PWRT = OFF ; PWRT disabled
CONFIG BOR = ON ; Brown-out Reset enabled
CONFIG BORV = 20 ; VBOR set to 2.0V
CONFIG WDT = ON ; WDT enabled
CONFIG WDTPS = 128 ; 1:128
CONFIG CCP2MUX = ON ; CCP2 input/output is multiplexed with RC1
CONFIG STVR = ON ; Stack Full/Underflow will cause RESET
CONFIG LVP = OFF ; Low Voltage ICSP disabled
CONFIG DEBUG = OFF ; Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
CONFIG CP0 = OFF ; Block 0 (000200-001FFFh) not code protected
CONFIG CP1 = OFF ; Block 1 (002000-003FFFh) not code protected
CONFIG CP2 = OFF ; Block 2 (004000-005FFFh) not code protected
CONFIG CP3 = OFF ; Block 3 (006000-007FFFh) not code protected
CONFIG CPB = OFF ; Boot Block (000000-0001FFh) not code protected
CONFIG CPD = OFF ; Data EEPROM not code protected
CONFIG WRT0 = OFF ; Block 0 (000200-001FFFh) not write protected
CONFIG WRT1 = OFF ; Block 1 (002000-003FFFh) not write protected
CONFIG WRT2 = OFF ; Block 2 (004000-005FFFh) not write protected
CONFIG WRT3 = OFF ; Block 3 (006000-007FFFh) not write protected
CONFIG WRTC = OFF ; Configuration registers (300000-3000FFh) not write protected
CONFIG WRTB = OFF ; Boot Block (000000-0001FFh) not write protected
CONFIG WRTD = OFF ; Data EEPROM not write protected
CONFIG EBTR0 = OFF ; Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTR1 = OFF ; Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTR2 = OFF ; Block 2 (004000-005FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTR3 = OFF ; Block 3 (006000-007FFFh) not protected from Table Reads executed in other blocks
CONFIG EBTRB = OFF ; Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks
#ENDCONFIG
#ENDIF
;----[Verify Configs have been specified for Selected Processor]----------------
; Note: Only include this routine once, after all #CONFIG blocks
#IFNDEF MCU_FOUND
#ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
#ENDIF
DEFINE OSC 40 ' 40MHZ crystal (10MHz + 4*PLL)
LED1 VAR PORTB.1
LED2 var PORTD.0
INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $31 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main:
PAUSE 1000
toggle LED2
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
I dont know if its because I havent set some things up first or if I have things in the wrong order but I am starting to tear my hair out.
The DT-INTS-14 version with the 16F877 wont even compile. I get the following errors....
ASM Error - Symbol not previously defined (wsave)
ASM Error - Symbol not previously defined (INT_ENTRY)
followed by a whole load more.
I have searched this forum and read many threads and also googled but still cant get it to work
What are the latest version of the DT INT files as all the ones I have found predate the launch of PBP. The 14 files are from a zip file V1.1 and the 18 files I have V3.3 and 3.4 both of which I have tried with the same unsuccessful results.
Sadly Darrel is no longer with us for me to pick his brains so I would be extremely grateful if someone could point me in the correct direction so that I can get everything working. The more I read about Instant Interrupts the more I want to use them.
Thanks in advance