Hello!
I want to use one port as an external interrupt. Attached is a simplified part of the code. in this case I want to use porta.2 as interrupt source. I used the PPS tool, but I probably did not enter the correct syntax.
The compiler scolds: Error: Invalid interrupt event: EXTINT2
Please explain where is the my mistake?
RA2 is the default for that chip? and, therefore PPS remapping is not needed.
That was my first thought when I looked at the Datasheet but as I am a tad rusty I chose not to comment. I really do need to clean my work bench and get my dev tools out again.
I have no excuses left and lots of new code to try out.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would also be inclined to include a main loop in the code even if it is empty, just good parctice and it seperates the Initialisaton code from the Subroutines.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks!
I am very sorry for the unnecessary alarm. :)
My mistake was to write EXTINT0, not EXTINT2.
That's all right. The problem was with my test board. Now all works super.
Yes RA.2 is already supposed to be enabled as INT for this chip. then the code is:
#chip16f15325,8#configosc=int#defineLEDPORTa.1dirPORTa.1outdirporta.2inINTF=1''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 ;; OPTION_REG: OPTION REGISTER''1 = Interrupt on rising edge of INT pin''0 = Interrupt on falling edge of INT pinOn interrupt ExtInt0 call BLINKmain:wait 10 msgoto mainsub BLINKif INTF then ''ExternalInterruptFlagbitsetLEDonwait500mssetLEDoffINTF=0endifendsub
But for another PIN, PPS tool is used, which works great.
#chip16f15325,8
#configosc=int
#defineLEDPORTa.1dirPORTa.1outdirporta.4in'Generated by PIC PPS Tool for Great Cow Basic'PPS Tool version: 0.0.6.2'PinManager data: v1.65.2'Generated for 16lf15325''Template comment at the start of the config file' #startup InitPPS, 85 #define PPSToolPart 16lf15325 Sub InitPPS'Module: EXT_INTINTPPS=0x0004'RA4 > INT End Sub'Template comment at the end of the config fileOn interrupt ExtInt0 call BLINKmain:wait 100 msgoto mainsub BLINKset LED onwait 3 sset LED offend sub
But the question is, when do need to write extint1, extint2...etc?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Anobium.
Next time I will try INTE, INTF and GIE, everything is already mounted from the test board to the textolite board.
Please explain when extint1, extint2...3 is used? This means that the PIC controller can use max up to 4 external interrupts?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I want to use one port as an external interrupt. Attached is a simplified part of the code. in this case I want to use porta.2 as interrupt source. I used the PPS tool, but I probably did not enter the correct syntax.
The compiler scolds: Error: Invalid interrupt event: EXTINT2
Please explain where is the my mistake?
Check in PICINFO for the name of the external interrupt name. This will be your issue.
but, why did you think it was called EXTINT2? :-)
and, surely as RA2 is the default for that chip? and, therefore PPS remapping is not needed.
That was my first thought when I looked at the Datasheet but as I am a tad rusty I chose not to comment. I really do need to clean my work bench and get my dev tools out again.
I have no excuses left and lots of new code to try out.
I would also be inclined to include a main loop in the code even if it is empty, just good parctice and it seperates the Initialisaton code from the Subroutines.
By looking in the chipfile , that the name should be "ExtInt0" . That is the default interupt pin so you would not need pps.
PICInfo is the right place to look.
I am trying to get folks to use the tools rather than the raw files. :-)
Thanks!
I am very sorry for the unnecessary alarm. :)
My mistake was to write EXTINT0, not EXTINT2.
That's all right. The problem was with my test board. Now all works super.
Yes RA.2 is already supposed to be enabled as INT for this chip. then the code is:
But for another PIN, PPS tool is used, which works great.
But the question is, when do need to write extint1, extint2...etc?
No alarm. Just want your program to work.
INTE , INTF and GIE are all managed for you. Test without these bits to see what happens.
Well done.
Thanks Anobium.
Next time I will try INTE, INTF and GIE, everything is already mounted from the test board to the textolite board.
Please explain when extint1, extint2...3 is used? This means that the PIC controller can use max up to 4 external interrupts?
I may be incorrect. But, there is one external interrupt and this (for this CHIP) it is called ExtInt0 . For other external interrupts use IOC.
Is this correct? Why? If I misunderstand this then the DAT files are incorrect.