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 support@ccsinfo.com

bug with PIC24FJ1024GA606 and 5.074

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



Joined: 05 Apr 2011
Posts: 286

View user's profile Send private message

bug with PIC24FJ1024GA606 and 5.074
PostPosted: Fri Aug 11, 2017 6:18 am     Reply with quote

I have submitted this to CCS already, but there is a strange bug that has shown up in version 5.074. Enabling interrupt on change tries to access some strange bits. Hopefully this may help someone else who may be having strange problems. I had a pin mysteriously getting pulled high when it should have been low.

V5.071
.................... enable_interrupts(INTR_CN_PIN|PIN_D5); // enable interrupt on CN14/RD5
1FD6C: BSET.B IOCPD.IOCPD5
1FD6E: BSET.B IOCND.IOCND5
1FD70: BSET.B PADCON.IOCON
1FD72: BSET.B IEC1.IOCIE
.................... enable_interrupts(INT_CNI); // enable interrupt IOC
1FD74: BSET.B IEC1.IOCIE


V5.072
.................... enable_interrupts(INTR_CN_PIN|PIN_D5); // enable interrupt on CN14/RD5
1FD6C: BSET.B IOCPD.IOCPD5
1FD6E: BSET.B IOCND.IOCND5
1FD70: BSET.B PADCON.IOCON
1FD72: BSET.B IEC1.IOCIE
.................... enable_interrupts(INT_CNI); // enable interrupt IOC
1FD74: BSET.B IEC1.IOCIE


V5.073
.................... enable_interrupts(INTR_CN_PIN|PIN_D5); // enable interrupt on CN14/RD5
1FD6C: BSET.B IOCPD.IOCPD5
1FD6E: BSET.B IOCND.IOCND5
1FD70: BSET.B PADCON.IOCON
1FD72: BSET.B IEC1.IOCIE
.................... enable_interrupts(INT_CNI); // enable interrupt IOC
1FD74: BSET.B IEC1.IOCIE

V5.074
.................... enable_interrupts(INTR_CN_PIN|PIN_D5); // enable interrupt on CN14/RD5
1FD52: BSET.B IOCFD.IOCFD5 // <-- write to read-only flag
1FD54: BSET.B IOCPUD.IOCPD5 // <-- enable pullup
1FD56: BSET.B PADCON.IOCON
1FD58: BSET.B IEC1.IOCIE
.................... enable_interrupts(INT_CNI); // enable interrupt IOC
1FD5A: BSET.B IEC1.IOCIE
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Aug 11, 2017 10:50 am     Reply with quote

IOCFD.IOCFD5, is not read only.
It has to be changed to 0 in the handler routine. It is R/W.
However it is not legal to set it to 1 It should be being set to 0 to ensure the bit is not flagged as having caused an interrupt.

From the data sheet:
"Note 1: It is not possible to set the IOCFx register bits with software
writes (as this would require the addition of significant logic). To test
IOC interrupts, it is recommended to enable the IOC functionality on
one or more GPIO pins and then use the corresponding LATx register
bit(s) to trigger an IOC interrupt."

So correct to be writing to this register, but wrong to set it to 1.
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