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

PIC24F, Interrupts on RB4 and RB5

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



Joined: 15 Oct 2013
Posts: 1

View user's profile Send private message

PIC24F, Interrupts on RB4 and RB5
PostPosted: Sun Oct 27, 2013 5:12 am     Reply with quote

Hi,

I am quite new to programming with ccs compiler and i need some help.

I have a board with a PIC24FJ64GA002.
PIN RB4 and PIN RB5 are getting a short high pulse of 3µs length (for testing, the length should be variable)

I want to measure these length and to do it, I start a timer in the ISR.

This works fine, when both pulses don´t occur at the same moment.

So, i can only work with #INT_CNI?
With this ISR i can only see, if there is a change, but not on which pin and if falling or rising edge.

Is there another method to get it work?

Thanks Very Happy
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Oct 27, 2013 9:17 am     Reply with quote

There's a better way by progamming two input capture modules to use the respective pins, provided
you have it still available in your application.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Sun Oct 27, 2013 9:33 am     Reply with quote

Not just 'better', essential....

Even at the highest CPU clock rate, it still takes about a very large fraction of the pulse width to get into the interrupt, and this will vary.

The capture modules are the only way to make such a short measurement accurately. 'Why they are there'....

Best Wishes
jeremiah



Joined: 20 Jul 2010
Posts: 1346

View user's profile Send private message

PostPosted: Sun Oct 27, 2013 2:36 pm     Reply with quote

Definitely go with input capture.

As an informational note, if your application isn't as time sensitive and if the pins you select are reprogrammable (As these are), you can also assign external interrupts to them (EXT1-EXT4) and set them to trigger off of certain edges. You can even remap multiple interrupts to the same pin with different edge triggers. However, for the short timing you have, input capture is the way to go.
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