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

PWM Duty Cycle Question

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



Joined: 16 Feb 2006
Posts: 4

View user's profile Send private message

PWM Duty Cycle Question
PostPosted: Mon Feb 20, 2006 10:50 am     Reply with quote

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: 1904

View user's profile Send private message

PostPosted: Mon Feb 20, 2006 1:02 pm     Reply with quote

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

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Mon Feb 20, 2006 3:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Feb 20, 2006 4:34 pm     Reply with quote

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.
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