View previous topic :: View next topic |
Author |
Message |
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
A/D converter triggered by PWM |
Posted: Fri Jul 15, 2005 5:03 pm |
|
|
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
|
|
Posted: Fri Jul 15, 2005 6:09 pm |
|
|
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
|
|
Posted: Fri Jul 15, 2005 7:02 pm |
|
|
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 |
|
|
|