Page 1 of 1
Custom interrupts PICmicro question
Posted: Tue May 13, 2014 9:11 pm
by Ras
So I need to create a custom interrupt to set the CCP1 to generate a frequency of my choice. I add the INT symbol then right click to Properties then of to learn some more on how to do it. Great so far!
The custom interrupts examples accessed by pressing ? and following trough to PICmicro custom interrupts shows a Custom interrupt properties window with a grayed out box titled Disable Code:
Clearly this code is to disable the interrupt but I can not find where it's used nor how to enter the custom code.
Can you please clarify the purpose of this box and the code entered there?
Re: Custom interrupts PICmicro question
Posted: Tue May 13, 2014 10:34 pm
by Kenrix2
That was a bit confusing to me at first too. First, make your custom enable interrupt, then add another interrupt icon but select disable. Select the Custom interrupt name in the drop down box after pressing Properties.. . You can now enter your disable code. I am not sure from your question if you were asking what to put in the disable box, but it is usually just clearing the pie(X) bit you used to enable it (set it to 1). As to your application, I accidentally stumbled across another way to generate custom frequencies while working on a synchronous serial master slave project. Perhaps you will find it useful. It is 16 bit resolution and no interrupts required.
Re: Custom interrupts PICmicro question
Posted: Wed May 14, 2014 4:20 pm
by Ras
That worked thanks... I actually found that you do not need to add another interrupt but instead from the Properties:Interrupt window just select the Disable interrupt radio button instead of the Enable interrupt, then pressing the Properties button opens the Custom interrupt properties with the Disable code part available for editing.
This worked for me although on one occasion the Enable code and the Handler code did not show (grayed out and blank) and after editing the Disable code and attempting to OK, it gave an error asking for all parts to be filled in. I tried to re-create this but could not.
I understand that this allows one to enable (by adding the custom interrupt with the Enable interrupt radio button selected) or disable the interrupt (by adding the custom interrupt with the Disable interrupt radio button selected) at will anywhere desired.
I am attaching a JPG just to show how to access the Disable code part... was right there under my eyes.
I'll check the example shortly, tks