lundi 8 janvier 2018

OPEN DRAIN

Open Drain















The term “open drain” means there’s a current sink, but on a FET device, for example, a MOSFET. (A MOSFET is like a transistor that can handle higher voltages but operates in much the same way.)




the main point in the term open drain is that part of the output transistor is directly brought out to a pin that is external to the IC package.





Open drain devices sink current when controlled to one state and have no current flow (i.e., output a high impedance state) in the other state. It is fairly common to use open-drains together with a pull-up resistor. The pull-up resistor is connected to high (supply voltage) at one end and connected to one or more external pins of the open-drain devices all connected together. Thus, if any one of the open-drain devices is set to sink current, current flow for all of the devices gets sunk to ground, since they are all connected at the same point.




that holds the signal line high until a device on the wire sinks enough current to pull the line low. Many devices can be attached to the signal wire. If all devices attached to the wire are in their non-active state, the pull-up will hold the wire at a high voltage. If one or more devices are in the active state, the signal wire voltage will be low. Basically, the circuit has a resistor between it and the path to 5V (pull-up resistor). Pull-up resistors are used so that when the FET (transistor) is “OFF” the wire will float to the high voltage, which is usually supply voltage for the circuit.




some of you may say "where we can found it?" or "what's the link between it and the programmable IC like pic?"

well the answer is that most of PIC have an open drain .


how we control it ?


as we know every pic has ports to configure as outputs or inputs by setting the TRISX (X can be from A to E, it depend on the ref. of PIC) . we used to put '0' as output and '1' as input .


well that is not the case with the TRISX where we have the open drain. all bits are configured as we say unless for the open drain bit. a '0' means level low (0 V) while a '1' means HIGH (5V)


to better undrestand the function of the open drain, we ll take PIC16F877A as an example.









this PIC has 5 ports from PORTA to PORTE, which are configured by setting TRISX of each port

the open drain is present at RA4-pin so when you are working on this port you should either miss it

or use it as a drain


RA4 is the 2nd bit starting from MSB so in mikroc you just write "TRISA=0b000000" to have a level low on RA4 pin or "TRISA=0b010000" to have a level high


























Aucun commentaire:

Enregistrer un commentaire