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

Event detector in nsec range

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







Event detector in nsec range
PostPosted: Tue Feb 09, 2010 5:04 am     Reply with quote

Dear all,

I'm designing a new project where I need a PIC microcontroller connected to two digital lines. When first line gets high I activate a flag that must be active during the following second. If during this time the second line gets also high, I have to activate an alarm. This doesn't look really difficult, and although I'm not an experimented programmer I think I can implement it easily with interruptions.

My problem comes when looking at the minimum time between digital line changes. At the worst case, I could have 95 nsec time difference between activation of the first and the second line, and I don't know if I can implement this solution with any of the development boards provided by CCS. I guess that the fastest board is the PIC24F with 8 MHz clock that provides 125 nsec time for every clock tick, being slow for my application.

Is there any way to improve or implement this?

If not I'll have to move to another solution and I'd like to prefer to stay with CCS HW&SW.

Thanks and regards
Ttelmah
Guest







PostPosted: Tue Feb 09, 2010 5:34 am     Reply with quote

Seriously, you need to add hardware.
Even a processor running with a clock cycle down in the 10nSec range, could have problems with this. Imaging you are sitting 'waiting' for the input to change. This in itself involves looping (usually at least a couple of instruction times), and testing (another). It then has to advance to another similar loop, and start looking for the other bit. More instructions.
This is "child's play" in logic. Just have a flip-flop, 'set' by the first line, which routes the second line to another flip-flop. If the output of this gets 'set', then the second signal has come as required. Clear it via a timer (or a processor).
You could devlop the timing, and the detection of the second signal, with a PIC, by having the flip-flop as already described, but routing it's output, to the CTC input of a PIC.
In all honesty, it is far easier to do with a couple of logic IC's, or a FPGA, and more likely to work in the timescales you require...

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 09, 2010 1:42 pm     Reply with quote

Tell us what chip is supplying these two signals to your PIC.
Are these signals part of some communications protocol ?
If so, describe it or a post a link to the specification for it.
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