Hello everyone, and first of all, I really wish everyone who has not donated to donate, so that GCB can exist and develop.
I want to create an external (in my case port RA3 ) interrupt in my program that calls some subroutine. I don't understand, is only the subroutine created by PPS tools enough, or is configuration also required? I tried only a subprogram made with PPS tools, it didn't work for me. I attached only the part of my program that I want to use for interrupt, to understand where my mistake is.
My attached part of the program has both what PPS tools created and the interrupt configuration I think might work. Could someone suggest and fix it?
Your block of code ( shown below ) - not all of it is required.
INTF=0''bit1INTF:INTExternalInterruptFlagbit'1 = The INT external interrupt occurred '0=TheINTexternalinterruptdidnotoccurINTE=1''bit4INTE:INTExternalInterruptEnablebit'1 = Enables the INT external interrupt '0=DisablestheINTexternalinterruptGIE=1''bit7GIE:GlobalInterruptEnablebit''1=Enablesallactiveinterrupts''0=DisablesallinterruptsINTEDG=1' INTEDG: Interrupt Edge Select bit 6 ;; OPTION_REG: OPTION REGISTER_page_245 ''1 = Interrupt on rising edge of INT pin ''0=InterruptonfallingedgeofINTpin
I will explain.
INTF=0 is clearing an event bit. This is completed/cleared automatically by GCBASIC within the interrupt handler.
INTE=1 is setting the specific event. This is set ( = 1) automatically by GCBASIC when you specific the on interrupt ExtInt0 ... .
GIE=1 is setting the Global event handler. This is set ( = 1) automatically by GCBASIC when you specific ANY on interrupt ... .
To see the bits automatically set check the "Interrupts Tab" in PICINFO.
INTEDG=1 is not set by the compiler. So, if you want to change the edge then use this bit.
PICINFO/Interrupts shows the bit managed by GCBASIC.
So, you only need
INTEDG=1' INTEDG: Interrupt Edge Select bit 6 ;; OPTION_REG: OPTION REGISTER_page_245''1 = Interrupt on rising edge of INT pin''0=InterruptonfallingedgeofINTpin
Not for Janis but for everyone who has not donated.
Donate here
Please donate to the operational costs of GCBASIC for the coming year - Thank you.
paypal.me/gcbasic
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone, and first of all, I really wish everyone who has not donated to donate, so that GCB can exist and develop.
I want to create an external (in my case port RA3 ) interrupt in my program that calls some subroutine. I don't understand, is only the subroutine created by PPS tools enough, or is configuration also required? I tried only a subprogram made with PPS tools, it didn't work for me. I attached only the part of my program that I want to use for interrupt, to understand where my mistake is.
My attached part of the program has both what PPS tools created and the interrupt configuration I think might work. Could someone suggest and fix it?
Great question.
Your block of code ( shown below ) - not all of it is required.
I will explain.
INTF=0
is clearing an event bit. This is completed/cleared automatically by GCBASIC within the interrupt handler.INTE=1
is setting the specific event. This is set ( = 1) automatically by GCBASIC when you specific theon interrupt ExtInt0 ...
.GIE=1
is setting the Global event handler. This is set ( = 1) automatically by GCBASIC when you specific ANYon interrupt ...
.To see the bits automatically set check the "Interrupts Tab" in PICINFO.
INTEDG=1
is not set by the compiler. So, if you want to change the edge then use this bit.PICINFO/Interrupts shows the bit managed by GCBASIC.
So, you only need
Not for Janis but for everyone who has not donated.
Donate here
Please donate to the operational costs of GCBASIC for the coming year - Thank you.
paypal.me/gcbasic