at second sight ...
You have two "capture" modules in a '252 ...
WHY not use both ... triggered at the SAME time ...
Alain
at second sight ...
You have two "capture" modules in a '252 ...
WHY not use both ... triggered at the SAME time ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi Alain
MmmmYou have two "capture" modules in a '252 ...
WHY not use both ... triggered at the SAME time ...
Although the "event" trigger would take place at a specific time, would there not be a problem stopping the timers?. Surely they cannot be stopped at the "same "time. One has to take priority over the other, by at least one instruction cycle if not two, one for the capture and a second for the stop.
Maybe then three cycles for the second timer (extra cyle whilst waiting for the first to be stopped.)
As mentioned.... how exactly is Exactly?
Just random thoughts
Duncan
Hi, Duncan
This is the same question as " I want to measure the 100th of degree with a LM35 and VDD ref " ...
99 times upon 100 ... no real need ... exept "for the show" ... but 1% remain useful ...
but, good exercise to have a reflexion about what offers the chip as features ...
Alain
Last edited by Acetronics2; - 9th April 2008 at 12:31.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
your are quite right Alain.but, good exercise to have a reflexion about what offers the chip as features ...
I have taken a very big step away from the bench for a while now, (just can’t seem to get the level of concentration back).
There are so many ways of achieving a result that sometimes I have had difficulty seeing through the “liminal”. And by that I mean the mental area where I can unnecessarily execute a task in PBP that can be completed very simply using the inbuilt features of a PIC, and Visa-versa
Approaching a problem from a PIC perspective or PBP Perspective. And I haven’t started on peripheral components.
So it is really valuable to have a reflection
I am in a mental state where I am looking at code and circuits and simply cannot believe they are mine, what they are for and why I build them in the first place. I am finding it quite depressing.
Anyway, I am hijacking a thread again, so back to it,
On a 252 I might set an interrupt on the two comparators (single interrupt only inbuilt I think) for each channel that I wish to monitor and use that interrupt event to start one timer with a preload and interrupt on overflow…..Whilst……. using the other two CCP and associated timers to capture all the events on the two channels.
So I might have THREE consecutive lines starting each of the three timers, just as Alain suggested
If the events on the two CCP channels are very close together and are triggered before the reset/write is completed then consider a PIC with more Timers that can be associated with the CCP’s so that each subsequent trigger on a particular channel uses a different timer.
Is every edge being triggered (random pulses) or is it looking at a frequency. So much of this is application specific.
Duncan
Thanks for the response folks! I need to determine the EXACT frequency difference between the 2 channels, with frequencies in the 2MHz range. Both frequencies are changing continuously and are close (or equal) all the time. The PIC clock is 20MHz. In my application a single count difference between channels is significant, so the lag caused by coding the Start/Stop on successive program lines will give rise to an error.
From reviewing your replies, it seems to me that the only totally satisfactory solution is to:
1 Gate both channels externally using a pair of AND or NAND gates, enabling these via a spare PIC pin
2 Start both timers in the program
3 Then feed both timers by enabling the gates
4 Disable the gates to stop the feed
5 Then read Timer0 and Timer1.
It's just a shame that we need to add a clunky 14 pin IC to do this trivial job!
Bookmarks