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

Open-collector or open-drain output on a PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
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

Open-collector or open-drain output on a PIC
PostPosted: Fri Jan 04, 2008 8:57 pm     Reply with quote

Colleagues,

This is, probably an easy question for those who know the answer. Is there a way to arrange an open-collector or open-drain output on a PIC18F4520 without adding a separate transistor? I think, according to the datasheet, the answer is “no”.

Thanks,
- Nick
_________________
Read the label, before opening a can of worms.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 04, 2008 10:43 pm     Reply with quote

Use these two functions to emulate an open-drain output:
Code:

output_low(pin #);

output_float(pin #);
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 Jan 04, 2008 11:02 pm     Reply with quote

Actually, I want the pin to have high impedance, when the PIC is powered down. Currently, I see that the pin is tied to ground, when Vcc = 0.
_________________
Read the label, before opening a can of worms.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

PostPosted: Sat Jan 05, 2008 8:41 am     Reply with quote

kender wrote:
Actually, I want the pin to have high impedance, when the PIC is powered down. Currently, I see that the pin is tied to ground, when Vcc = 0.


The reason is that the protection diodes on the pin conduct toward Vcc. And if Vcc = 0, then any voltage higher than .7 volts will be shorted out.

Robert Scott
Ypsilanti, Michigan
coast



Joined: 03 Jan 2008
Posts: 6
Location: WALDERSLADE, KENT,UK

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

o/c output
PostPosted: Sun Jan 06, 2008 8:11 am     Reply with quote

open drain output does not require an external [spam] if you can constrain levels within the 0 to +5V range of yr power supply rails (or whatever yr PSU range happens to be). The internal protection diodes will dump energy back into the power rail above this level. If you DO need an external [spam] then ZVN3306 or sim. is normally a good bet (no other surrounding components). You may however choose to put a 1 meg pull down from gate to ground to control initial conditions (to make sure the [spam] is off during reset time)
coast



Joined: 03 Jan 2008
Posts: 6
Location: WALDERSLADE, KENT,UK

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

the wierdness of this site
PostPosted: Sun Jan 06, 2008 8:13 am     Reply with quote

Please note that the SPAM words in my last reply were what the CCS site chose to replace the word transistor with!!
Programmers can be very strange people.
Ttelmah
Guest







PostPosted: Sun Jan 06, 2008 8:52 am     Reply with quote

It is worth remembering, that this is 'inherent' in the outputs of the PIC, without even considering any deliberate protection devices added. If you take a P channel FET, and ground the gate, and source, there will be an apparent diode seen if you try then to raise the drain.

Best Wishes
SET



Joined: 15 Nov 2005
Posts: 161
Location: Glasgow, UK

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

PostPosted: Wed Jan 09, 2008 2:02 pm     Reply with quote

We got caught out where we had a design that drove a triac optocoupler by current sinking into port pins. At power up there would sometimes be a glitch.. changing to source drive fixed it.

So the port pins definitely 'gulp' some current at power up - as to why:

1. Protection diodes - doubtful, as the pin and power pin will ramp up at the same time

2. P-channel FET - but if you raise the drain (i.e. the pin), the source would also rise (the supply) sot he inherent diode wont conduct?, and of course the gate shouldnt conduct...

There might be implications for battery powered systems, which are switched on and off - though I suppose the amount of 'gulp' current will be low.
Guest








spam, eggs, bacon and spam...
PostPosted: Thu Jan 10, 2008 10:11 am     Reply with quote

I noticed the above message and I wanted to test the spam out.

transistor, eggs, bacon and transistor.

So I typed; XSTR, eggs, bacon and XSTR. where XSTR is the full name - t r a n s i s t o r

Let's see if this works?
Guest








PostPosted: Thu Jan 10, 2008 10:13 am     Reply with quote

Nope - didn't work... I wonder how the other chap spelled the word - transistor that the board edited it out with [Spam]???
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Thu Jan 10, 2008 10:17 am     Reply with quote

I bet it's either 1) trans or 2) tran.

1) T r a n s
2) t r a n

edit: nope.
SET



Joined: 15 Nov 2005
Posts: 161
Location: Glasgow, UK

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

PostPosted: Thu Jan 10, 2008 10:44 am     Reply with quote

Try T r a n n y
[spam]

Yep :-)
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

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

PostPosted: Thu Jan 10, 2008 11:02 am     Reply with quote

kender wrote:
Actually, I want the pin to have high impedance, when the PIC is powered down. Currently, I see that the pin is tied to ground, when Vcc = 0.


An easy solution to this is to add a Schottky diode, Cathode connected to the PIC output pin. The anode becomes the "open drain" output.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Guest








PostPosted: Thu Jan 10, 2008 4:53 pm     Reply with quote

[spam], eggs, bacon and [spam]!

Yeah - Monty Python Lives!

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