Tuesday, 9 February 2016

microcontroller - Sinking and Sourcing Current to and from a PIC24F Output Pin


Sinking and sourcing current refers to current going into and out of the MCU (respectively), right? If you configure a GPIO pin as an output, why would current ever go into the pin (since it's configured as an OUTPUT)? I suppose it depends what the output circuit looks like, if it's tied to the voltage supply rail or ground... maybe I just answered my own question...?



Answer




Even though it's called an output, it can sink or source current:


CMOS output


We are looking at the right hand pair of MOSFETs here (the left hand pair are what an input pin would look like - if the pin can perform both functions, both pairs are connected to the same pin)


When the output is high the top MOSFET is on (open/passing current) and the bottom MOSFET is off. The pin is effectively connected to the supply voltage (through the MOSFET's ON resistance)
When the output is low, the top MOSFET is off and the bottom MOSFET is on, so the pin is effectively connected to ground. So if you have a e.g. pullup resistor connected between the pin and the supply, the bottom MOSFET will sink the current and keep the voltage at the pin near 0V (assuming the resistor is not too small so the current is higher than the pin is rated for)


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...