|
|
View previous topic :: View next topic |
Author |
Message |
40inD Guest
|
How can i measure 4 different impulse width simultaneously |
Posted: Tue Sep 06, 2005 4:20 am |
|
|
I need to measure 4 different impulse width simultaneously on 4 different inputs. How can i do it? I think to use PIC18F4431. If it can't, wich chip can do it? |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Sep 06, 2005 2:07 pm |
|
|
Can you tell us more about these impulses? Are they synchronized in any way?
One worst case possibility would be to use four really cheap PICs to do the measurements. I once replaced a 386 and an FPGA with 10 PICs and an HC11 at a fraction of the cost and development time. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Tue Sep 06, 2005 3:45 pm |
|
|
One approach I used a while back for ten signal inputs was using latches to store the edge trigger until the PIC serviced it and reset the latch.
All this is depending on the speed of all the input signals giving the PIC enough time to get to all the interrupts however but mine worked great...and still does. |
|
|
40inD Guest
|
|
Posted: Wed Sep 07, 2005 3:57 am |
|
|
These impulses are the standard radiocontrol 20ms impulses with 1 to 2 ms width. |
|
|
Ttelmah Guest
|
|
Posted: Wed Sep 07, 2005 5:03 am |
|
|
I doubt if the pulses will be 'simultaneous'. Normally these pulses are generated as a sequential train for sending over the radio, and the receiver/decoder, then seperates them and feeds them to the servos. There is a 'frame' of time (normally the 20mSec), and pulses are fed to the servos sequentially in this frame. Hence the first servo, receives a pulse of 1 to 2mSec at the start of the frame, then the second servo receives a pulse of 1-2mSec, starting 2.5mSec after the start of the first pulse. The third, receives a pulse of 1-2mSec, starting at 5msec from the first pulse, and the fourth, it's 1-2mSec pulse starting 7.5mSec after the first. The frame size at 20mSec, allows time for eight sequential pulses to be sent. As such, if this is the way the pulses are sent, it simplifies the decoding. However the timescales are long enough, that this can be done reasonably easily.
If you use the 'interrupt on change' ability on portB, to detect the edges on all four signals. In the interrupt handler, work out which edge(s) have occured. For each rising edge, note the value of a seperate timer (program one of the hardware timers to a rate like 10uSec counting). On the falling edge, read the counter again, and subtract the value recorded for the corresponding rising edge. The only problem, will be that if the signals do overlap, errors will be introduced as the interrupt latncy changes when signals occur together. I suspect though you will find that this does not happen.
Best Wishes |
|
|
|
|
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
|