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.

A trivial query on GPIO

Status
Not open for further replies.

phaedrus

Member
Ok its not so trivial :p .

I am using an 16F819.I have configured some pins as Input and others as Output.
I have a situation where I wish to switch OFF all the output pins ( i.e. make the pins go LOW).
I am writing thus
PORTA=0;
PORTB=0;
I am not masking out the Input pins.My query is,if i do the above , does it affect the Input pins' capability to read the status of an input ?
 
Have a look at page 40 of the datasheet for figure 5-1 "BLOCK DIAGRAM OF RA0/AN0:RA1/AN1 PINS". This shows how a single port pin works and illustrates the latches used for writing along with the buffer used for input.

When you write to PORTA you actually write to this series of data latches. When you read it comes from the input buffer. The setting of the related TRIS register (along with analogue input settings and other special functions) determines what will actually be electrically connected.

So in short: no, it doesn't matter if you write to the whole of PORTA, even if some pins are inputs.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top