Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I/O buffers question

Status
Not open for further replies.

Mosaic

Well-Known Member
Digital I/O ports use buffers.

I'd like some an explanation on how these buffers work.
here's a what if:

;PORTA is set as an input via TRISA
bsf PORTA,0
; Input on PORTA,0 is a low impedance 0.
; PORTA now set as an output.

Now when I read PORTA,0 it should read 0 due to the low Z input, not so?

However if the Input were a HI-z, 0, would I read a 1 from PORTA,0 due to the bsf PORTA,0?


Does a PORT carry a single buffer or are the Input buffers separate from the output buffers?
 
When you read a port pin, it reads the value present on the pin wether or not you have it set to an input or an output. When you set the tris bit to make the pin an input, then it's a high impedance input, and will read whatever logic value is present on the pin.
 
I would just add that there is an output latch. You can set the latch to '0' or '1' but the latch is only connected to the pin when the associated TRIS bit is set to '0' (output).

For example, the Maxim/Dallas one-wire™ protocol has us place a '0' in the output latch and then we put a '0' on the one-wire™ pin by setting the TRIS bit to '0' (output) and put a '1' onto the pin via pull-up by setting the TRIS bit to '1' (input).
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top