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

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



Joined: 18 Nov 2013
Posts: 160

View user's profile Send private message

Interrupt on change
PostPosted: Mon Feb 12, 2018 10:17 am     Reply with quote

I'm using a 12LF1552, v5.075 compiler. What does constant INT_IOC do when used with enable/disable_interrupts?
It sets bits that are not used in any other INT_IOC_XXX define.
temtronic



Joined: 01 Jul 2010
Posts: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 12, 2018 10:34 am     Reply with quote

You should post a small, compilable program that shows what you're asking. That will allow us to compile and test on our computers as well as dump the listing.
If you dump the listing , you can easily see which bits of what registers are being set or cleared. Consulting the datasheet section that has IOC info and the PIC device header will show what's going on and why.
SeeCwriter



Joined: 18 Nov 2013
Posts: 160

View user's profile Send private message

PostPosted: Mon Feb 12, 2018 11:02 am     Reply with quote

I want to use the interrupt-on-change feature with pins A0 & A1. I'm not following what file instructions ANDWF and IORWF are acting on.

Here's the listing for both:
Code:

....................       clear_interrupt(INT_IOC_A1 | INT_IOC_A0);
0261:  MOVLW  FC
0262:  MOVLB  07
0263:  ANDWF  13,F

=======================================================================

....................       clear_interrupt(INT_IOC);
0261:  BCF    0B.0

=======================================================================

....................     enable_interrupts(INT_IOC_A1 | INT_IOC_A0 );
00FC:  BSF    0B.3
00FD:  MOVLW  03
00FE:  MOVLB  07
00FF:  IORWF  11,F
0100:  IORWF  12,F

=======================================================================

....................     enable_interrupts(INT_IOC);
00FC:  BSF    0B.3
00FD:  MOVLW  FF
00FE:  MOVLB  07
00FF:  IORWF  11,F
0100:  IORWF  12,F
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Mon Feb 12, 2018 11:08 am     Reply with quote

It enables _all_ the IOC bits.
So '0xFF' into the mask, while the others just enable the bits they specify.
SeeCwriter



Joined: 18 Nov 2013
Posts: 160

View user's profile Send private message

PostPosted: Mon Feb 12, 2018 11:29 am     Reply with quote

The datasheet has a note in paragraph 7.6, that says "The IOCIF Flag is read-only and cleared when all the interrupt-on-change flags in the IOCBF register have been cleared by software."

Yet, a search for IOCBF only finds one result, in the note I just quoted. There is no register definition for IOCBF.

When using INT_IOC in clear_interrupt(), it only clears the IOCIF bit in INTCON register, not all flags in the IOCBF register, where ever that is. Using INT_IOC_A1 | INT_IOC_A0 seems to do more.

So, is using INT_IOC sufficient to use for clearing IOC interrupts? It looks to me like it's not.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 12, 2018 11:37 am     Reply with quote

Clearly a copy-and-paste job by the techwriter at Microchip.
SeeCwriter



Joined: 18 Nov 2013
Posts: 160

View user's profile Send private message

PostPosted: Mon Feb 12, 2018 11:42 am     Reply with quote

It just occurred to me that the note I quoted in my previous post says the IOICF is "read-only". Yet, clear_interrupt(INT_IOC) writes to the IOCIF bit.

Is the datasheet in error, or is the compiler in error?
temtronic



Joined: 01 Jul 2010
Posts: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 12, 2018 3:21 pm     Reply with quote

this..
Quote:
Yet, a search for IOCBF only finds one result, in the note I just quoted. There is no register definition for IOCBF.

IOCBF should probably be IOCAF.

I'm thinking a quick copy/paste from a PIC that has IOC on port B and this PIC only has port A.

IOC is a relatively new feature, well to me anyway.
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