View previous topic :: View next topic |
Author |
Message |
RVaughn13
Joined: 09 Feb 2006 Posts: 13 Location: Santa Fe, Texas
|
Interrupt on Change PIC16F1939 |
Posted: Mon Sep 19, 2011 2:32 pm |
|
|
Hi All, I have recently upgraded from a PIC16F887 to a PIC16F1939 due to memory limitation in the 887. The 1939 is pin-for-pin compatible, and was a drop-in replacement in the circuit board. After making all the header file changes (due to the mapping differences between the two cpu's), I have everything working except the portB interrupt-on-change. I have worked 2 days on this problem and can't seem to figure out where the problem is.
I will post some example code if needed, but I have a few observations that may help someone determine the problem area without the code:
(1) The PIC16F1939 has extensive support for portB interrupt on change that did not exist with the PIC16F887. The ccs compiler does not seem to support these enhanced features using the PIC Wizard, and does not list them in the ccs manual either. On page 116 of the manual, it only lists #int_rb.
(2) I am not sure if the ccs compiler is correctly mapping the portb interrupt on change to the interrupt code. Can someone explain how I can verify this?
(3) I am trying to figure out if it is a code problem (my problem), or due to the fairly "new" release of the PIC16F1939, is it possibly a compiler problem?
Thanks in advance for any help!!
Rick _________________ --Rick |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Sep 19, 2011 3:20 pm |
|
|
Here are two previous threads on the topic:
http://www.ccsinfo.com/forum/viewtopic.php?t=45915
http://www.ccsinfo.com/forum/viewtopic.php?t=43231
1. What's your CCS compiler version ?
2. If those threads don't help enough, post a very short (but complete
and compilable) test program that shows the problem. Don't include
Wizard code in your program that is irrelevant to interrupt-on-change.
For example, the Wizard will disable every timer in the PIC. That's
not needed in any case. Get rid of all useless Wizard code from your
test program. |
|
![](templates/subSilver/images/spacer.gif) |
RVaughn13
Joined: 09 Feb 2006 Posts: 13 Location: Santa Fe, Texas
|
|
Posted: Mon Sep 19, 2011 8:44 pm |
|
|
Thanks PCM Programmer! It looks like the ccs compiler does NOT clear the interrupt-on-change flags after they occur. As stated in your note, I added in the code:
Code: |
#byte IOCBF = 0x396
#define clear_IOC_flags() IOCBF=0
|
Then, added the following code inside the #int_rb interrupt handler:
Everything is working perfectly, thanks again for your helpful comments,
Rick _________________ --Rick |
|
![](templates/subSilver/images/spacer.gif) |
|