CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Working with multivector interrupts

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dmitrboristuk



Joined: 26 Sep 2020
Posts: 66

View user's profile Send private message

Working with multivector interrupts
PostPosted: Sun Mar 09, 2025 7:05 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Mar 10, 2025 1:56 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Mar 10, 2025 1:10 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Mar 10, 2025 4:51 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 11, 2025 12:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 11, 2025 5:47 am     Reply with quote

'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

View user's profile Send private message

PostPosted: Tue Mar 11, 2025 10:13 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group