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

PIC GPIO inverter

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



Joined: 03 Jun 2009
Posts: 28

View user's profile Send private message

PIC GPIO inverter
PostPosted: Thu Aug 06, 2009 4:21 pm     Reply with quote

I'm using a 12F683 to generate a PWM. Is it possible with this one CCP module to generate a complimentary output of the PWM signal on another GPIO (other than the one used to generate the PWM on GPIO2 of course)?

If not, is it possible to use two extra GPIO pins to realize an inverter? That is, tie the PWM to say GPIO3 (inverter in) and out of say GPIO1 (inverter out).

PCB space is EXTREMELY tight and i'm just entertaining the option even though there are many single inverter IC's in different small package options.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Aug 06, 2009 4:47 pm     Reply with quote

You can get a CMOS-level single-gate inverter in very small packages:
http://focus.ti.com/lit/ds/symlink/sn74ahc1g04.pdf
marcusayoung



Joined: 03 Jun 2009
Posts: 28

View user's profile Send private message

PostPosted: Fri Aug 07, 2009 7:09 am     Reply with quote

Right, this is what i said above. But is this possible to realize with a PIC and extra GPIO?

Thanks
Ttelmah
Guest







PostPosted: Fri Aug 07, 2009 9:13 am     Reply with quote

Not really.
There is no hardware ability to do this. You could program software to invert a signal onto an output, but the delays would probably be unacceptable, and your processor couldn't do anything else while this was going on...
What is the clock frequency of the chip?. What is the PWM frequency. One thing that can be done, but uses a lot of code time, is to not use the PWM function, but use the CCP interrupts instead. For low speeds, you program a CCP interrupt after a count corresponding to the 'off' time, when this triggers, set the output pin, and program the interrupt to occur after the required 'on' time. Then clear the pin, and restart the process. For PWM's with several thousand rocessor clock cycles beween the edges, this will work fine, and you can elect to set or clear multiple pins...

Best Wishes
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Fri Aug 07, 2009 10:03 am     Reply with quote

Unfortunately space is a problem -- otherwise they make PIC's with complementary PWM outputs.

What's the tolerance of the timing between hi-low? What kind of drive current do you need?

PCM's suggestion above is a good one. I recently used a dual gate buffer in a SOT-23-6 package... that came in SC-70 and bump-chip packaging. Check the TI family out.


Fun Stuff..

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
marcusayoung



Joined: 03 Jun 2009
Posts: 28

View user's profile Send private message

PostPosted: Fri Aug 07, 2009 1:32 pm     Reply with quote

The clock frequency is 8MHz. PWM varies between 9kHz - 100kHz.

I definitely want the compliment output to scale very close to the original, so i would rate the tolerance at +/- 5%.

I think the code involved with doing this inversion is too much, not really worth it.

My company carries lots of different single inverters (SOT-23, SC-70, etc), so I think this is best solved in hardware.

I was just curious is all, oh well.

Thanks
Ttelmah
Guest







PostPosted: Fri Aug 07, 2009 2:48 pm     Reply with quote

At those frequencies, it can _only_ be solved in hardware.

Best Wishes
mbradley



Joined: 11 Jul 2009
Posts: 118
Location: California, USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Sep 01, 2009 8:19 pm     Reply with quote

There is a pic (or two) that have this functionality built into the hardware, its for motor control.

I think its the 18F2431, 6 pwm outputs, but 3 are compliments of the other 3
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Sep 01, 2009 9:28 pm     Reply with quote

mbradley wrote:
There is a pic (or two) that have this functionality built into the hardware, its for motor control.

I think its the 18F2431, 6 pwm outputs, but 3 are compliments of the other 3


Yes.. and it's actually more than that I think.

I used the 18F4431 in a project but more for the dual sample and hold units on the ADC.

Not a lot of memory space though.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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