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 CCS Technical Support

Capturing a PWM output, is there a module for this ??

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



Joined: 08 Sep 2003
Posts: 492
Location: India

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

Capturing a PWM output, is there a module for this ??
PostPosted: Tue Jul 18, 2017 9:12 pm     Reply with quote

Hi,

I want to capture the PWM output from a AS5048 position encoder IC (https://www.digikey.com/product-detail/en/ams/AS5048B-HTSP-500/AS5048B-HTSP-500CT-ND/3188619)

Is there a dedicated module on a18F or 16F PIC micro controller for this ??

thanks
a
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Tue Jul 18, 2017 9:21 pm     Reply with quote

The CCP (capture/compare) module will do what you want. The CCP works in capture mode with a dedicated timer to "capture" the timer's count when a rising edge or a falling edge, or, depending on the particular PIC, any edge is seen on the CCP input pin. When a capture event is seen, an interrupt fires. It's up to you to figure things out based on the timer and the line's state and how you set it up.

The only thing the CCP module has problems with is fast edges/high frequencies.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jul 19, 2017 4:23 pm     Reply with quote

I was curious about the device so downloaded the pdf. While almost any PIC can capture the PWM 'value' (1KHz rate) you will have to do some 'math'.
While the PWM signal is 4096 bits there's an extra 24 for Init, error and exit times. Those 24 bits will have to be subtracted from the overall 4119 bits.
Good news is there's an SPI interface you need to use to program the device, so you can simply read the position registers and compare to your 'compute PWM output' function to tweak your math.

Jay
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