View previous topic :: View next topic |
Author |
Message |
ricperez
Joined: 25 Apr 2007 Posts: 14
|
Interrupt on change on PIC16F1827 |
Posted: Tue Jun 30, 2015 2:07 pm |
|
|
I'm struggling to make IOC work; it seems to me that the 16F1827.h file is not complete, since it doesn't show any settings for setting the individual 8 bits of the port for this function which is a feature on this chip.
I'm working with PCWH 4.099.
Can you provide assistance to solve this issue?
Thanks a lot. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Tue Jun 30, 2015 2:28 pm |
|
|
In part, compiler age.
Later compiler do contain the code to set the edges, and which bits are enabled, and to vector to separate handlers if required. However even on the later compilers you need to manually clear the extra status bits for the individual bits.
Easiest answer, just define the registers yourself IOCBP, and IOCBN for the positive edges and negative edges respectively, and IOCBF for which interrupt has actually triggered. The interrupt on change routine will be called for all set bits, and you then test which one has triggered, and clear it's status bit. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
ricperez
Joined: 25 Apr 2007 Posts: 14
|
Problem solved |
Posted: Wed Jul 01, 2015 3:01 pm |
|
|
To those who sent recommendations, thanks a lot. I combined your proposed solutions and my code is running smoothly now!
This forum is great because of you people |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Thu Jul 02, 2015 1:24 am |
|
|
Well done. |
|
|
|