View previous topic :: View next topic |
Author |
Message |
dmitrboristuk
Joined: 26 Sep 2020 Posts: 66
|
Working with multivector interrupts |
Posted: Sun Mar 09, 2025 7:05 am |
|
|
Hello, are there any built-in functions in the development environment for working with multivector interrupts? I did not find any in 5.115. There is a document from Microchip TB3162 where examples are given for XC8. Is there something similar here? I am interested in working with PIC18F46K42 and PIC18F47Q84 chips. I need functions for working with IVTBASE, MVECEN, IPR, and also how to use interrupt routine identifiers #INT_. If possible, I would like to see a code example. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19730
|
|
Posted: Mon Mar 10, 2025 1:56 am |
|
|
99% of PIC18's do not support multi-vector interrupts (except for the high/
This is why it is such a rare thing.
The keyword on the PIC's that do support it is simple:
#DEVICE VECTOR_INTS
This is one of those horrid 'hidden' extras. It was documented in the
CCS News posts.
[url]
https://www.ccsinfo.com/newsdesk_info.php?newsdeskPath=10&newsdesk_id=201
[/url]
With this set, the compiler, instead of generating a global interrupt handler
and then handling polling the interrupt flags to call the routines, generates
an interrupt vector table, enables the vector operation, and populates
the table with the addresses of the interrupt routines.
I think it is only the Q chips, and now some models of the Fx2 family that
have the support for this.
There was a bug with this a long time ago:
[url]
https://www.ccsinfo.com/forum/viewtopic.php?t=57463
[/url]
This was fixed in the next release. |
|
 |
dmitrboristuk
Joined: 26 Sep 2020 Posts: 66
|
|
Posted: Mon Mar 10, 2025 1:10 pm |
|
|
Thank you, Ttelmah. Figured it out. To be honest, I expected to see more opportunities for the user from the multivector interrupt system. For example, recording interrupt processing routines starting with a vector and ending with the command Retfie 1. But here, as in the usual interrupt system, there is saving of many temporary registers, three TBLPTR registers, the TABLAT register. And as a result, the performance does not increase much compared to the old system. It remains only to hope to fix everything using #INT_GLOBAL.
Tell me, what assembler command is written as DATA
Code: |
0003E 0000 00029 DATA 00,00
00040 0069 00030 DATA 69,00
00042 0000 00031 DATA 00,00
|
00040 is 0x08 + 2*0x1C vector number for TMR |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9425 Location: Greensville,Ontario
|
|
Posted: Mon Mar 10, 2025 4:51 pm |
|
|
Another option, is to code your own Interrupt System.
From what I understand, the CCS approach saves 'lots of stuff' because you might need it.
Providing you KNOW what YOU need to save and use, you might be able to trim some time and/or code space BUT that could be risky. |
|
 |
dmitrboristuk
Joined: 26 Sep 2020 Posts: 66
|
|
Posted: Tue Mar 11, 2025 12:18 am |
|
|
Temtronic, it is not that easy to do. To enable MVECEN you need to use #device VECTOR_INTS, you can't set it via #FUSES. Secondly, it is not possible to create a subroutine without the #INT identifier at address 0x08. When using #INT_GLOBAL, the first three vectors are already occupied by commands (GOTO 108 (which leads nowhere), MOVLB0, ... the last line is occupied by the Retfie 0 command, despite the fact that there should be a jump address along the vector!) |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9425 Location: Greensville,Ontario
|
|
Posted: Tue Mar 11, 2025 5:47 am |
|
|
'not easy' ? Microchip wrote code in XC8( yes, I have the PDF...) CCS wrote their Interrupt 'controller'.( 'all purpose' ).. so you can write your own.
I know in the past, others have 'trimmed down' the CCS version for their specific needs so it can be done.
Why not take the XC8 code , convert to CCS C ? |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19730
|
|
Posted: Tue Mar 11, 2025 10:13 am |
|
|
Use the vector interrupt setting.
Then on the interrupt you want to service quickly, declare it as FAST.
Then add your own saving routines for the registers you use. |
|
 |
|