Thursday, 21 June 2018

raspberry pi - Understanding 74LVC245 datasheet and current source/sink


I'm using a SN74LVC245A (datasheet) to shift 5V TTL down to 3.3V so I can read the signals with a Raspberry Pi.


However I am getting really weird results (a 60Hz input signal is picked up by the Pi at anything between 110Hz and 320Hz) and I'm really confused about how to read the datasheet to figure out whether I need pullup or pulldown resistors.


The datasheet says on page 4 the "high-level output current" is -24mA, and the "low-level output current" is 24mA. So to me this means that when the device is outputting a high signal, it is able to sink 24mA of current (since outputting a negative amount of current suggests the current is going into the device instead.) But then if you're outputting a positive voltage, isn't that sourcing current? Why is the figure listed as a negative value?


Is anyone able to explain what these figures actually mean? When I disconnect the 74LVC245 output from my GPIO pin, I still get weird signals from the floating input pin so I am assuming this means the 74LVC245 output is also floating in one state, but I don't know in which state it is (i.e. is it left floating on a high output signal or a low one?) It doesn't really make sense to be floating on a high output signal since it's a level converter and the whole point is to maintain the correct 'high' voltage, so do I need pulldown resistors to handle the low output? If so, why does the datasheet seem to suggest the chip can both source and sink current? (In my mind, source current means the device can output a current with a positive voltage, while sinking current means the device takes in anything and connects it to GND, so perhaps that is where I am going wrong.)


Anyway I'm quite confused so any clarification would be much appreciated!



Answer



"Output current" should be read as "current into the output pin". As such, negative values indicate that the pin is sourcing current, and positive values mean that it is sinking current.


The floating issue can be remedied by using a device with bus hold such as the SN74LVCH245A. The bus hold feature holds the input pin at the previous detected logic level, and since the inputs and outputs are connected internally in the '245(A), this will hold the output as well regardless of the state of nOE and DIR.



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...