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 support@ccsinfo.com

Open collector question

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







Open collector question
PostPosted: Fri Feb 14, 2003 3:31 pm     Reply with quote

Hi,
I have a GSM & PICF876 I am interfacing the two and it states that some of the inputs for the GSM should be connected to a "open collector" if I set a pin output_float will this be OK?

Also these connections are pullred high by the GSM and require a low pulse on them but they are rated at 2.8-3.3v because I am only pulling them low I should be OK connecting them direct to PIC without level shifters, am I right thinking this?

Thanks

P.S. The RS232 output is also 2.8v-3.3v again am I right thinking I can connect this direct to the PIC RS232 RX wihout level shift. (I am going to level shift the TX from pic to GSM)
___________________________
This message was ported from CCS's old forum
Original Post ID: 11702
R.J.Hamlett
Guest







Re: Open collector question
PostPosted: Fri Feb 14, 2003 4:08 pm     Reply with quote

:=Hi,
:=I have a GSM & PICF876 I am interfacing the two and it states that some of the inputs for the GSM should be connected to a "open collector" if I set a pin output_float will this be OK?
:=
You can generate an 'open collector' drive, by setting the output latch to '0' (forcing the output to drive low), and then setting the corresponding TRIS bit to '0' when you want the pin driven low, and '1' when you want it to float high. This way only the low driver FET is ever enabled. This is the technique used to drive things like open collector I2C busses from the PIC.

:=Also these connections are pullred high by the GSM and require a low pulse on them but they are rated at 2.8-3.3v because I am only pulling them low I should be OK connecting them direct to PIC without level shifters, am I right thinking this?
:=
Done as described above, this should be fine.

:=P.S. The RS232 output is also 2.8v-3.3v again am I right thinking I can connect this direct to the PIC RS232 RX wihout level shift. (I am going to level shift the TX from pic to GSM)

If you are doing your own bit shifting serial (as opposed to using the hardware UART), you could use the same technique to avoid the need for any level shifters on the output. For the input, the answer depends on the voltage you are running the PIC from, and the input you are using. Inputs with a normal 'TTL' input structure, will accept >2v, as a 'high', but those with a Schmidt trigger input, require between 0.7Vdd, and 0.8Vdd (depending on the pin involved). If this is the hardware UART input, then the input buffer is a Schmidt buffer, requiring 0.8Vdd.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 11705
Trampas
Guest







Re: Open collector question
PostPosted: Sat Feb 15, 2003 9:08 am     Reply with quote

If you want to be safe when you require an open collector put a diode in the path:

|
| | /|
| |/ |
PIC |---| |---->Open Collector
| |\ |
| | \|
|

This for the serial port you can do the same. That is put diodes on the TX and RX pins of the pic as shown above. Then put a pullup resistor to 3.3V on the open collector side.

Trampas

:=Hi,
:=I have a GSM & PICF876 I am interfacing the two and it states that some of the inputs for the GSM should be connected to a "open collector" if I set a pin output_float will this be OK?
:=
:=Also these connections are pullred high by the GSM and require a low pulse on them but they are rated at 2.8-3.3v because I am only pulling them low I should be OK connecting them direct to PIC without level shifters, am I right thinking this?
:=
:=Thanks
:=
:=P.S. The RS232 output is also 2.8v-3.3v again am I right thinking I can connect this direct to the PIC RS232 RX wihout level shift. (I am going to level shift the TX from pic to GSM)
___________________________
This message was ported from CCS's old forum
Original Post ID: 11725
newbie
Guest







Re: Open collector question,
PostPosted: Sat Feb 15, 2003 9:46 am     Reply with quote

:=:=Hi,
:=:=I have a GSM & PICF876 I am interfacing the two and it states that some of the inputs for the GSM should be connected to a "open collector" if I set a pin output_float will this be OK?
:=:=
:=You can generate an 'open collector' drive, by setting the output latch to '0' (forcing the output to drive low), and then setting the corresponding TRIS bit to '0' when you want the pin driven low, and '1' when you want it to float high. This way only the low driver FET is ever enabled. This is the technique used to drive things like open collector I2C busses from the PIC.
:=

Not sure I get this, when you say "output latch to low" The line must be open collector for the GSM to operate but then I need to take the line low for 1sec to tell GSM to start,what C CCS commands would do this?

:=:=Also these connections are pullred high by the GSM and require a low pulse on them but they are rated at 2.8-3.3v because I am only pulling them low I should be OK connecting them direct to PIC without level shifters, am I right thinking this?
:=:=
:=Done as described above, this should be fine.
:=
:=:=P.S. The RS232 output is also 2.8v-3.3v again am I right thinking I can connect this direct to the PIC RS232 RX wihout level shift. (I am going to level shift the TX from pic to GSM)
:=
:=If you are doing your own bit shifting serial (as opposed to using the hardware UART), you could use the same technique to avoid the need for any level shifters on the output. For the input, the answer depends on the voltage you are running the PIC from, and the input you are using. Inputs with a normal 'TTL' input structure, will accept >2v, as a 'high', but those with a Schmidt trigger input, require between 0.7Vdd, and 0.8Vdd (depending on the pin involved). If this is the hardware UART input, then the input buffer is a Schmidt buffer, requiring 0.8Vdd.
:=

It is the hardware UART so if I read you correctly the input to the PIC (TX from GSM) will connect directly. the output from PIC (RX to GSM) will be level shifted by IC I am using.

:=Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 11727
newbie
Guest







Re: Open collector question
PostPosted: Sat Feb 15, 2003 9:48 am     Reply with quote

:=:=Hi,
:=:=I have a GSM & PICF876 I am interfacing the two and it states that some of the inputs for the GSM should be connected to a "open collector" if I set a pin output_float will this be OK?
:=:=
:=You can generate an 'open collector' drive, by setting the output latch to '0' (forcing the output to drive low), and then setting the corresponding TRIS bit to '0' when you want the pin driven low, and '1' when you want it to float high. This way only the low driver FET is ever enabled. This is the technique used to drive things like open collector I2C busses from the PIC.
:=
:=:=Also these connections are pullred high by the GSM and require a low pulse on them but they are rated at 2.8-3.3v because I am only pulling them low I should be OK connecting them direct to PIC without level shifters, am I right thinking this?
:=:=
:=Done as described above, this should be fine.
:=
:=:=P.S. The RS232 output is also 2.8v-3.3v again am I right thinking I can connect this direct to the PIC RS232 RX wihout level shift. (I am going to level shift the TX from pic to GSM)
:=
:=If you are doing your own bit shifting serial (as opposed to using the hardware UART), you could use the same technique to avoid the need for any level shifters on the output. For the input, the answer depends on the voltage you are running the PIC from, and the input you are using. Inputs with a normal 'TTL' input structure, will accept >2v, as a 'high', but those with a Schmidt trigger input, require between 0.7Vdd, and 0.8Vdd (depending on the pin involved). If this is the hardware UART input, then the input buffer is a Schmidt buffer, requiring 0.8Vdd.
:=
:=Best Wishes




Not sure I get this, when you say "output latch to low" The line must be open collector for the GSM to operate but then I need to take the line low for 1sec to tell GSM to start,what C CCS commands would do this?

I am using the hardware UART so if I read you correctly the input to the PIC (TX from GSM) will connect directly. the output from PIC (RX to GSM) will be level shifted by IC that I am using.

Thanks
___________________________
This message was ported from CCS's old forum
Original Post ID: 11730
R.J.Hamlett
Guest







Re: Open collector question
PostPosted: Sat Feb 15, 2003 10:23 am     Reply with quote

:=:=:=Hi,
:=:=:=I have a GSM & PICF876 I am interfacing the two and it states that some of the inputs for the GSM should be connected to a "open collector" if I set a pin output_float will this be OK?
:=:=:=
:=:=You can generate an 'open collector' drive, by setting the output latch to '0' (forcing the output to drive low), and then setting the corresponding TRIS bit to '0' when you want the pin driven low, and '1' when you want it to float high. This way only the low driver FET is ever enabled. This is the technique used to drive things like open collector I2C busses from the PIC.
:=:=
:=:=:=Also these connections are pullred high by the GSM and require a low pulse on them but they are rated at 2.8-3.3v because I am only pulling them low I should be OK connecting them direct to PIC without level shifters, am I right thinking this?
:=:=:=
:=:=Done as described above, this should be fine.
:=:=
:=:=:=P.S. The RS232 output is also 2.8v-3.3v again am I right thinking I can connect this direct to the PIC RS232 RX wihout level shift. (I am going to level shift the TX from pic to GSM)
:=:=
:=:=If you are doing your own bit shifting serial (as opposed to using the hardware UART), you could use the same technique to avoid the need for any level shifters on the output. For the input, the answer depends on the voltage you are running the PIC from, and the input you are using. Inputs with a normal 'TTL' input structure, will accept >2v, as a 'high', but those with a Schmidt trigger input, require between 0.7Vdd, and 0.8Vdd (depending on the pin involved). If this is the hardware UART input, then the input buffer is a Schmidt buffer, requiring 0.8Vdd.
:=:=
:=:=Best Wishes
:=
:=
:=
:=
:=Not sure I get this, when you say "output latch to low" The line must be open collector for the GSM to operate but then I need to take the line low for 1sec to tell GSM to start,what C CCS commands would do this?
:=
:=I am using the hardware UART so if I read you correctly the input to the PIC (TX from GSM) will connect directly. the output from PIC (RX to GSM) will be level shifted by IC that I am using.
:=
:=Thanks
The key is that there are two main bits controlling each pin on a PIC, The first is the 'TRIS' bit, and the second is the output latch bit. The 'logic table' for a bit (ignoring other bits that may also have an effect, such as internal hardware peripherals is:

TRIS OP-LAT EFFECT
0 0 Drives low
0 1 Drives high
1 0 bit is an input, and floats
1 1 bit is an input and floats

Hence if you set the output latch low, and then toggle the TRIS bit, when the TRIS bit is low, the pin will be driven low as an output, but when TRIS is high, the pin will be floating (actually acting as an input, but this doesn't matter). Only the 'pull down' FET ever gets turned on, making the pin behave exactly like an open collector output. :-)

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 11731
R.J.Hamlett
Guest







Re: Open collector question,
PostPosted: Sat Feb 15, 2003 10:25 am     Reply with quote

:=:=:=Hi,
:=:=:=I have a GSM & PICF876 I am interfacing the two and it states that some of the inputs for the GSM should be connected to a "open collector" if I set a pin output_float will this be OK?
:=:=:=
:=:=You can generate an 'open collector' drive, by setting the output latch to '0' (forcing the output to drive low), and then setting the corresponding TRIS bit to '0' when you want the pin driven low, and '1' when you want it to float high. This way only the low driver FET is ever enabled. This is the technique used to drive things like open collector I2C busses from the PIC.
:=:=
:=
:=Not sure I get this, when you say "output latch to low" The line must be open collector for the GSM to operate but then I need to take the line low for 1sec to tell GSM to start,what C CCS commands would do this?
:=
:=:=:=Also these connections are pullred high by the GSM and require a low pulse on them but they are rated at 2.8-3.3v because I am only pulling them low I should be OK connecting them direct to PIC without level shifters, am I right thinking this?
:=:=:=
:=:=Done as described above, this should be fine.
:=:=
:=:=:=P.S. The RS232 output is also 2.8v-3.3v again am I right thinking I can connect this direct to the PIC RS232 RX wihout level shift. (I am going to level shift the TX from pic to GSM)
:=:=
:=:=If you are doing your own bit shifting serial (as opposed to using the hardware UART), you could use the same technique to avoid the need for any level shifters on the output. For the input, the answer depends on the voltage you are running the PIC from, and the input you are using. Inputs with a normal 'TTL' input structure, will accept >2v, as a 'high', but those with a Schmidt trigger input, require between 0.7Vdd, and 0.8Vdd (depending on the pin involved). If this is the hardware UART input, then the input buffer is a Schmidt buffer, requiring 0.8Vdd.
:=:=
:=
:=It is the hardware UART so if I read you correctly the input to the PIC (TX from GSM) will connect directly. the output from PIC (RX to GSM) will be level shifted by IC I am using.
:=

Not if you are powering the PIC off 5v. The required input is then 0.8*5v = 4v.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 11732
Hans Wedemeyer
Guest







Re: Open collector question
PostPosted: Sat Feb 15, 2003 4:38 pm     Reply with quote

Electronics is not a magic art... Why in the world would you put a diode in series with an open collector output, and the in the Serial port TX,RX ...

Please explain the magic, I would like to know.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11747
Trampas
Guest







Re: Open collector question
PostPosted: Sat Feb 15, 2003 5:36 pm     Reply with quote

The device he was interfacing to required an open collector driver. Also his device as I understood it was 3.3V while his PIC was 5V. Therefore placing a diode between his device and the PIC as shown would prevent the PIC from applying 5V to the device, in case the TRIS is configured as an output and that pin accidently got set to a high level.

From what I understood his serial interface to the other device was also at 3.3V and again the PIC was at 5V thus when the PIC's transmit pin when high it would be putting 5V onto a device which only wanted 3.3V. Thus by placing the diode in series again and using a 3.3V pull up the 3.3V device could never see the 5V from the PIC but would still ground the line as need thus effectly making it impossible to hurt the 3.3V device, unless the diode is put in the wrong way.

Trampas

:=Electronics is not a magic art... Why in the world would you put a diode in series with an open collector output, and the in the Serial port TX,RX ...
:=
:=Please explain the magic, I would like to know.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11750
Hans Wedemeyer
Guest







Re: Open collector question
PostPosted: Sun Feb 16, 2003 12:35 am     Reply with quote

Last time I checked the common silicon diode (1N4148) has a Vf of about 0.6V . So 5V - 0.6V leaves 4.2V Which still exceeds the "normal" spec. for Absolute Maximum on many 3.3 Volt devices. As no other components are specified for this connection, I fail to see how any protection is afforded. In fact if the person did Code the TRIS to output and set the pin to 1 (5V in this case) the diode would be forward biased ON and deliver current into the 3.3V device!

The same applies to the other protection, a pull up resistor does not imporve the situation.
___________________________
This message was ported from CCS's old forum
Original Post ID: 11760
R.J.Hamlett
Guest







Re: Open collector question
PostPosted: Sun Feb 16, 2003 3:44 am     Reply with quote

:=Last time I checked the common silicon diode (1N4148) has a Vf of about 0.6V . So 5V - 0.6V leaves 4.2V Which still exceeds the "normal" spec. for Absolute Maximum on many 3.3 Volt devices. As no other components are specified for this connection, I fail to see how any protection is afforded. In fact if the person did Code the TRIS to output and set the pin to 1 (5V in this case) the diode would be forward biased ON and deliver current into the 3.3V device!
:=
:=The same applies to the other protection, a pull up resistor does not imporve the situation.

The point being made, was that in many cases you can simulate an open collector drive, by having a normal output, and connecting a diode, between this and the receiving device, so that the diode only conducts when the output is pulling down. If you use a low drop diode, and combine it with a FET based output (as used on the PIC), then for low currents, when the diode is conducting, and pulling the signal down, the receiving device sees the line pulled down just as if it is being driven by an open collector drive (you have to be very careful that the total voltage across the output FET, and the diode drop, at the current required by the pull up resistor, does not exceed the spec for the V-InLow on the target device. When the PIC instead switches to drive high, the diode becomes reverse biased, and only the leakage current flows. The rail is then pulled up by the resistor, which is coupled to the 3.3v rail, avoiding driving the signal above this rail.
This approach can work, and with a bit of care, would allow the serial output of the PIC to drive the serial input of the GSM device, without needing a buffer IC. However care must be taken to ensure that the voltage involved in the low state, won't exceed the input specification of the receiving chip, and this is balanced against the need to have a reasonable pull-up current, to ensure that the signal transitions at a reasonable speed.
Realistically, I would not use this approach for a commercial product. Given the fact that data transmission is required on two wires, in two directions (and the problem of the required drive level for the serial input in the other direction), the chances of unreliability, together with the ready availability of proper drivers, makes this relatively pointless. Personally, I'd look at one of the drivers in the Maxim 337x family, and probably at the 3372, which offers two level translators in one package, each supporting translation in one direction. The entire package, is comparable with the board space that would be needed for diode and resistor, and solves the level shift needed in both directions... :-)

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 11761
Newbie
Guest







Long time getting back
PostPosted: Wed Jun 23, 2004 3:44 pm     Reply with quote

OK,

I understand what I have to do now e.g. set output low and toggle TRIS bit, but the help file talks about the TRIS command being obsolete, also how does this affect things like the "#use FAST_IO" directive and manipulationg other bits on this port with commands like
output_low(RB1) .

I'm looking for a simple coding solution, I don't want to start having to twiddle entire ports having to remember what bits are in what state etc..

So would this sort of thig work.

output_low(RB2);
SET_TRIS_B(0b00000100);

Then maybe followed by.....

output_high(RB3);
output_low(RB6);
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