Split from: Where is the Interrupt Vector Table

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you give us an example? I'm having exactly the same problem with an AT90CAN in MPLABX. I tried this...

ISR(TIM1_CAPT)
{
    Period++;   // arbitrary test code, just to give it something to build
}

 

and it moaned...

"/Applications/microchip/xc8/v2.05/bin/xc8-cc"  -mcpu=AT90CAN32 -c  -x c -D__AT90CAN32__   -Wl,--gc-sections -O0 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -funsigned-char -funsigned-bitfields -I"../../../../../../../Applications/microchip/xc8/v2.05/avr/avr/include/avr" -Wall -DXPRJ_default=default    -gdwarf-3     -MD -MP -MF "build/default/production/TranslateSensors.o.d" -MT "build/default/production/TranslateSensors.o.d" -MT build/default/production/TranslateSensors.o -o build/default/production/TranslateSensors.o TranslateSensors.c
TranslateSensors.c: In function 'TIM1_CAPT':
In file included from TranslateSensors.c:15:0:
TranslateSensors.c:76:5: warning: 'TIM1_CAPT' appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]
 ISR(TIM1_CAPT)
     ^

 

I'd rather have a bottle in front of me, than a frontal lobotomy.

Last Edited: Thu. Jun 13, 2019 - 09:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KungFuAndy wrote:
I'm having exactly the same problem with an AT90CAN in MPLABX.

What toolchain are you using?  the ISR() syntax maybe different for a toolchain other then GCC.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
https://www.onegold.com/join/7134f67c2b814c5ca8144a458eccfd61

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jim, I'm using xc8.

I'd rather have a bottle in front of me, than a frontal lobotomy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's the vector table from iocan32.h:

/* Interrupt vectors */

/* External Interrupt Request 0 */
#define INT0_vect_num		1
#define INT0_vect			_VECTOR(1)
#define SIG_INTERRUPT0			_VECTOR(1)

/* External Interrupt Request 1 */
#define INT1_vect_num		2
#define INT1_vect			_VECTOR(2)
#define SIG_INTERRUPT1			_VECTOR(2)

/* External Interrupt Request 2 */
#define INT2_vect_num		3
#define INT2_vect			_VECTOR(3)
#define SIG_INTERRUPT2			_VECTOR(3)

/* External Interrupt Request 3 */
#define INT3_vect_num		4
#define INT3_vect			_VECTOR(4)
#define SIG_INTERRUPT3			_VECTOR(4)

/* External Interrupt Request 4 */
#define INT4_vect_num		5
#define INT4_vect			_VECTOR(5)
#define SIG_INTERRUPT4			_VECTOR(5)

/* External Interrupt Request 5 */
#define INT5_vect_num		6
#define INT5_vect			_VECTOR(6)
#define SIG_INTERRUPT5			_VECTOR(6)

/* External Interrupt Request 6 */
#define INT6_vect_num		7
#define INT6_vect			_VECTOR(7)
#define SIG_INTERRUPT6			_VECTOR(7)

/* External Interrupt Request 7 */
#define INT7_vect_num		8
#define INT7_vect			_VECTOR(8)
#define SIG_INTERRUPT7			_VECTOR(8)

/* Timer/Counter2 Compare Match */
#define TIMER2_COMP_vect_num	9
#define TIMER2_COMP_vect		_VECTOR(9)
#define SIG_OUTPUT_COMPARE2		_VECTOR(9)

/* Timer/Counter2 Overflow */
#define TIMER2_OVF_vect_num		10
#define TIMER2_OVF_vect			_VECTOR(10)
#define SIG_OVERFLOW2			_VECTOR(10)

/* Timer/Counter1 Capture Event */
#define TIMER1_CAPT_vect_num	11
#define TIMER1_CAPT_vect		_VECTOR(11)
#define SIG_INPUT_CAPTURE1		_VECTOR(11)

/* Timer/Counter1 Compare Match A */
#define TIMER1_COMPA_vect_num	12
#define TIMER1_COMPA_vect		_VECTOR(12)
#define SIG_OUTPUT_COMPARE1A		_VECTOR(12)

/* Timer/Counter Compare Match B */
#define TIMER1_COMPB_vect_num	13
#define TIMER1_COMPB_vect		_VECTOR(13)
#define SIG_OUTPUT_COMPARE1B		_VECTOR(13)

/* Timer/Counter1 Compare Match C */
#define TIMER1_COMPC_vect_num	14
#define TIMER1_COMPC_vect		_VECTOR(14)
#define SIG_OUTPUT_COMPARE1C		_VECTOR(14)

/* Timer/Counter1 Overflow */
#define TIMER1_OVF_vect_num		15
#define TIMER1_OVF_vect			_VECTOR(15)
#define SIG_OVERFLOW1			_VECTOR(15)

/* Timer/Counter0 Compare Match */
#define TIMER0_COMP_vect_num	16
#define TIMER0_COMP_vect		_VECTOR(16)
#define SIG_OUTPUT_COMPARE0		_VECTOR(16)

/* Timer/Counter0 Overflow */
#define TIMER0_OVF_vect_num		17
#define TIMER0_OVF_vect			_VECTOR(17)
#define SIG_OVERFLOW0			_VECTOR(17)

/* CAN Transfer Complete or Error */
#define CANIT_vect_num		18
#define CANIT_vect			_VECTOR(18)
#define SIG_CAN_INTERRUPT1		_VECTOR(18)

/* CAN Timer Overrun */
#define OVRIT_vect_num		19
#define OVRIT_vect			_VECTOR(19)
#define SIG_CAN_OVERFLOW1		_VECTOR(19)

/* SPI Serial Transfer Complete */
#define SPI_STC_vect_num		20
#define SPI_STC_vect			_VECTOR(20)
#define SIG_SPI				_VECTOR(20)

/* USART0, Rx Complete */
#define USART0_RX_vect_num		21
#define USART0_RX_vect			_VECTOR(21)
#define SIG_UART0_RECV			_VECTOR(21)
#define SIG_USART0_RECV			_VECTOR(21)

/* USART0 Data Register Empty */
#define USART0_UDRE_vect_num	22
#define USART0_UDRE_vect		_VECTOR(22)
#define SIG_UART0_DATA			_VECTOR(22)
#define SIG_USART0_DATA			_VECTOR(22)

/* USART0, Tx Complete */
#define USART0_TX_vect_num		23
#define USART0_TX_vect			_VECTOR(23)
#define SIG_UART0_TRANS			_VECTOR(23)
#define SIG_USART0_TRANS		_VECTOR(23)

/* Analog Comparator */
#define ANALOG_COMP_vect_num	24
#define ANALOG_COMP_vect		_VECTOR(24)
#define SIG_COMPARATOR			_VECTOR(24)

/* ADC Conversion Complete */
#define ADC_vect_num		25
#define ADC_vect			_VECTOR(25)
#define SIG_ADC				_VECTOR(25)

/* EEPROM Ready */
#define EE_READY_vect_num		26
#define EE_READY_vect			_VECTOR(26)
#define SIG_EEPROM_READY		_VECTOR(26)

/* Timer/Counter3 Capture Event */
#define TIMER3_CAPT_vect_num	27
#define TIMER3_CAPT_vect		_VECTOR(27)
#define SIG_INPUT_CAPTURE3		_VECTOR(27)

/* Timer/Counter3 Compare Match A */
#define TIMER3_COMPA_vect_num	28
#define TIMER3_COMPA_vect		_VECTOR(28)
#define SIG_OUTPUT_COMPARE3A		_VECTOR(28)

/* Timer/Counter3 Compare Match B */
#define TIMER3_COMPB_vect_num	29
#define TIMER3_COMPB_vect		_VECTOR(29)
#define SIG_OUTPUT_COMPARE3B		_VECTOR(29)

/* Timer/Counter3 Compare Match C */
#define TIMER3_COMPC_vect_num	30
#define TIMER3_COMPC_vect		_VECTOR(30)
#define SIG_OUTPUT_COMPARE3C		_VECTOR(30)

/* Timer/Counter3 Overflow */
#define TIMER3_OVF_vect_num		31
#define TIMER3_OVF_vect			_VECTOR(31)
#define SIG_OVERFLOW3			_VECTOR(31)

/* USART1, Rx Complete */
#define USART1_RX_vect_num		32
#define USART1_RX_vect			_VECTOR(32)
#define SIG_UART1_RECV			_VECTOR(32)
#define SIG_USART1_RECV			_VECTOR(32)

/* USART1, Data Register Empty */
#define USART1_UDRE_vect_num	33
#define USART1_UDRE_vect		_VECTOR(33)
#define SIG_UART1_DATA			_VECTOR(33)
#define SIG_USART1_DATA			_VECTOR(33)

/* USART1, Tx Complete */
#define USART1_TX_vect_num		34
#define USART1_TX_vect			_VECTOR(34)
#define SIG_UART1_TRANS			_VECTOR(34)
#define SIG_USART1_TRANS		_VECTOR(34)

/* 2-wire Serial Interface */
#define TWI_vect_num		35
#define TWI_vect			_VECTOR(35)
#define SIG_2WIRE_SERIAL		_VECTOR(35)

/* Store Program Memory Read */
#define SPM_READY_vect_num		36
#define SPM_READY_vect			_VECTOR(36)
#define SIG_SPM_READY			_VECTOR(36)

#define _VECTORS_SIZE 148

So, you want TIMER1_CAPT_vect as your ISR specifier...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thanks. That solved my problem.

I'd rather have a bottle in front of me, than a frontal lobotomy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


BTW there is a user manual:

 

https://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html

 

That has one humungous great table which tries to name all the "_vect" for all the AVRs. Personally I find it close to unusable as you would have to search the page for CAN32

 

 

But it could work I suppose?

 

Personally I just do a slightly cosmetic version of what Morten did:

C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr>grep _VECT iocanxx.h | grep _vect
#define INT0_vect                       _VECTOR(1)
#define INT1_vect                       _VECTOR(2)
#define INT2_vect                       _VECTOR(3)
#define INT3_vect                       _VECTOR(4)
#define INT4_vect                       _VECTOR(5)
#define INT5_vect                       _VECTOR(6)
#define INT6_vect                       _VECTOR(7)
#define INT7_vect                       _VECTOR(8)
#define TIMER2_COMP_vect                _VECTOR(9)
#define TIMER2_OVF_vect                 _VECTOR(10)
#define TIMER1_CAPT_vect                _VECTOR(11)
#define TIMER1_COMPA_vect               _VECTOR(12)
#define TIMER1_COMPB_vect               _VECTOR(13)
#define TIMER1_COMPC_vect               _VECTOR(14)
#define TIMER1_OVF_vect                 _VECTOR(15)
#define TIMER0_COMP_vect                _VECTOR(16)
#define TIMER0_OVF_vect                 _VECTOR(17)
#define CANIT_vect                      _VECTOR(18)
#define OVRIT_vect                      _VECTOR(19)
#define SPI_STC_vect                    _VECTOR(20)
#define USART0_RX_vect                  _VECTOR(21)
#define USART0_UDRE_vect                _VECTOR(22)
#define USART0_TX_vect                  _VECTOR(23)
#define ANALOG_COMP_vect                _VECTOR(24)
#define ADC_vect                        _VECTOR(25)
#define EE_READY_vect                   _VECTOR(26)
#define TIMER3_CAPT_vect                _VECTOR(27)
#define TIMER3_COMPA_vect               _VECTOR(28)
#define TIMER3_COMPB_vect               _VECTOR(29)
#define TIMER3_COMPC_vect               _VECTOR(30)
#define TIMER3_OVF_vect                 _VECTOR(31)
#define USART1_RX_vect                  _VECTOR(32)
#define USART1_UDRE_vect                _VECTOR(33)
#define USART1_TX_vect                  _VECTOR(34)
#define TWI_vect                        _VECTOR(35)
#define SPM_READY_vect                  _VECTOR(36)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, just when I thought I was done with this problem, I've hit another one to do with the interrupts.

 

The file that has the isr in it has an include at the top for "../avr/interrupt.h". There is a yellow exclamation mark against this, which says "There are unresolved includes inside ../avr/interrupt.h". When I open up the interrupt header file there is a red exclamation mark against the #include <avr/io.h> and it says it cannot find this. The io.h file is in the same location as the interrupt.h. If I delete the <avr/io.h> and try adding it again, it prompts me with a list of files I could include, so I select the io.h and this results in #include "io.h", with a red exclamation mark beside it, saying it cannot locate it!!!

 

Any ideas?

 

Actually, there are two problems here: 1. It can't find <avr/io.h>  2. The body of the isr has a load of red exclamation marks, which, when you hover the cursor over them, say "unexpected token: __attribute__". This is something in avr's macro.

I'd rather have a bottle in front of me, than a frontal lobotomy.

Last Edited: Sun. Jun 16, 2019 - 03:50 PM