View previous topic :: View next topic |
Author |
Message |
leels
Joined: 16 Feb 2006 Posts: 4
|
PWM Duty Cycle Question |
Posted: Mon Feb 20, 2006 10:50 am |
|
|
Hi,
I'm trying to measure the duty cycle of a PWM signal (ie. from an ADXL202 accelerometer) using a PIC16F873A. I'm using period of 1ms for PWM. I'm trying to avoid using the CCP module, since eventually I will need to take readings from 4 accelerometers. And as far as I can understand it, there are only 2 CCP modules available on the PIC. As you can tell I'm pretty new to using the PIC microcontrollers and will appreciate any help/advice you guys can spare.
Also since I will eventually need to figure it out, if anyone can shed some light on how to connect 4 ADXL to a PIC it would help me out alot. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1908
|
|
Posted: Mon Feb 20, 2006 1:02 pm |
|
|
4 sensors which output a PWM signal, but a PIC with only two CCP inputs.
The other two sensor inputs can be connected to (if your PIC has them) the external interrupt inputs or the change on port B interrupt. They can then be used to measure the PWM duty cycle. It will be a little involved, but it will work. |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Mon Feb 20, 2006 3:38 pm |
|
|
Furthermore, you can just use one of the CCPs, but you'll need a 4-to-1 multiplexer, thus more i/o lines (to select the channel) |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
|
Posted: Mon Feb 20, 2006 4:34 pm |
|
|
I would connect Xfilt and Yfilt outputs to the analog inputs of the pic, bypassing the duty cycle modulator on the accelerometer. The modulator doesn't perform well at low accelerations where noise predominates anyway.
However, the internal resistance to the filter capacitor is 32k, and the maximum recommended impedance to the pic analog input to the pic is 10k, so a buffer op amp would be required for each channel to maintain accuracy and sample rate. If this is not a problem the buffer could be left out.
Four ADXL202 accelerometers means eight channels, so an eight channel analog multiplexer chip like the T.I. MPC508A would be needed. In this case only one buffer op amp on the multiplexer output would be needed.
I have used this method with the superlative Sunstrand and Columbia Research accelerometers. |
|
|
|