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

A/D converter triggered by PWM

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



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

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

A/D converter triggered by PWM
PostPosted: Fri Jul 15, 2005 5:03 pm     Reply with quote

I'm thinking of using a PIC18FXX31, and will be driving a fet driver chip with PWM. To get galvanic isolation, I must go thru an optocoupler for all my PWM signals. This optocoupler has 4microseconds of delay to turn on.

Okay, so with each rising pulse of the PWM signal, I believe I can set the ADC to sample the motor current. However, I think I will be reading the wrong current, because with the optocoupler, I don't think there will be any current flowing just yet. I would have to offset this rising edge of the PWM pin by at least 4 microseconds.

__-*---__-*---__-*---__

As my ascii art shows, a '_' is a low pwm signal, while a '-' is a high signal. I want to sample the A/D at '*'.

Is this impossible with a PIC?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Fri Jul 15, 2005 6:09 pm     Reply with quote

CCP2 on the pics can be used to trigger an A/D conversion. This of course means that you can't use CCP2 to generate a PWM. The PWM of another CCP can be fed into CCP2 and configured to start this conversion.

You could also feed the PWM back to an INT0 interrupt and start the conversion there or start a timer to start the A/D conversion
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

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

PostPosted: Fri Jul 15, 2005 7:02 pm     Reply with quote

I'll make an assumption that you are trying to read the current of the optoisolatred motor, and you need to get the information about current's across the isolated barrier. If this is the case, I can suggest 2 approaches:

1. There are current senors where the measured curent path is galvanically isolated. Allegro ACS series http://www.allegromicro.com/hall/currentsensor.asp . Zetex makes such current sensors too.

2. You can take a non-islated current sensor and connect its output through a linear optocoupler. See, for example, this app note: http://www.maxim-ic.com/appnotes.cfm/appnote_number/1867

Regards,
Kender
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