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

PIC24EP512GP806 - Interrupt-on-change trigger on level?

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



Joined: 30 Oct 2007
Posts: 542
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PIC24EP512GP806 - Interrupt-on-change trigger on level?
PostPosted: Thu Nov 24, 2022 9:08 am     Reply with quote

Device: PIC24EP512GP806
Compiler: 5.026

Hi again,

Is there a way to make the INT_CN interrupt on certain pins to trigger only on one edge transition? In other words, I'd like the interrupt to fire only when it changes from H_TO_L. Can I do this with the CN interrupts?

Thanks,

Ben
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 6:33 am     Reply with quote

Why not just use the external interrupts?. You have five on that chip.
Each can be mapped to pretty much any pin, and can be programmed to be
on either edge.
Interrupt capture captures a timer reading on the change. Not a simple
interrupt.
Problem with INT_CN, is that all pins assigned to that interrupt will go to
the same handler, and you will then have to poll to find which has changed.
These interrupt on any change from the last read state, not on levels.
You have five normal interrupts, why not use them?.
benoitstjean



Joined: 30 Oct 2007
Posts: 542
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 7:34 am     Reply with quote

Hi TTelmah,

The reason I am using INT_CN is because I am sampling 16 channels that can all generate an interrupt. For sure the EXT_INT would have been ideal but there's not enough.

I'll just have to do some filtering when the INT_CN is triggered.

Thanks for your time!

Ben

[EDIT] Not sure I have read this anywhere and I don't currently have the tools to test and I will be honest, I'm not sure exactly how to calculate this but what is the fastest signal that INT_CN can trigger on? My PIC is running at 129.024MHz (I overclock my 29.4912 external oscillator). I can successfully sample 16kHz I know that for a fact but the signal I am looking at sampling is a low pulse of 62.5us (16us) out of a 1kHz signal. Do you think this is doable?



------|________|---------------------------|________|--------

|<-16us->| (62.5kHz)
|<----------------1ms--------------->| (1kHz)
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 9:05 am     Reply with quote

Several thousand times slower than the interrupt can handle.
Easy.
The problem will be polling the flags to see which pin has triggered and
handling that it will trigger on both edges.
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