Back again, can't fight my way out of a paper bag today, LOL.
Seems like I used to be able to work around this previously on a different chip, not so with the 16f1783. Needs the "PORTAChange:IOCIE,IOCIF" added to the dat file. Here is the code that makes for an "invalid interrupt event"
#chip 16f1783, 8
'*****setup IOC on RA7 with pullup*****
#define Switch PortA.7
Dir SWITCH In
Set NOT_WPUEN Off
Set WPUA7 On
SET IOCAN7 ON 'int. on neg. edge (use iocapx for pos. edge)
ON Interrupt PORTACHANGE CALL BeginLog
Main:
goto Main
sub BeginLog
PULSEOUT PortA.5, 100 MS
set IOCAF7 Off
Do While switch Off
Loop
If Begin = True Then
StopLog = True
exit sub
End If
Begin = True
end sub
PS The 16f782/1783 also has a PortCChange also
Last edit: kent_twt4 2016-08-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hugh and I have spoken about the Constant and the range IOC's,
I think we should retain what we have, in terms of PortXXChange, but add a new Constant called PortIOChange. I have reviewed the permutations.. there are 720 different options of PortA thru to PortG - so, I am thinking of PortIOChange to the generic IOC handler for all porta. Then, the interrupt handler can determine the source of the interrupt. Open to other ideas - of course.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
or.... you have another option to resolve this going forward - I think it is easier to maintain also.
Make these changes..
remove the 'On Interrupt'. The complete command.
rename your sub handler to 'sub interrupt'
then in 'sub interrupt' test the register bit for the event.
~~~~
sub interrupt
'check the interrupt flags
if IOCIF = 1 then 'you know it is the interrupt you are looking to handle
PULSEOUT PortA.5, 100 MS
set IOCAF7 Off
Do While switch Off
Loop
If Begin = True Then
StopLog = True
exit sub
End If
Begin = True
exit sub
end if
'more checks for more interrutpts...
end sub
~~~~
This method justs uses the default interrupt handler and it a really good way to management interrupts.
Anobium
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The IOC interrupt has always been a little trickier to set up. I forgot about the generic Interrupt, and that looks to be the way forward, especially when handling multiple IOC interrupts.
Since I've got the solution now, I am neutral on the ON Interupt PortIOChange. That would be a lot of work on the .dat files. And, the setup questions may still not be squashed entirely either?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Back again, can't fight my way out of a paper bag today, LOL.
Seems like I used to be able to work around this previously on a different chip, not so with the 16f1783. Needs the "PORTAChange:IOCIE,IOCIF" added to the dat file. Here is the code that makes for an "invalid interrupt event"
PS The 16f782/1783 also has a PortCChange also
Last edit: kent_twt4 2016-08-15
Dear person that is trapped in brown paper bag. 😃
I would recommend the following in the user program.
~~~~
#define PORTACHANGE PORTBCHANGE
~~~~
This should be forward compatible.
Hugh and I have spoken about the Constant and the range IOC's,
I think we should retain what we have, in terms of PortXXChange, but add a new Constant called PortIOChange. I have reviewed the permutations.. there are 720 different options of PortA thru to PortG - so, I am thinking of PortIOChange to the generic IOC handler for all porta. Then, the interrupt handler can determine the source of the interrupt. Open to other ideas - of course.
or.... you have another option to resolve this going forward - I think it is easier to maintain also.
Make these changes..
then in 'sub interrupt' test the register bit for the event.
~~~~
sub interrupt
end sub
~~~~
This method justs uses the default interrupt handler and it a really good way to management interrupts.
Anobium
Glad someone has their thinking caps on. Thanks.
The IOC interrupt has always been a little trickier to set up. I forgot about the generic Interrupt, and that looks to be the way forward, especially when handling multiple IOC interrupts.
Since I've got the solution now, I am neutral on the ON Interupt PortIOChange. That would be a lot of work on the .dat files. And, the setup questions may still not be squashed entirely either?