CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Interrupt on Change PIC16F1939

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RVaughn13



Joined: 09 Feb 2006
Posts: 13
Location: Santa Fe, Texas

View user's profile Send private message Visit poster's website

Interrupt on Change PIC16F1939
PostPosted: Mon Sep 19, 2011 2:32 pm     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 19, 2011 3:20 pm     Reply with quote

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.
RVaughn13



Joined: 09 Feb 2006
Posts: 13
Location: Santa Fe, Texas

View user's profile Send private message Visit poster's website

PostPosted: Mon Sep 19, 2011 8:44 pm     Reply with quote

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:
Code:

clear_IOC_flags();

Everything is working perfectly, thanks again for your helpful comments,
Rick
_________________
--Rick
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group